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.

v2.5.0 polish: coding-agent — push past path-giveup + guarantee no orchestration text leaks

purple4dd0d5a4b844
diff --git a/src/components/chat/CodexView.tsx b/src/components/chat/CodexView.tsx
index 94337338..8294f1ef 100644
--- a/src/components/chat/CodexView.tsx
+++ b/src/components/chat/CodexView.tsx
@@ -23,11 +23,25 @@ function stripChannelTags(text: string): string {
.replace(/<\|?channel\|?>/gi, '')
.replace(/<channel\|>/gi, '')
// Display safety net (David 2026-06-02): the user must only ever see real
- // prose answers + the rendered tool-call BLOCKS — never the raw tool-call
- // JSON / <tool_call> tags some local models emit as content instead of a real
- // answer. The engine already strips these in most paths, but this guarantees
- // a leak can never surface in the chat regardless of upstream.
+ // prose answers + the rendered tool-call BLOCKS — never raw tool-call JSON,
+ // hermes orchestration tags, or our own continue-nudge echoed back as prose.
+ // The engine strips most of this upstream, but this guarantees a leak can
+ // never surface in the chat regardless of which weak model is driving.
+ //
+ // 1) tool_call / tool_response / tool_result tags + their content. qwen2.5-
+ // coder:7b (confirmed live 2026-06-02) HALLUCINATES hermes-style
+ // <tool_response> Error: … </tool_response> blocks INTO its prose. Native
+ // tool results are role:'tool' messages and never reach assistant content,
+ // so anything matching these tags is noise meant only for the model.
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, '')
+ // 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
+ // working autonomously…") through the closing "finished and verified."
+ // so the orchestration sentence never reads as a real LLM answer.
+ t = t.replace(/(?:please wait[,;:]?\s*(?:while\s+)?i\s+(?:will\s+)?)?continue working autonomously[\s\S]*?finished and verified\.?/gi, '')
try {
const { ranges } = extractToolCallsWithRanges(t)
if (ranges.length) t = stripRanges(t, ranges)
@@ -221,12 +235,16 @@ export function CodexView() {
)
}
if (block.phase === 'answer' && block.content.trim()) {
+ // Strip FIRST: if the block was only a
+ // parroted nudge / hallucinated tool tag,
+ // it strips to empty — render nothing
+ // rather than an empty bubble.
+ const answer = stripChannelTags(block.content)
+ if (!answer) return null
return (
<div key={block.id} className="px-1 py-0.5">
<div className="text-[0.75rem] leading-relaxed">
- <MarkdownRenderer
- content={stripChannelTags(block.content)}
- />
+ <MarkdownRenderer content={answer} />
</div>
</div>
)
diff --git a/src/hooks/useCodex.ts b/src/hooks/useCodex.ts
index 94c11d27..fe59a550 100644
--- a/src/hooks/useCodex.ts
+++ b/src/hooks/useCodex.ts
@@ -804,8 +804,15 @@ export function useCodex() {
// questions (David 2026-06-02: coding agent "antwortet in loops" on a
// simple question — it called shell_execute 3× + repeated "Task
// completed" because "completed" never matched the completion regex).
- const stalledNarration = /\b(i'?m about to|i will(?: now)?|i'?ll\b|let me\b|next,?\s*i\b|now i'?ll|going to|first,?\s*i\b|then i'?ll|i need to (?:read|open|check|look|run|see|find))\b/i.test(turnContent)
- const asksForInfo = /\b(please provide|could you (?:please )?(?:provide|share|tell|give|specify)|what(?:'s| is) the (?:path|file|name|location)|which file|can you (?:provide|share|specify|tell)|provide (?:the|me) (?:the )?(?:path|file|details|more)|need (?:the|more) (?:path|info|details|context))\b/i.test(turnContent)
+ const stalledNarration = /\b(i(?:'?m| am) about to|i will(?: now)?|i'?ll\b|let me\b|next,?\s*i\b|now i'?ll|going to|first,?\s*i\b|then i'?ll|i (?:need|have|am going) to (?:read|open|check|look|run|see|find))\b/i.test(turnContent)
+ // "asksForInfo" also catches the model giving up by asking the user to
+ // VERIFY/CONFIRM a path it can discover itself ("it seems there is an
+ // issue with the file path … could you please verify the correct path
+ // to sum.js?" — David 2026-06-02 live coding run with qwen2.5-coder:7b).
+ // The verify/confirm/clarify branch is anchored on a path/file NOUN so
+ // a genuine completion ("I fixed it, please verify the changes") does
+ // NOT match — only "verify the (correct) path/file/location" does.
+ const asksForInfo = /\b(please provide|could you (?:please )?(?:provide|share|tell|give|specify|verify|confirm|clarify)|what(?:'s| is) the (?:path|file|name|location)|which file|can you (?:provide|share|specify|tell)|provide (?:the|me) (?:the )?(?:path|file|details|more)|(?:verify|confirm|clarify) (?:the )?(?:correct |right |exact |full )?(?:path|file ?path|location|directory|filename|file name)|need (?:the|more) (?:path|info|details|context))\b/i.test(turnContent)
const emptyTurn = turnContent.trim().length === 0
if ((stalledNarration || asksForInfo || emptyTurn) && continueNudgesRemaining > 0) {
continueNudgesRemaining--