Repository navigation
End a local code review when its agent is gone; Send never pretends - #3698
Merged
Merged
Conversation
A local review's server now quits once the agent that asked for it is gone (the parent that reads stdout, or the Claude Code mod's launch lease after two minutes), keeping its draft so the comments come back when the same review is opened again. PR reviews stay, since they can still post to the platform. Both review servers take an agentPresence probe: Send and Approve to a gone agent answer 410 agent_gone and archive, decide and delete nothing. The page says the review ended in one line with Copy feedback, and a refused send says the agent is gone.
A changed parent is only a suspicion: the review ends only when a write to its stdout fails with EPIPE, so a backgrounded launch that is still read lives. A Claude Code mod review ends only when its lease stamp stopped moving on the CLI's own clock and the Claude Code pid the lease now names no longer runs. The mod re-arms a stalled launch timer, and /clear or an in-process /resume hands open code reviews to the new session. Send asks the host live on every try. Pi between sessions answers away (409, Retry kept); OpenCode with no session says so instead of gone. A decision always wins over a pending end. The ended page saves its draft, then shows the done screen with Copy feedback, so no edit is lost.
…unfinished text A review open across /clear or an in-process /resume stays with the conversation that asked for it again: the pid check already keeps it open, and its decision waits for that conversation. The ended screen is its own: it never closes the tab and never says to go back to the agent. Text typed into a comment box but not added yet is kept as a general comment, in the draft and in Copy feedback, before the screen shows. On macOS the stdout probe is a zero-length write, which adds nothing to the output; elsewhere it stays one newline, documented with the head case.
…agent-gone # Conflicts: # apps/pi-extension/vendor.sh # docs/agent-guides/code-review.md # packages/review-editor/App.tsx
…page says not sent The server tests now save a line comment and a global comment with an attached image and check the draft is exactly the same after a Send to a gone agent (Bun and Pi). The page test sends a global comment to a gone agent: no sent screen, Feedback not sent with the agent-gone reason, no Retry, and the comment still on the page; a live agent still gets the sent screen. Name Forgejo among the platforms in the guide.
…and keeps every comment The page no longer covers itself with an ended screen. The server tells every tab, and every tab opened later, that the agent is gone (and that it is back), the draft keeps saving, and a local review ends only once no tab has had it open for two minutes. The words are in one file, packages/core/review-agent-gone-words.ts.
… passes its own reason @plannotator/ui ships against the published @plannotator/core, which has no review-agent-gone-words, so the UI keeps its copies of the three refusal codes (pinned by a test) and the review page hands the toast its reason.
…shed core The UI package smoke compares core's whole export list with the published @plannotator/core, and the new ./review-agent-gone-words export made it fail. The words file moves unchanged to packages/shared (private, not smoke-checked); both servers, the CLI and the review page import it from there, and Pi vendors it from the shared list.
…agent takes the stale not-sent toast down; every new stream hears where things stand
…nded-work # Conflicts: # apps/pi-extension/vendor.sh
backnotprop
marked this pull request as ready for review
November 26, 2026 20:49
yermakoffivan
pushed a commit
to yermakoffivan/plannotator
that referenced
this pull request
Nov 27, 2026
…d Pele 1.13 core 0.25.35 carries what merged after 0.25.34 went to npm: exact-phrase search in inbox-search (words in double quotes, backnotprop#4117, backnotprop#4124) and the agent-gone event in external-annotation's ExternalAnnotationEvent (backnotprop#3698). No exports subpath changes. ui handles that agent-gone event, so its pin follows and core goes first. ui 0.67.0 is a minor: DiagramSourceAcceptContext lets a host refuse a fence by its source before any engine runs (backnotprop#4146), DIAGRAM_REFUSED_RESULT is exported, Pele 1.13.0 with the inline fit changes (backnotprop#4113), the agent-gone send failures (backnotprop#3698) and the plan header seams (backnotprop#3905). README and HANDOFF name the new pair and the order (core first), and the hook and Pele notes now name ui 0.67.0 instead of "the first ui after 0.66.0". bun.lock is bun install's own output: the two package version lines.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In a local code review (
plannotator review), if the agent that asked for it quits, Send used to report success, archive the feedback and delete the draft, with nobody to receive it. Now Send refuses when nobody can receive the decision, and the person's comments are never lost.What changes
startReviewServertakesagentPresence("here" | "gone" | "away" | "no-session")./api/feedbackasks it on every Send, before it archives or settles anything. Gone answers410 agent_gone, away answers409 agent_away(Retry is kept), no-session answers410 no_session. In each case nothing is archived, decided or deleted. The PR platform's status post (platform: true) is never refused. The shared rule is inpackages/shared/review-agent-gone.ts.apps/hook/server/review-agent-watch.ts). For a review read through a pipe, Send probes stdout (EPIPE). For a Claude Code mod launch, Send answers gone as soon as the Claude Code process named in the lease no longer runs and nobody holds the lease (released at session end, or not renewed for 20 s, the mod's own stale-lease time). A fresh lease or a running process is "here", and a resume that takes the lease again is "here" at the next Send. One window remains: a Claude Code process that crashed without releasing its lease can still take a Send in the first 20 s; that decision is delivered if the session is resumed.{ type: "agent-gone", gone: true }on the event stream to every open tab. Once it has said either way, every stream that opens later (a reload, a reconnect after sleep) hears where things stand, gone or back. The page changes nothing: no cover, no done screen, the comments stay on screen. A notice at the bottom shows the reason with Copy feedback. A reconnect that hears "gone" again does not bring back a notice the person closed. The draft keeps saving, so a reload brings the comments back through the existing Draft Recovered dialog. When a mod session comes back (a resume takes the lease again), the server sendsgone: false: the notice goes away, so does a "not sent" toast from a Send refused because the agent was gone, and Send works again./clearor an in-process/resumestays with its conversation. Exit 3 is reported as an end, not as a crash.Docs:
code-review.md("When the agent that asked for a review is gone"),claude-code-mod.md(Detached launch),environment.md(PLANNOTATOR_TEST_REVIEW_NO_TAB_MS, sandbox only), and the/api/feedbackrow inserver-and-storage.md.New person-facing words (not yet approved)
They are all in
packages/shared/review-agent-gone-words.ts. The mod keeps a copy of its one line, because its folder imports nothing from outside it;apps/hook/hooks/mod/review-agent-gone.test.tsfails if the copy, the exit code or the stale-lease time drift from the shared ones.error: "The agent that asked for this review is gone. Nothing was sent; your comments are kept." / "No agent session can receive this right now. Nothing was sent; your comments are kept." / "This review has no agent session to send to. Nothing was sent; your comments are kept."Tests
packages/server/review-agent-gone.test.tsand its Pi mirrorapps/pi-extension/server/review-agent-gone.test.ts. Core case: agent gone → Send refused, draft kept, nothing archived. Both fail with the refusal taken out. The Bun file also checks that a tab connecting after the agent came back hearsgone: false, and that a review never said to be gone tells a new tab nothing.apps/hook/server/review-agent-watch.test.ts(including the mod launch's Send answer: released lease and process gone → refused at once; fresh lease with the process gone, a resume taking over → sent; process still running → sent; a stale held lease → refused after 20 s),apps/hook/server/review-agent-gone-cli.test.ts(real process tree: the tab hears it, the review stays for the tab and a reload, ends once the tab is closed, and the next review restores the draft),apps/hook/hooks/mod/review-agent-gone.test.ts.packages/ui/utils/sendFailure.agentGone.test.ts,packages/ui/hooks/useExternalAnnotations.seam.test.tsx,packages/review-editor/components/AgentGoneNotice.dom.test.tsx,packages/review-editor/App.agentGone.test.tsx(including: the agent back after a refused Send takes the "not sent" toast down; a reconnect keeps a closed notice closed, a new time gone shows it again).