Commit f273085
committed
chore(agent_loop): document accumulated_text streaming-already-emitted semantics
A reviewer raised the concern that pushing intermediate tool_use text
into `accumulated_text` could cause a double display when the streaming
path falls back to it for an empty final EndTurn — first via the live
stream, then again as `final_response`.
Verification (grep on bridge.rs):
* Streaming success arm (~bridge.rs:3032 `Ok(())`) calls only
`record_delivery` + `send_lifecycle_reaction`. It does NOT invoke
`send_response(buffered_text)`. The buffered fallback only fires on
the `Err(stream_error)` adapter-failure arm — that is recovery, not
a duplicate emit.
* `signal_response_complete` is a phase-change ping, not a re-emit of
response text.
* `final_response` (which may carry the accumulated_text fallback) is
consumed for session persistence, memory extraction, and hooks —
never pushed back onto `stream_tx`.
Conclusion: the concern is a false positive against the current wiring.
This commit pins the contract in code so a future refactor of the
bridge cannot quietly introduce a double display: the comment explains
the post-stream-fallback semantics and flags the exact invariant that
must hold (stream success arm must NOT re-emit `final_response` unless
the empty-text fallback is suppressed).1 parent 633bac9 commit f273085
1 file changed
Lines changed: 26 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4749 | 4749 | | |
4750 | 4750 | | |
4751 | 4751 | | |
| 4752 | + | |
| 4753 | + | |
| 4754 | + | |
| 4755 | + | |
| 4756 | + | |
| 4757 | + | |
| 4758 | + | |
| 4759 | + | |
| 4760 | + | |
| 4761 | + | |
| 4762 | + | |
| 4763 | + | |
| 4764 | + | |
| 4765 | + | |
| 4766 | + | |
| 4767 | + | |
| 4768 | + | |
| 4769 | + | |
| 4770 | + | |
| 4771 | + | |
| 4772 | + | |
| 4773 | + | |
| 4774 | + | |
| 4775 | + | |
| 4776 | + | |
| 4777 | + | |
4752 | 4778 | | |
4753 | 4779 | | |
4754 | 4780 | | |
| |||
0 commit comments