Repository navigation
Description
Context
revdiff is often driven by an AI agent: the agent generates a change, launches revdiff for a human to read, then decides what to do next from the exit code. The bundled launcher sets REVDIFF_EXIT_CODE_ON_ANNOTATIONS, so every reviewer-driven exit that is not a crash is one of two values:
| Reviewer action | Exit code | What the agent concludes |
|---|---|---|
q with annotations |
10 | feedback to address |
q with no annotations |
0 | nothing to address |
Q (discard and quit), even with annotations |
0 | nothing to address |
.claude-plugin/skills/revdiff/SKILL.md states the reading: "Done when user quits without annotations" (line 73).
The case I hit: I was reading an agent-generated diff, spotted something wrong, and decided to go fix it myself rather than write it up. I quit. The agent took the clean exit as a finished review and committed.
A quit with no annotations is ambiguous. "I read this and it is fine" and "I am stopping here to go fix it myself" are the same keystroke, and nothing tells the reviewer that one of them will be reported as a completed review. An exit with annotations carries a clear signal, so the gap is only the no-annotations case.
Proposed approach
When the reviewer quits with no annotations, ask before exiting:
┌────────────────┐┌───────────────────────────────────────────────────────┐
│ app/ ││ app/main.go │
│ main.go ││ 326 // the agent may read this concurrently │
│ config.go ││ 327 - err := fsutil.AtomicWriteFile(p, out) │
│ fsutil/ ││ 328 + err := os.WriteFile(p, out, 0o644) │
│ README.md ││ 329 if err != nil { │
│ ││ 330 return fmt.Errorf("write: %w", err) │
│ ││ 331 } │
└────────────────┘└───────────────────────────────────────────────────────┘
finish the review with no annotations? [y/n]
y exits 0, as today. n exits with a code distinct from 0 and 10 (11 sits next to the existing one), reporting that the review was stopped rather than finished. esc returns to the review, as it does in the discard prompt.
revdiff already has this interaction: Q with a non-empty store renders discard %d annotations? [y/n] in the status bar (app/ui/view.go:171) off an inConfirmDiscard flag, dispatched ahead of normal key handling (app/ui/model.go:973) and handled by handleConfirmDiscardKey (app/ui/handlers.go:202). This would be a sibling on the other quit path.
Opt-in semantics. A bool flag --confirm-no-annotations, env REVDIFF_CONFIRM_NO_ANNOTATIONS, config key confirm-no-annotations, off by default, set by the bundled launchers alongside --exit-code-on-annotations. The two stay independent: that one governs annotations reporting 10, this one governs the no-annotations prompt and its stopped code.
The alternative is doing this agent-side, with SKILL.md telling agents to ask whenever revdiff exits 0 with no annotations. The difference is what the outcome rests on. Resolving it in the TUI turns the reviewer's answer into an exit code: a strong signal, immediately, identical for every consumer. Agent-side it stays an instruction in a prompt, so whether the reviewer is asked at all depends on the model honoring it on that turn.
A smaller alternative
Q already means discard and quit, and already renders its own confirm when the store is non-empty. Making its exit code configurable gives an informed reviewer the same stop signal for about five lines.
finalize collapses two cases into one branch today (app/main.go:311):
if r.discarded || r.annotations == "" {
return 0, nil
}Split it so the discarded branch returns a configured code, add --discard-exit-code (int, default 0, the shape --tab-width and --compact-context already use), and Q becomes the stop signal with no new key, no new prompt, and nothing new to name.
What it does not do is close the gap that prompted this issue: q with no annotations still exits 0, so the signal reaches only a reviewer who already knows to press Q. It also ties stopping to discarding, since Q skips the history save as well (finalize returns before saveHistory; README.md:721). That is harmless on an empty store and lossy on a non-empty one, though exit 10 already covers the feedback-and-stop case.
The two compose. The flag can land on its own, and the prompt can follow if silent quits keep reading as finished reviews.
Acceptance criteria (for the prompt)
- With
--confirm-no-annotations, quitting with no annotations prompts rather than exiting. yexits 0.nexits with a code distinct from 0 and 10.escreturns to the review with no state lost.- Without it, quit behavior is unchanged.
launch-revdiff.shtreats the stopped code as a reviewer outcome, not a launcher failure. Its check allows only 0 and 10 today (.claude-plugin/skills/revdiff/scripts/launch-revdiff.sh:65), documented in the header at line 5.SKILL.mdtells agents the stopped code means do not proceed, and is not a failure to report or retry.
Considerations
- Naming is deliberate. "Finished" and "stopped" describe what revdiff can observe; it never learns whether a change is good, only whether the reviewer left feedback and how they left. "Approve" and "reject" would assert more than the tool knows, and
rejectalready means input validation across the codebase (app/compare_test.go:45,app/annotations_load.go:80,app/reviewinfo.go:70). "No annotations" is the phrase already used for this state inREADME.md:349,app/ui/output.go:34, andapp/ui/overlay/annotlist.go:68. - The prompt covers the interactive case only. It has nowhere to render under
--no-status-bar, which is whyhandleDiscardQuitbails out of its own confirm there (app/ui/handlers.go:142), and a signal-driven exit bypasses the TUI and returns 0 throughfinalize'ssignaledbranch (app/main.go:315). Both should keep exiting 0. - Size, anchored on add Q hotkey to discard annotations and quit #4, which added the
Qdiscard confirm this mirrors: 84 lines of production Go and 251 of tests. This should be similar or smaller, since it reuses that confirm pattern and adds no keymap action. Beyond Go it touches both launcher scripts,SKILL.mdand its Codex and Pi copies,references/config.md,references/usage.md, README, andsite/docs.html, on the order of 30 lines.
Activity
[-]Confirm approve or reject when a reviewer quits with no annotations[/-][+]Confirm whether a quit with no annotations means finished or stopped[/+]umputun commentedon Sep 1, 2026
not taking this one.
the report is that an agent read a clean exit as nothing to address and then committed. No bundled consumer treats a clean exit that way:
plugins/pi/skills/revdiff/SKILL.md:46,:110)plugins/opencode/plugins/revdiff-plan-review.ts:130)ask(plugins/revdiff-planning/scripts/plan-review-hook.py:247), so Claude Code presents its normal ExitPlanMode confirmation and you are still askedplugins/revdiff-planning/scripts/codex-plan-review-hook.py:242), which ends the plan turn without starting or authorizing implementation.claude-plugin/skills/revdiff/SKILL.md:215-218,plugins/codex/skills/revdiff/SKILL.md:244-249)the reported commit is not an action any bundled workflow prescribes after a clean exit. One agent going beyond that contract is not enough to justify changing the binary protocol for every bundled consumer.
the issue did expose an inaccurate contract in the bundled skill docs, and that part is worth fixing on its own. Line 73, the one you quoted, said "Done when user quits without annotations", and 228 and 232 said the review was complete. That claims more than revdiff can see, which is only that no annotations were captured. I am correcting both diff-review copies to say exactly that, to tell the agent to stop the review workflow, and to state that the result alone authorizes nothing further while prior explicit user instructions still apply. The two example endings change with them. The pi copy already worded it correctly.
on the smaller alternative, also no, and the reason is worth writing down. The Go side really is about five lines. The cost is in the consumers:
isRevdiffSuccessatplugins/pi/extensions/revdiff.ts:303,plugins/opencode/tools/revdiff.ts:60andplugins/opencode/plugins/revdiff-plan-review.ts:79, plusSUCCESS_CODESatplan-review-hook.py:45andcodex-plan-review-hook.py:19. Adding a code there as another success is not enough, because each one then collapses the stopped case into its existing empty path and you are back where you started. Each needs its own stopped branch. That is most of the integration work of the full proposal for less than it does.one note on the prompt itself if this comes back later.
[y/n]clashes with the confirm it mirrors: in the discard promptncancels and stays in the review (app/ui/handlers.go:207), in yours it exits. It would need three visible actions rather than two.docs(plugin): correct the clean-exit contract in the agent skills (#415)