Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Suppress Assistant tool prelude leaks
rcourtman16edfb44d36f
diff --git a/docs/release-control/v6/internal/status.json b/docs/release-control/v6/internal/status.jsonindex 039f56f393..cc6587ae9f 100644--- a/docs/release-control/v6/internal/status.json+++ b/docs/release-control/v6/internal/status.json@@ -6767,11 +6767,11 @@{"id": "codex-lane-followup-architecture-post-rc-canonicalization","agent_id": "codex",- "summary": "Make Assistant tool execution visible live",+ "summary": "Suppress compacted Assistant tool prelude leaks","target_id": "v6-product-lane-expansion","claimed_at": "2026-06-05T21:57:48Z",- "heartbeat_at": "2026-06-05T23:45:41Z",- "expires_at": "2026-06-06T01:45:41Z",+ "heartbeat_at": "2026-06-06T00:19:43Z",+ "expires_at": "2026-06-06T02:19:43Z","work_item": {"kind": "lane-followup","id": "architecture-post-rc-canonicalization"diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.mdindex c88ba25afc..f79b15cfcd 100644--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md@@ -214,6 +214,20 @@ runtime cost control, and shared AI transport surfaces.updates flowing through `packages/opencode/src/session/tools.ts`. Pulse'sstream contract adapts that model with `tool_start`, `tool_progress`, and`tool_end` events that update the same visible pending tool row in place.+ The referenced OpenCode source at fetched `origin/dev` commit+ `fa2b63f850fc0a23bec2bdff9e660450d3fe7913` also keeps assistant text,+ reasoning, and tool invocation as typed message parts in+ `packages/opencode/src/session/message.ts`, while+ `packages/opencode/src/session/processor.ts` updates text and reasoning+ parts through `*-delta` events instead of rendering raw provider tool-call+ syntax as assistant prose. Pulse's frontend stream reducer must preserve the+ same user-facing invariant: visible transcript content is typed assistant+ text or a typed Pulse tool/approval/question row. Suspicious compacted+ provider prelude text that looks like tool-call narration must be buffered+ until it is proven to be normal answer text or stripped when a raw tool-call+ marker arrives; it must not flash as run-on prose such as+ `I'llcheckthedevicenodes...` while the actual governed tool row is still+ being assembled.Streamed provider startup must be bounded by the configured Assistant requesttimeout, the OpenAI-compatible SSE response-header guard, and the first SSEbody-read guard adapted from OpenCode's provider `wrapSSE` source; transientdiff --git a/frontend-modern/src/components/AI/Chat/__tests__/assistantOutputHygiene.test.ts b/frontend-modern/src/components/AI/Chat/__tests__/assistantOutputHygiene.test.tsindex 586ff45143..52dd1060c3 100644--- a/frontend-modern/src/components/AI/Chat/__tests__/assistantOutputHygiene.test.ts+++ b/frontend-modern/src/components/AI/Chat/__tests__/assistantOutputHygiene.test.ts@@ -71,13 +71,13 @@ describe('stripAssistantOutputArtifacts', () => {expect(flushPendingAssistantOutputText(state)).toBe('');});- it('asks callers to replace already emitted compacted prose when a split leak completes', () => {+ it('holds compacted prose so a split tool leak never flashes in the transcript', () => {const state = createAssistantOutputArtifactStreamState();const first ="I'llcheckthedevicenodesinsidethecontainertoanswerthat.Letmecounttheentriesin/devandlisttheblockdevices.";expect(appendVisibleTextBeforeAssistantOutputArtifacts(state, first)).toEqual({- text: first,+ text: '',stripped: false,});expect(@@ -88,12 +88,22 @@ describe('stripAssistantOutputArtifacts', () => {).toEqual({text: '',stripped: true,- previousVisibleText: first,- replacementText: '',});expect(flushPendingAssistantOutputText(state)).toBe('');});+ it('flushes held compacted prose when no tool leak follows before stream end', () => {+ const state = createAssistantOutputArtifactStreamState();+ const content =+ "Thisisbadmodelspacingbutitistheactualanswerbecauseitneverturnsintoatoolcall.";++ expect(appendVisibleTextBeforeAssistantOutputArtifacts(state, content)).toEqual({+ text: '',+ stripped: false,+ });+ expect(flushPendingAssistantOutputText(state)).toBe(content);+ });+it('releases a held prefix when the next delta proves it is normal prose', () => {const state = createAssistantOutputArtifactStreamState();diff --git a/frontend-modern/src/components/AI/Chat/__tests__/useChat.test.ts b/frontend-modern/src/components/AI/Chat/__tests__/useChat.test.tsindex 15e1e9b004..bf456dc4d6 100644--- a/frontend-modern/src/components/AI/Chat/__tests__/useChat.test.ts+++ b/frontend-modern/src/components/AI/Chat/__tests__/useChat.test.ts@@ -846,7 +846,7 @@ describe('useChat', () => {dispose();});- it('retracts compacted internal prose when a split tool-call leak completes', async () => {+ it('holds compacted internal prose so a split tool-call leak never becomes visible', async () => {const { getFireEvent } = setupWithEventCapture();const { value: chat, dispose } = withRoot(() => useChat({ sessionId: 's' }));@@ -856,7 +856,12 @@ describe('useChat', () => {"I'llcheckthedevicenodesinsidethecontainertoanswerthat.Letmecounttheentriesin/devandlisttheblockdevices.";fire({ type: 'content', data: compacted });- expect(chat.messages().find((m) => m.role === 'assistant')?.content).toBe(compacted);+ expect(chat.messages().find((m) => m.role === 'assistant')?.content).toBe('');+ expect(+ chat.messages()+ .find((m) => m.role === 'assistant')+ ?.streamEvents?.filter((e) => e.type === 'content'),+ ).toEqual([]);fire({type: 'content',@@ -872,6 +877,29 @@ describe('useChat', () => {dispose();});+ it('flushes held compacted prose on done when no tool-call leak follows', async () => {+ const { getFireEvent } = setupWithEventCapture();+ const { value: chat, dispose } = withRoot(() => useChat({ sessionId: 's' }));++ await chat.sendMessage('hi');+ const fire = getFireEvent();+ const compacted =+ 'Thisisbadmodelspacingbutitistheactualanswerbecauseitneverturnsintoatoolcall.';++ fire({ type: 'content', data: compacted });+ expect(chat.messages().find((m) => m.role === 'assistant')?.content).toBe('');++ fire({ type: 'done', data: {} });++ const assistant = chat.messages().find((m) => m.role === 'assistant')!;+ expect(assistant.content).toBe(compacted);+ expect(assistant.streamEvents?.filter((e) => e.type === 'content')).toEqual([+ { type: 'content', content: compacted },+ ]);+ expect(assistant.isStreaming).toBe(false);+ dispose();+ });+it('resumes visible content after a governed tool boundary clears a raw leak', async () => {const { getFireEvent } = setupWithEventCapture();const { value: chat, dispose } = withRoot(() => useChat({ sessionId: 's' }));diff --git a/frontend-modern/src/components/AI/Chat/assistantOutputHygiene.ts b/frontend-modern/src/components/AI/Chat/assistantOutputHygiene.tsindex 7b2479f1fe..2fd4814529 100644--- a/frontend-modern/src/components/AI/Chat/assistantOutputHygiene.ts+++ b/frontend-modern/src/components/AI/Chat/assistantOutputHygiene.ts@@ -76,6 +76,11 @@ export function appendVisibleTextBeforeAssistantOutputArtifacts(const candidate = existing + text;const idx = assistantOutputArtifactIndex(candidate);if (idx < 0) {+ if (!existing && isCompactedToolPrelude(text)) {+ state.pendingText = text;+ return { text: '', stripped: false };+ }+const { visible, held } = splitTrailingPotentialToolNamePrefix(text);state.visibleText += visible;state.pendingText = held;@@ -87,6 +92,12 @@ export function appendVisibleTextBeforeAssistantOutputArtifacts(const previousVisibleText = state.visibleText;state.visibleText = '';state.pendingText = '';+ if (!previousVisibleText) {+ return {+ text: '',+ stripped: true,+ };+ }return {text: '',stripped: true,