Repository navigation
refactor(agent): a watch asks the API what became of its input (DEP-8992) - #714
robstolarz wants to merge 7 commits into
Conversation
…992) watch --after-input, create --watch and send --watch read the outcome of the awaited input from GetSessionInput and the reply by the message id it names, instead of working both out from the messages in the session view. The turn state machine now only serves --until-idle. 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 Cursor Approval AgentRisk: medium. Left a non-blocking comment; not approved. Cursor Bugbot reported two unresolved findings, including a high-severity watch failure, so human review is needed and no reviewers were assigned.
Sent by Cursor Approval Agent: Pull Request Router and Approver
…the answer (DEP-8992) A frame that only streams more of a reply no longer costs a read, and a reply the frame holds whole is taken from it rather than read by id. 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 Cursor Approval AgentRisk: medium. Left a non-blocking comment; not approved. Cursor Bugbot still has an unresolved medium-severity watch hang finding, so human review is needed and no reviewers were assigned.
Sent by Cursor Approval Agent: Pull Request Router and Approver
There was a problem hiding this comment.
Code review found no new issues
No new issues were found in this update; 3 findings from earlier reviews are still open above.
Still open from earlier reviews (3):
- 🔴
pkg/cmd/agent/watch.go:261—A watch can hang until its 30-minute timeout when the session goes idle before the API records the input as answered. a… - 🔴
pkg/cmd/agent/watch.go:328—--watch can exit 0 with a subagent's report, or a tool step, given as the agent's reply. This happens if the API's answ… - Also unresolved: 1 minor or pre-existing.
If you have decided not to act on one of these findings, resolve its thread (a reply alone leaves it open) and the next review stops counting it. To review this commit again now, use Re-run on its "Claude Code Review" check.
… read (DEP-8992) - The reply comes from the frame when the frame holds it whole; a failed read of a longer reply falls back to the frame's text instead of failing the watch. - A message that is not the assistant's, or that calls a tool, is not reported as the reply. - An idle session whose input still reads as placed gets one more read after the grace period instead of waiting for the timeout. - A refused read is reported under the RPC that was refused. 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
…s an error reply an error (DEP-8992) Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RQk3K7GpvQg7ySXyCrirEe
…lds (DEP-8992) Up to three more reads a grace period apart, and the next frame asks again. A reply whose input has left the view is printed. 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 0cf557c. Configure here.
…(DEP-8992) Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RQk3K7GpvQg7ySXyCrirEe
|
Replaced by #715: the same change as one commit, with the proto copy matching the API's. This branch is kept. |



A watch asks the API what became of its input (DEP-8992)
A sketch, built to test a theory. Not to be merged or released until the API side is live.
depot agent watch --after-input,create --watchandsend --watchworked out whether an input had its reply from the messages in the session view: a state machine with grace timers that followed the turn by position. They now ask the API, which answers from the session's stored record of the input (GetSessionInput):What is left of the state machine serves
--until-idlealone, which asks about the session, not an input. Hand-written source: +174 / −223. Tests: +166 / −331 (seven tests that pinned the deleted heuristics went; three tests of the outcomes replaced them).This makes #700 (DEP-8781) unnecessary: that change reads the same record from two new fields of the session view and keeps the old inference as a fallback. It can be closed with a pointer here when this lands.
Post-deploy test plan
Post-deploy test plan
Once the API serves
GetSessionInput, with a binary built from this branch:depot agent create "..." --watch: exit 0 with the reply.depot agent send <session> "<ask for a reply of several thousand words>" --watch -o json: exit 0, andreplyholds the whole text, not the view's cut of it.depot agent stop <session>: exit 1, "the turn was stopped before the agent replied".Against an API without the read the watch fails with the RPC's error, so the CLI release waits for the API. Checked before that with a binary from this branch against the live API:
watch --until-idle(which does not use the new read) exits 0 with the reply.🤖 Generated with Claude Code
https://claude.ai/code/session_01RQk3K7GpvQg7ySXyCrirEe
Note
Medium Risk
Changes core agent watch/create/send behavior and adds a hard dependency on a new RPC;
--until-idlepath is largely preserved but input waits fail if the API is absent.Overview
Watch flows that wait on a specific input (
watch --after-input,create --watch,send --watch,launch --watch) no longer infer completion from the session view. They call the newGetSessionInputRPC and branch onoutcome(pending/placed keep waiting; answered loads the named message; unanswered/withdrawn exit with structured errors).The old view-based machinery is removed:
base/newestSeq/beforeFirst, pickup grace for inputs missing from truncated views, and theturnheuristics (place,answered,lost, cut-view failure modes).--until-idlestill uses a slimmedturn.settledon the view only.Supporting changes: proto/connect
GetSessionInputtypes;awaited/answerinwatch.go;Renderer.Replyfor transcript/whole-message handling;wholeMessagenow returns role; watch errors can attribute the failing RPC viarpcError. Tests swap heuristic cases for API-outcome coverage and expectGetSessionInputon watch credential paths.Requires the API to expose
GetSessionInputbefore this CLI can ship for input-scoped watches.Reviewed by Cursor Bugbot for commit d09552c. Bugbot is set up for automated code reviews on this repo. Configure here.