Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

fix(code): clear the provider's truncated tool tag in the Code transcript too

purple6960928ec9b5
diff --git a/src/components/chat/CodexView.tsx b/src/components/chat/CodexView.tsx
index 786c510c..f1082c22 100644
--- a/src/components/chat/CodexView.tsx
+++ b/src/components/chat/CodexView.tsx
@@ -48,6 +48,12 @@ function stripChannelTags(text: string): string {
t = t.replace(/<tool_call>[\s\S]*?<\/tool_call>/gi, '').replace(/<\/?tool_call>/gi, '')
t = t.replace(/<tool_response>[\s\S]*?<\/tool_response>/gi, '').replace(/<\/?tool_response>/gi, '')
t = t.replace(/<tool_result>[\s\S]*?<\/tool_result>/gi, '').replace(/<\/?tool_result>/gi, '')
+ // 1b) The same tag with its opening bracket already eaten. Captured off
+ // the wire 2026-07-25: Qwen3-32B through LU Cloud sends
+ // `</think>\n\nool_call>` as content next to a valid tool_calls array —
+ // the PROVIDER's parser drops the `<t`, so a pattern anchored on `<`
+ // cannot see the remainder. Line-anchored so prose is never touched.
+ t = t.replace(/^[ \t]*<?[|/]*t?ool_(?:call|calls|response|result)s?[|/]*>[ \t]*$/gim, '')
// 2) The autonomous-continue NUDGE, if a weak model parrots it back as its
// own answer (qwen2.5-coder:7b did this verbatim). It is OUR fixed
// instruction from useCodex — strip from its opening clause ("…continue
diff --git a/src/lib/__tests__/readonly-enforcement.test.ts b/src/lib/__tests__/readonly-enforcement.test.ts
index 829165db..ba7b8813 100644
--- a/src/lib/__tests__/readonly-enforcement.test.ts
+++ b/src/lib/__tests__/readonly-enforcement.test.ts
@@ -84,3 +84,26 @@ describe('both hooks still carry the guard', () => {
}
})
})
+
+describe('/loop budget is enforced in the run, not just stated', () => {
+ it('useCodex checks the wall clock between iterations', () => {
+ const src = read('../../hooks/useCodex.ts')
+ // The deadline has to be derived from the command, not from a setting.
+ expect(src).toContain("slash?.command.name === 'loop' ? parseLoopBudget(slash.args).budgetMs : null")
+ expect(src).toContain('if (loopDeadline && Date.now() > loopDeadline && i > 0)')
+ // And it must report the stop rather than going quiet.
+ expect(src).toContain('time is up')
+ })
+
+ it('the check sits at the TOP of the iteration, never mid-tool', () => {
+ const src = read('../../hooks/useCodex.ts')
+ const loopHead = src.indexOf('for (let i = 0; i < MAX_CODEX_ITERATIONS')
+ const deadline = src.indexOf('if (loopDeadline && Date.now() > loopDeadline')
+ const firstExec = src.indexOf('budget.addToolCalls(')
+ expect(loopHead).toBeGreaterThan(0)
+ expect(deadline).toBeGreaterThan(loopHead)
+ // Cutting a run off inside file_edit or a shell command would leave the
+ // workspace in a state nobody asked for.
+ expect(deadline).toBeLessThan(firstExec)
+ })
+})