Skip to content

feat(planning): honor REVDIFF_TMUX_WINDOW in the plan-review launcher - #421

Merged
umputun merged 2 commits into
umputun:masterfrom
omarkhan:planning-tmux-window
Nov 3, 2026
Merged

umputun merged 2 commits into
umputun:masterfrom
omarkhan:planning-tmux-window

Conversation

@omarkhan

@omarkhan omarkhan commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

I use both the revdiff and revdiff-planning plugins in Claude Code inside tmux. The new REVDIFF_TMUX_WINDOW environment variable (added in #262) is very helpful: I can start a revdiff session, detach from the tmux session, then resume later.

REVDIFF_TMUX_WINDOW doesn't work for the revdiff-planning plugin however, which continues to use display-popup. This pull request extends the tmux window functionality added in #262 to revdiff-planning.

Claude-generated PR description follows:

Summary

REVDIFF_TMUX_WINDOW=1 (added in #262 for the diff-review launcher) now applies to the revdiff-planning launcher too. Under tmux, launch-plan-review.sh opens the plan review in a server-owned tmux window instead of a display-popup:

  • the window opens focused, and the previously active window is restored when the review ends
  • the review survives a client disconnect (SSH drop / VPN expiry)
  • revdiff's exit code comes back through a sentinel file; the wait is bounded on the window still existing, so a killed window ends the hook instead of hanging it

Why inline instead of sourcing agentdeck-window.sh

The planning plugin installs standalone and can't reach the diff-review plugin's scripts, so sharing would need a third copy of the file plus the helpers it expects from its caller. A user-layer override in ${CLAUDE_PLUGIN_DATA}/scripts/ would also not find a sibling script and would silently fall back to the popup. The inline branch matches how this launcher already duplicates each backend's tail.

Tests

  • TestPlanLauncherTmuxWindowOptIn: window mode with annotations / clean / failure exits (tmux call order, exit code, output, no leaked sentinel), plus 0 and unset falling back to display-popup. Fails against the launcher without this change.
  • The fake tmux learns new-window, select-window, display-message and list-windows; the existing popup path is unchanged (TestShellLaunchersPreserveAnnotationExitCode passes).
  • /bin/bash -n and shellcheck clean.

🤖 Generated with Claude Code

@omarkhan
omarkhan marked this pull request as ready for review October 28, 2026 20:50
@omarkhan
omarkhan requested a review from umputun as a code owner October 28, 2026 20:50

@umputun umputun left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

one blocker and a rebase before this can go in.

  • plugins/revdiff-planning/scripts/launch-plan-review.sh:131 - tmux expands new-window -n as a format, so a plan file named p#(touch pwned).md runs touch pwned when the window opens. Master escapes this for the popup title in the same file and for the diff launcher's window name (6bdab2b), so after a rebase this would be the only unescaped one. Fix: -n "${OVERLAY_TITLE//\#/##}", plus a plan review window row in TestTmuxTitlesEscapeFormatChars with REVDIFF_TMUX_WINDOW=1.
  • plugins/revdiff-planning/scripts/launch-plan-review.sh:129-130 - the comment says -d plus select-window keeps -P printing the window id, but -P prints it either way. Fix: give the real reason (it matches the diff-review backend), or drop -d and the extra select-window.

the rebase conflicts in app/revdiff/testdata/plugin-exit-code/fake-overlay-backend.sh. Keep master's FAKE_TMUX_TITLE_FILE loop ahead of your new case dispatch, otherwise the new test row records nothing.

omarkhan and others added 2 commits November 3, 2026 10:37
With REVDIFF_TMUX_WINDOW=1 under tmux, launch-plan-review.sh opens the
review in a server-owned tmux window instead of a display-popup, matching
the diff-review launcher's opt-in: the window opens focused, the prior
active window is restored on exit, and the review survives a client
disconnect. Any other value keeps the popup; there is no agent-deck
auto-detection in the planning launcher.

The branch is inlined rather than sourcing agentdeck-window.sh: the
planning plugin installs standalone and a user-layer launcher override
would not find a sibling script.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
tmux expands new-window -n as a format, so a plan file named
p#(touch pwned).md ran a command when the review window opened. Escape
it with ##, matching the popup title and the diff launcher's window name.

Drop -d and the follow-up select-window: -P prints the window id with or
without -d, so the pair only made the new window active in two steps.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@omarkhan
omarkhan force-pushed the planning-tmux-window branch from 67b22a2 to 30dc446 Compare November 3, 2026 16:42
@omarkhan

omarkhan commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for your review @umputun! I rebased and addressed your feedback in 30dc446.

@umputun umputun left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

lgtm

@umputun
umputun merged commit 0b56541 into umputun:master Nov 3, 2026
3 checks passed
umputun added a commit that referenced this pull request Nov 3, 2026
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