fix(agents): suppress commentary-phase output leaks#61282
Conversation
Greptile SummaryThis PR fixes commentary-phase assistant output leaking into user-visible delivery paths ( Confidence Score: 5/5Safe to merge; the fix is minimal, well-targeted, and comprehensively tested. The only remaining finding is a P2 observation: handleMessageStart fires the typing-indicator callback unconditionally for commentary messages, causing a spurious typing flash. Teardown is unconditional so there is no stuck-indicator risk. No P0 or P1 issues were found. The suppression logic is correct for both delivery shapes, buffer cleanup is correct, and the test suite covers all affected code paths. No files require special attention.
|
5f72beb to
b3f1093
Compare
b3f1093 to
e392904
Compare
|
Merged via squash.
Thanks @mbelinky! |
Summary
phase:"commentary"were already being preserved by the OpenAI Responses conversion path, but the embedded subscribe delivery bridge still treated them like normal user-visible assistant output.Need send...orNeed update tracker...could leak into Telegram partials and final reply paths before the real answer.message.phaseor only insidetextSignaturemetadata.text_*updates now bail out before mutating visible-output buffers, partial-reply state, or block-reply flush paths.Root Cause
src/agents/pi-embedded-subscribe.handlers.messages.tsignored assistant delivery phase when deciding what to stream or flush to the user.textSignature-only shape covered bysrc/agents/openai-ws-stream.test.ts.onPartialReply, block-reply flush, or final assistant text emission even though it was internal-only output.Why This Layer
Red-Team / Hardening Review
message.phase: it did not originally, so this PR explicitly covers thetextSignature-only commentary shape too.text_*updates.phase:"commentary";final_answerand normal assistant messages still flow unchanged.Change Type
Scope
User-visible / Behavior Changes
message.phasecommentary and to replay/live shapes that only carry the phase intextSignaturemetadata.Tests
Targeted serial verification on
mb-air:Result:
3files,38tests passed.AI / Testing Notes