You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug(agents): extractAssistantVisibleText leaks commentary when final_answer exists but is empty #61474
After #59643 merged, extractAssistantVisibleText() in src/agents/pi-embedded-utils.ts:333-339 can still leak commentary as user-visible text.
Repro condition
When a mixed-phase assistant message has a final_answer block that sanitizes to empty (e.g. whitespace-only or stripped), the function falls back to extractAssistantTextForPhase(msg) with no phase argument, which returns unphased text. If the message also contains commentary blocks, that commentary can become the visible output.
Expected behavior
If final_answer is present but empty, visible output should be empty — not fall back to commentary/unphased text. "No answer" is safer than surfacing chain-of-thought.
Code location
src/agents/pi-embedded-utils.ts:333-339
The fallback path at extractAssistantTextForPhase(msg) (no phase) returns resolvedPhase === undefined blocks only, but the presence of explicit phased blocks changes unphased fallback behavior (:280-285, 297-321).
Severity
P1 — defeats the intended "prefer final_answer, suppress commentary" rule from #59643.
Items 1–4 are the same family: phase-integrity gaps in the OpenAI Responses WS stream/replay/delivery layers. Item 5 is a separate data-loss issue in the same file.
Activity
100yenadmin commentedon Apr 5, 2026
This is part of a family of 5 post-merge findings from adversarial review of #59643. All are in the OpenAI WS → embedded subscribe → delivery path:
Items 1–4 are the same family: phase-integrity gaps in the OpenAI Responses WS stream/replay/delivery layers. Item 5 is a separate data-loss issue in the same file.
Follow-up PR addressing adjacent phase-blind surfaces: #61463
100yenadmin commentedon Apr 5, 2026
Fix PR: #61481