Repository navigation
Relay revdiff's stderr when an overlay review fails - #292
Conversation
95794c8 to
6807d5f
Compare
A fast-failing revdiff — a bad ref, or a flag an older installed binary
does not recognise — closes the overlay before anyone can read the error.
The caller gets a bare nonzero exit and an AI agent driving the launcher
has to guess which argument was at fault.
Capture at one chokepoint: every backend runs the REVDIFF_CMD string, so
appending 2>$ERR_FILE once after the argument loop covers all of them —
including the sourced agent-deck window path — with no per-backend edits.
Replay at the other: print_output_and_exit emits the file on any exit code
outside {0, 10}. Those two are successes and revdiff writes ordinary
warnings to stderr, so relaying them would put noise on every successful
review.
6807d5f to
81ddb9c
Compare
umputun
left a comment
There was a problem hiding this comment.
two things before this goes in.
app/plugin_exit_code_test.go:165 - the new sweep is a second full launcher x backend pass, and it puts the app package over the -timeout=60s in Makefile:29. make race panics with test timed out after 1m0s inside TestShellLaunchersRelayOverlayStderr, 60.8s here against a 53.9s baseline with the test skipped. CI doesn't set that timeout so it stays green, only the local target breaks. Fix: fold the stderr expectations into TestShellLaunchersPreserveAnnotationExitCode, which already walks the same matrix with the same fakeLauncherEnv. wantStderr has to be gated per launcher since launch-plan-review.sh has no relay. Anything that keeps ./app under 60s works.
.claude-plugin/skills/revdiff/references/install.md:67 - the custom-launcher contract still lists only the three obligations and says nothing about the relay, while both SKILL.md edits now tell the agent the failure text will be there. An override built to the documented contract relays nothing, and one that adds a branch with its own EXIT trap leaks a revdiff-err-* per run. The same sentence was updated in 29d16c3, the PR that introduced the exit-10 contract. Fix: add the relay clause to the obligations sentence. Claude copy only, the codex references/install.md has no override section.
on the 0/10 exclusion you flagged for argument: it holds. I checked every backend and none inherited the launcher's stderr before this change, so the warnings now discarded on success were not reaching anyone to begin with.
A separate launcher-by-backend pass for the stderr relay doubled the matrix and pushed the app package past the 60s timeout in make race. The exit-code test already walks the same matrix with the same fake launcher environment, so the stderr expectations ride along there, gated per launcher because the plan-review launcher has no relay. Also document the relay in the custom-launcher contract: an override built to the previous three obligations relays nothing, while the skill now tells agents the failure text will be present.
|
Both fixed in 5568fad. Test timeout. Folded into That puts the launcher subprocess count back at the pre-PR matrix: 165 invocations before the fold (3x11x3 + 2x11x3), 99 after. I can't demonstrate the 60s target directly — this machine runs about 1.3x slower than yours, and Guard strength is unchanged. Running the folded test against Custom-launcher contract. Added the relay clause to the obligations sentence plus a line about naming the capture file in any added On stderr inheritance: you're right and I've reworded the PR body. I checked what my earlier "direct backends leaked it through" note actually measured, and it was the fixture, not the real path — |
When revdiff fails fast inside a terminal overlay — a bad ref, or a flag an older installed binary does not recognise — the overlay closes before anyone can read the error. The caller gets a bare nonzero exit with no explanation, and an AI agent driving the launcher has nothing to report but "it failed", so it guesses which argument was at fault.
This was built as part of #263 and does not depend on that PR's tmux-backend question, so it lands here on its own.
Why this shape
Not a cherry-pick of #263's version. That one hung the capture off each backend's sentinel file, which silently excludes the backends that have no sentinel. Capturing into one file named up front needs no sentinel and covers everything, because every backend already funnels through the same two points: they all run the assembled command string, and they all exit through the same function. One redirect and one replay block, no per-backend edits.
Relaying only on failure is the part worth arguing about. Exit
0is a clean quit and10means annotations were captured. Both are successes, and revdiff writes ordinary warnings to stderr — a deprecated keymap alias, for instance. A relay that fired on those would print stderr on nearly every successful review, which is a worse problem than the one being fixed. Hence the two negative tests.Confidence
Running the stderr expectations against the pre-change launcher fails on every sentinel backend: the error text was lost entirely, which is the failure mode the two-point design fixes.
Also checked by hand in a real tmux session, popup and window mode: a bogus flag now surfaces revdiff's own message instead of a bare
1, and neither a clean quit nor an annotated review puts anything on stderr.One backend is worth flagging for review: the sourced agent-deck window path is the only one absent from the test harness, so it is verified by hand rather than by test. It needed no code of its own.
One deliberate behaviour change
Warnings that previously painted into the overlay are now discarded on a successful review. No backend passed revdiff's stderr back to the caller, so nothing an agent could read is lost — but the text did land on the popup's own screen, interleaved with the TUI and corrupting the render. Capturing it is the better trade, and it does mean a warning like a theme failing to persist now leaves no trace at all. Flagging it rather than hiding it in the diff.
Out of scope
The planning launcher has the same blind spot but no shared helpers to hook into — fixing it properly means extracting those first, so it is left for a follow-up. No version bumps.