[Bug] daemon catch-up drops tool_execution_end after large tool results #1902
ponythewhite
started this conversation in
Bug reports
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Version
0.8.1v0.8.1(514633727bf26d74f39f3119c2b0e31a5ceb2a9d)mainat5b6c0e94e11a97fcfdd7a9fc9dc4f7acbda9c85322.22.1Problem
After a large tool result, an attached daemon/RPC client can receive
tool_execution_startand the complete result update but never receive the matchingtool_execution_end. The successful result remains durable in the session JSONL, so the tool itself finished; only the terminal stream boundary is missing.Consumers that wait for
tool_execution_endcannot safely advance and eventually hit their deadline. The failures that led to this report used result frames around 219 KiB and had no provider, network, Docker, authentication, or verifier error.Root cause
There are two independent filtering points:
AgentDaemon.broadcastToSession()DaemonSupervisor.handleWorkerFrame()A large
socket.write()can returnfalseafter Node has accepted and queued the frame. Prime Agent marks that client as backpressured. A subsequent terminal event is then skipped in favor of snapshot catch-up. The same skip occurs while the active session has a snapshot in progress.Snapshot catch-up restores session state, but it does not replay the omitted
tool_execution_endevent boundary.Deterministic reproduction
The proposed branch adds focused cases to the existing daemon tests. Each case:
false;tool_execution_end;Without the source changes, the terminal frame is replaced by catch-up and the cases fail. With the change, the terminal event is delivered while ordinary traffic still uses catch-up.
Proposed fix
tool_execution_endpass the supervisor snapshot/backpressure filters.The focused tests pass, both affected test files pass (
268/268), andnpm run checkpasses.Code and prior PR
PR #1901 was closed automatically by the contribution gate because I am not yet a vouched contributor. I am opening this Discussion first as required by
CONTRIBUTING.md. I would appreciate maintainer feedback on the diagnosis and patch. If the change fits the project, please invite the implementation or advise how you would prefer it to be submitted.All reactions