Skip to content

Optional pane-scoped agterm overlay via REVDIFF_AGTERM_PANE - #303

Merged
umputun merged 3 commits into
masterfrom
agterm-pane-overlay
Aug 4, 2026
Merged

umputun merged 3 commits into
masterfrom
agterm-pane-overlay

Conversation

@umputun

@umputun umputun commented Aug 4, 2026

Copy link
Copy Markdown
Owner

agterm's overlay open now takes --pane left|right, which scopes an overlay to one split pane and leaves the sibling live and visible. The revdiff launcher always opened a session-wide overlay, so in a split the review covered the other pane's work.

REVDIFF_AGTERM_PANE=1 opts into the pane-scoped form. Off by default, and unset leaves the agterm branch's call exactly as it was.

the gate needs all four of:

  • REVDIFF_AGTERM_PANE=1
  • $AGTERM_PANE being left or right (scratch is full-coverage, no sibling to spare)
  • a --pane-capable agtermctl, probed via overlay open --help (the flag postdates agterm v0.9.0)
  • a split confirmed by agterm_session_split, a window-scoped tree --json read parsed with jq

The tree read is window-scoped because tree defaults to the frontmost window, which is not the agent's when the user is looking elsewhere. Without jq it reports "not split" and the session-wide overlay stands.

fallback: the --help probe reads the PATH agtermctl, which is not always the CLI of the running app. So on a nonzero exit whose agtermctl stderr says pane overlay already open or pane not visible, the launcher retries session-wide. Nothing is executed twice, the refusal came before revdiff ran, and the grep is gated on agterm's own message precisely so a revdiff failure never triggers a second review.

agtermctl's stderr is captured apart from revdiff's (which goes to $ERR_FILE) and replayed either way. Its stdout is dropped, print_output_and_exit owns the launcher's stdout and that carries annotations alone.

known limitation, documented beside the gate: $AGTERM_PANE is baked into the shell environ at spawn, so a pane agterm promoted into the main slot keeps right. Promote then re-split scopes the overlay to the new sibling instead of this pane, and the fallback cannot catch it because that pane genuinely exists. session status takes a stable --pane-id token for exactly this, overlay open does not yet. Failing closed to the session-wide overlay is not the answer, that drops the feature for everyone to avoid a rare misplaced surface the user can see and close.

No tint on the pane overlay: revdiff paints its own full TUI, so it never reads as the shell it covered.

TestAgtermPaneOverlayOptIn covers the gate, the fallback and the default path across both launcher copies. The fake agtermctl fixture grew a --help probe, a tree --json reply and a refusal mode. Docs updated in README, site/docs.html, both config.md, usage.md, both SKILL.md and CLAUDE.md.

umputun added 2 commits August 4, 2026 03:59
REVDIFF_AGTERM_PANE=1 makes launch-revdiff.sh open the review with
`agtermctl session overlay open --pane $AGTERM_PANE`, covering the agent's
own split pane instead of the whole session so the sibling pane stays live
and visible.

Opt-in and off by default: it needs the env var, a left/right pane role, a
--pane-capable agtermctl (probed via --help, since the flag postdates agterm
v0.9.0), and a split confirmed by a window-scoped `tree --json` read. When
agterm refuses the pane the launcher retries session-wide, so a version-skewed
CLI or a split that disappeared never costs the review.
…ate count

A pane agterm promoted into the main slot keeps its baked AGTERM_PANE=right,
so promote-then-re-split scopes the overlay to the new sibling rather than the
agent's own pane. agterm raises no error there — the pane exists — so the
session-wide fallback cannot catch it, and `overlay open` has no --pane-id
token to resolve the live role against. Documented beside the gate rather than
failing closed, which would drop the feature for everyone.

Also corrects the CLAUDE.md bullet, which enumerated three gate conditions
where the code has four (the --pane capability probe was left out of the list).
Copilot AI lite review requested due to automatic review settings August 4, 2026 16:47

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Not ready to approve

The new test currently skips entirely when jq isn’t installed, which can silently eliminate coverage of the new pane-overlay behavior in common CI/dev environments.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.

Pull request overview

Adds an opt-in launcher feature to scope agterm overlays to the agent’s split pane (instead of the entire session) via REVDIFF_AGTERM_PANE=1, keeping the sibling pane visible while reviewing diffs.

Changes:

  • Implement REVDIFF_AGTERM_PANE gating + refusal fallback (--pane left|right when supported, split is confirmed, and pane is valid) in both launcher script copies.
  • Extend the fake agtermctl backend fixture and add a Go test to cover opt-in, default behavior, no-split behavior, older CLI behavior, and refusal fallback.
  • Document the new launcher environment variable across README/site/plugin reference docs and skill docs.
File summaries
File Description
site/docs.html Documents the new agterm pane-scoped overlay opt-in in the terminal support section.
README.md Adds a user-facing note describing REVDIFF_AGTERM_PANE=1 and its behavior/tradeoffs.
plugins/codex/skills/revdiff/SKILL.md Updates the Codex skill guidance to mention the opt-in environment variable.
plugins/codex/skills/revdiff/scripts/launch-revdiff.sh Adds pane-support probing, split detection, pane-scoped overlay invocation, and a session-wide retry on specific refusals.
plugins/codex/skills/revdiff/references/config.md Adds reference documentation for REVDIFF_AGTERM_PANE.
CLAUDE.md Captures the design notes/constraints for the pane-scoped overlay behavior and fallback.
app/testdata/plugin-exit-code/fake-overlay-backend.sh Extends the fake agtermctl to support --help probing, split reporting (tree --json), refusal mode, and arg capture.
app/plugin_exit_code_test.go Adds TestAgtermPaneOverlayOptIn and clears additional env vars in cleanOverlayEnv.
.claude-plugin/skills/revdiff/SKILL.md Updates the Claude skill guidance to mention the opt-in environment variable.
.claude-plugin/skills/revdiff/scripts/launch-revdiff.sh Mirrors the launcher changes for pane-scoped overlays and refusal fallback.
.claude-plugin/skills/revdiff/references/usage.md Adds usage documentation for REVDIFF_AGTERM_PANE.
.claude-plugin/skills/revdiff/references/config.md Adds config/reference documentation for REVDIFF_AGTERM_PANE.
Review details
  • Files reviewed: 12/12 changed files
  • Comments generated: 1
  • Review effort level: Lite

We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.

Comment on lines +184 to +186
if _, err := exec.LookPath("jq"); err != nil {
t.Skip("the launcher's split check needs jq")
}
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 4, 2026 •

Copy link
Copy Markdown

Deploying revdiff with  Cloudflare Pages  Cloudflare Pages

Latest commit: 889c21e
Status: ✅  Deploy successful!
Preview URL: https://195f777c.revdiff.pages.dev
Branch Preview URL: https://agterm-pane-overlay.revdiff.pages.dev

View logs

@umputun
umputun merged commit cafa44f into master Aug 4, 2026
5 checks passed
@umputun
umputun deleted the agterm-pane-overlay branch August 4, 2026 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants