Watch
1
0
Fork
You've already forked souveraine
0

patches: queue think-fence collision fix

This commit is contained in:
Fimeg 2026-08-11 08:10:39 -04:00
commit f17fa7c31b

View file

@ -0,0 +1,46 @@
From 03bd4f14a10d7703ba8d61fa66fdb2c97e630862 Mon Sep 17 00:00:00 2001
From: Fimeg <casey.tunturi@gmail.com>
Date: Tue, 11 Aug 2026 08:09:36 -0400
Subject: [PATCH] shell: stop sensor calls closing an open reasoning fence
A tool_call/tool_return arriving while a <think> block was open emitted its
own self-closing fence, whose </think> closed the outer block early. Every
reasoning token after that point rendered as prose, and the stray close left
the trailing assistant text mis-segmented. Append inside the open fence
instead; only open one when arriving in prose.
---
surfaces/quickshell/services/Ai.qml | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/surfaces/quickshell/services/Ai.qml b/surfaces/quickshell/services/Ai.qml
index 0f64b86..cd065c8 100644
--- a/surfaces/quickshell/services/Ai.qml
+++ b/surfaces/quickshell/services/Ai.qml
@@ -356,13 +356,22 @@ Singleton {
root.appendToStreaming(event.content);
break;
case "tool_call_message": {
+ // A sensor firing mid-reasoning must not close the reasoning
+ // fence. When a <think> block is already open we append inside it;
+ // only a sensor arriving in prose opens a fence of its own.
const call = event.tool_call;
- root.appendToStreaming(`\n\n<think>\nsensor: ${call.function.name}(${call.function.arguments})\n</think>\n`);
+ const body = `sensor: ${call.function.name}(${call.function.arguments})`;
+ root.appendToStreaming(root.inThinkBlock
+ ? `\n${body}\n`
+ : `\n\n<think>\n${body}\n</think>\n`);
break;
}
case "tool_return_message": {
const ret = event.tool_return;
- root.appendToStreaming(`\n<think>\n[${ret.status}] ${ret.output}\n</think>\n`);
+ const body = `[${ret.status}] ${ret.output}`;
+ root.appendToStreaming(root.inThinkBlock
+ ? `\n${body}\n`
+ : `\n<think>\n${body}\n</think>\n`);
break;
}
case "interstitial":
--
2.55.0