Commit 2f92655
fix(acp): stream durable session updates that follow a message chunk
`DurableUpdateSink::handle_notification` buffered every non-message
`session/update` — `tool_call`, `tool_call_update`, `plan`, `mode`,
`available_commands_update` — whenever a message chunk had already opened
the completion buffer, and committed the buffer only at the next message
boundary.
Any agent that streams text before calling a tool therefore withholds its
whole durable stream until the *post-tool* message arrives. Pi prints a
banner chunk on some turns, so roughly a third of prompt turns delivered
`tool_call_update { in_progress }` for a `sleep 60` only when the command
finished, together with every other update of the turn. A caller that
waits for that boundary before cancelling never observes a live turn:
`session/cancel` then races prompt completion and reports
`no_active_prompt`.
Commit the in-progress text run first, then the update. The durable
sequence is unchanged — `coalesce_completed_message` already ends the
text run it is building at any non-text update, so the same events are
emitted in the same order, only in more (smaller) batches — and the
update now reaches the host the moment the adapter produces it.
The regression test drives an ACP adapter that emits one message chunk,
then the tool updates, then holds the turn open for two seconds. It
records the live event sink and fails if the `in_progress` update lands
at turn end: on the previous behavior it arrives at 2.06s of a 2.06s
turn.1 parent 90ec6e1 commit 2f92655
2 files changed
Lines changed: 518 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1017 | 1017 | | |
1018 | 1018 | | |
1019 | 1019 | | |
1020 | | - | |
1021 | | - | |
1022 | | - | |
1023 | | - | |
1024 | | - | |
1025 | | - | |
1026 | | - | |
1027 | | - | |
1028 | | - | |
1029 | | - | |
1030 | | - | |
1031 | | - | |
1032 | | - | |
1033 | | - | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
1034 | 1038 | | |
1035 | 1039 | | |
1036 | 1040 | | |
| |||
0 commit comments