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.
TypeScript agentai-chatai-studioall-in-onecoding-agentdesktop-appfluximage-generationlinuxllmlocal-ailocal-llmopen-sourceprivacyself-hostedstable-diffusionuncensoreduncensored-aivideo-generationwindows
fix(thinking): die zwei stillen Agenten geben eine Antwort zurueck, keinen Gedanken
purple2078e4f2f9cd
diff --git a/src/api/agents/architect.ts b/src/api/agents/architect.tsindex c5ed44ac..491c9a16 100644--- a/src/api/agents/architect.ts+++ b/src/api/agents/architect.ts@@ -1,3 +1,4 @@+import { settleThinking } from '../../lib/thinking-stripper'import type { ChatMessage } from '../providers/types'import { getProviderForModel } from '../providers'@@ -78,7 +79,10 @@ export async function planWithArchitect(signal: input.signal,})return {- plan: (content ?? '').trim(),+ // The plan is pasted into the EDITOR's system prompt verbatim, so a+ // thinking model's reasoning would ride into every coding turn after it+ // (2.6.7 Denk-Audit, Loch 11). Same settlement as every visible surface.+ plan: settleThinking(content ?? '', '', false).content,modelUsed: input.model,tookMs: Date.now() - t0,}diff --git a/src/api/agents/sub-agent.ts b/src/api/agents/sub-agent.tsindex e18994dd..b60ddf9f 100644--- a/src/api/agents/sub-agent.ts+++ b/src/api/agents/sub-agent.ts@@ -11,6 +11,7 @@* filtering, the model has no syntactically valid path to recurse.*/+import { settleThinking } from '../../lib/thinking-stripper'import type { MCPToolDefinition } from '../mcp/types'import { executeParallel, type ExecutionRequest } from './tool-executor'import type { AgentRunContext } from '../agent-context'@@ -169,7 +170,11 @@ export async function defaultSubAgentRunner(return `${options.budget.haltMessage()} ${finalContent || '(no partial answer)'}`}const turn = await provider.chatWithTools(modelId, messages, llmTools, {})- finalContent = turn.content || finalContent+ // What a sub-agent returns becomes a TOOL RESULT in the parent's context,+ // so leaked reasoning floods the run it was supposed to shorten (2.6.7+ // Denk-Audit, Loch 11). Same settlement as every visible surface.+ const settled = settleThinking(turn.content || '', '', false).content+ finalContent = settled || finalContentif (!turn.toolCalls || turn.toolCalls.length === 0) breakoptions.budget.addToolCalls(turn.toolCalls.length)diff --git a/src/lib/__tests__/thinking-side-surfaces.test.ts b/src/lib/__tests__/thinking-side-surfaces.test.tsindex b3a7bfa0..19768678 100644--- a/src/lib/__tests__/thinking-side-surfaces.test.ts+++ b/src/lib/__tests__/thinking-side-surfaces.test.ts@@ -132,3 +132,25 @@ describe('the benchmark counts an inline thought as a thought', () => {expect(m.thinkTokens).toBeGreaterThan(0)})})++// ── Loch 11: the two silent agents ─────────────────────────────+describe('what a hidden agent hands back is an answer, not a thought', () => {+ it('the architect plan is settled before it becomes a system prompt', () => {+ // The plan is pasted into the EDITOR's system prompt verbatim, so leaked+ // reasoning rides into every coding turn after it.+ expect(read('../../api/agents/architect.ts')).toContain("settleThinking(content ?? '', '', false).content")+ })++ it('a sub-agent result is settled before it becomes a tool result', () => {+ expect(read('../../api/agents/sub-agent.ts')).toContain("settleThinking(turn.content || '', '', false).content")+ })++ it('which is what keeps a pre-opened thought out of the parent context', () => {+ const raw = 'The plan, roughly.</think>1. read the file\n2. patch it'+ expect(settleThinking(raw, '', false).content).toBe('1. read the file\n2. patch it')+ })++ it('NEGATIVE CONTROL: a plan without reasoning is passed through as it is', () => {+ expect(settleThinking('1. read the file', '', false).content).toBe('1. read the file')+ })+})