Repository navigation
fix(agent): read a long reply whole, keep a long watch alive (DEP-8516) - #688
Conversation
A report a subagent steers into the running turn shows in the view as a user message. The wait counted it as another input and gave up on the reply while the agent was still working. Only an input from outside the session ends the awaited turn now. DEP-8516. Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RQk3K7GpvQg7ySXyCrirEe
DEP-8516 Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RQk3K7GpvQg7ySXyCrirEe
A reply longer than the session view keeps is now read in full through GetSessionMessage, for the transcript and for the JSON result. Against an API without that call the cut reply is kept and the transcript says so. A connection the server ends under an open watch stream reaches the client as a message cut short, which the watch did not retry. It now reconnects and resumes from the last cursor. DEP-8516 Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RQk3K7GpvQg7ySXyCrirEe
…in the timeout A subagent's report that comes in after the reply no longer hides that reply from the wait. The full read of a long reply now ends with the watch's own deadline. DEP-8516. Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RQk3K7GpvQg7ySXyCrirEe
DEP-8516 Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RQk3K7GpvQg7ySXyCrirEe
…li-waits Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RQk3K7GpvQg7ySXyCrirEe
The transcript from logs kept the view's cut text for a reply over the view's per-message limit. It now reads that reply in full, as watch does. -o json still prints the view as the API returns it. Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RQk3K7GpvQg7ySXyCrirEe
…eft the view (DEP-8516) A read that failed through its retries left the reply cut for the rest of the watch. A transient failure is now tried again on the next frames. The full text of a reply is dropped once the view no longer holds it, so a long watch does not keep every reply it read. Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RQk3K7GpvQg7ySXyCrirEe
…eam (DEP-8516) Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RQk3K7GpvQg7ySXyCrirEe
DEP-8516 Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RQk3K7GpvQg7ySXyCrirEe
There was a problem hiding this comment.
Stale comment
[!NOTE]
🤖 Cursor Grok 4.6 responding on behalf of Jacob GillespieRisk: medium. Cursor Bugbot reported two unresolved findings on whole-reply timeout retries and idle-frame recovery, so this is not approved. Human review is needed and no reviewers were assigned.
Sent by Cursor Approval Agent: Pull Request Router and Approver
… the wait ends DEP-8516 Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RQk3K7GpvQg7ySXyCrirEe
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 86a9bc6. Configure here.
There was a problem hiding this comment.
Stale comment
[!NOTE]
🤖 Cursor Grok 4.6 responding on behalf of Jacob GillespieRisk: medium. Cursor Bugbot reported one unresolved finding on the whole-reply reread heuristic, so this is not approved. Human review is needed and no reviewers were assigned.
Sent by Cursor Approval Agent: Pull Request Router and Approver
The re-read ran on any frame that was not running, so it spent the tries on idle frames the wait carried on past, and missed a wait that ends while the session is already on its next input. Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RQk3K7GpvQg7ySXyCrirEe
Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RQk3K7GpvQg7ySXyCrirEe
|
From Claude: delegate merge approval (local codex review gate).
|
|
Proof addendum: head is now |



A reply longer than 4096 bytes came back from
depot agentcut, ending[N bytes truncated]. The CLI now reads such a reply whole. DEP-8516 (CLI half). Stacked on #687.replyin JSON,agent logsandagent watchcallGetSessionMessagefor a reply the view marks withtruncatedBytes > 0.--timeout: a read still open at the deadline exits 2 (timeout), not 0 with a cut reply.--watchkeeps going when the server ends the connection under the stream (GOAWAY) and picks up from its cursor.Proven live at this head on a test org: a 2500-line reply returned 11392 bytes complete from
create --watch -o json(5 of 5 runs) and fromagent logs. One run made as the server deploy was finishing returned the cut text and exit 0, which is the older-server path.Also live, at the head before the last fix: two
create --watchsessions that ran a 20-minute command each exited 0 after 21 minutes with the whole 11392-byte reply.Not proven live: a failed read recovering on a later try, and a connection cut under the stream (tests only; neither happened in these runs).
Post-deploy test plan
Post-deploy test plan
Needs a CLI release with this change; until then build this branch (
go build -o depot ./cmd/depot).Expected:
exit 0,11392,2500, then0.Agent context
retryablecovers unavailable, deadline, unknown, internal, and the client's "incomplete envelope" for a connection cut under a stream.proto/depot/agent/v1/depot_agent_core.protosynced forGetSessionMessageand regenerated; its comments come from the source proto.pkg/cmd/agent/session_test.go): whole reply in watch, logs and JSON; older server; failed read then later frame; eviction; recovered reply not restarting the next stream; read outlasting--timeout; a hung first try; a wait ending on the frame whose read failed; a GOAWAY at frame level.depot agent: create, send, list, watch, logs, stop (DEP-8506) #687 branch.🤖 Generated with Claude Code
https://claude.ai/code/session_01RQk3K7GpvQg7ySXyCrirEe
Note
Medium Risk
Changes watch/logs networking, timeout semantics, and stream reconnection behavior; failures degrade to truncated text rather than hard errors, but long-running watches now depend on a new RPC.
Overview
Adds
GetSessionMessageto the agent API and wires the CLI so truncated assistant replies (from the bounded session view) are fetched in full foragent watchandagent logstext output and forreplyin JSON watch results, while-o jsonlogs still emit the API view unchanged.The renderer gains
Whole/Recover/keep: it calls the new RPC for assistant messages withtruncatedBytes, caches full text, retries transient failures on later frames, drops cache when messages leave the view, and surfaces cut or failed reads in the transcript without failing the command.agent watchintegrates bounded retries/timeouts for whole-message reads (counting against--timeout),Recoverbefore returning a settled reply, and treats HTTP/2 GOAWAY / incomplete stream errors as retryable so long watches reconnect from cursor. Proto and Connect stubs are regenerated; tests cover GOAWAY, long replies, timeouts, and older APIs without the RPC.Reviewed by Cursor Bugbot for commit 8eda9ad. Bugbot is set up for automated code reviews on this repo. Configure here.