feat(plugins): render revdiff in a tmux window under agent-deck - #229
#229feat(plugins): render revdiff in a tmux window under agent-deck#229umputun merged 2 commits intoumputun:masterumputun/revdiff:masterfrom paskal:feat/agent-deck-window-backendpaskal/revdiff:feat/agent-deck-window-backendCopy head branch name to clipboard
Conversation
agent-deck (github.com/asheshgoplani/agent-deck) shows each session through a tmux control-mode client, which does not render `tmux display-popup` at all: the popup is invisible and `display-popup -E` blocks forever, so a review can never be completed. agent-deck does surface real tmux windows. Add a sourced backend (agentdeck-window.sh) that, when agent-deck is detected (AGENTDECK_INSTANCE_ID / tmux session env / agentdeck_* session name), runs revdiff in a background tmux window (new-window -d) named after the content under review, then blocks on the usual sentinel/rc protocol. The launcher gains only a 4-line guarded source hook before the tmux popup path; every non-agent-deck tmux returns immediately and uses the popup unchanged. Opt in/out with REVDIFF_TMUX_WINDOW=1/0. Applied to both the main and codex plugin script sets.
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds an agent-deck-compatible tmux “window mode” for revdiff so reviews remain visible when tmux display-popup cannot be rendered (tmux control-mode clients).
Changes:
- Source a new
agentdeck-window.shbackend fromlaunch-revdiff.shwhen running under tmux. - Introduce an agent-deck detection + fallback implementation that launches revdiff in a background tmux window and waits for completion via a sentinel file.
- Mirror the same behavior in both
plugins/codex/...and.claude-plugin/...script trees.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| plugins/codex/skills/revdiff/scripts/launch-revdiff.sh | Sources an agent-deck backend before the popup path to avoid invisible popups in control-mode. |
| plugins/codex/skills/revdiff/scripts/agentdeck-window.sh | Implements window-mode execution + completion signaling for agent-deck tmux sessions. |
| .claude-plugin/skills/revdiff/scripts/launch-revdiff.sh | Same as above for the .claude-plugin distribution tree. |
| .claude-plugin/skills/revdiff/scripts/agentdeck-window.sh | Same as above for the .claude-plugin distribution tree. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| SENTINEL=$(mktemp "$TMPBASE/revdiff-done-XXXXXX") | ||
| rm -f "$SENTINEL" | ||
| trap 'rm -f "$OUTPUT_FILE" "$SENTINEL" "$SENTINEL.tmp"' EXIT |
| tmux new-window -d -c "$CWD" -n "$_rd_winname" -- sh -c "$(write_rc_cmd "$SENTINEL")" | ||
|
|
||
| while [ ! -f "$SENTINEL" ]; do | ||
| sleep 0.3 | ||
| done |
|
|
||
| # -d: create the window in the BACKGROUND so it does not steal the active window — it waits in | ||
| # the agent-deck tree until the user switches to it. -c: start directory. | ||
| tmux new-window -d -c "$CWD" -n "$_rd_winname" -- sh -c "$(write_rc_cmd "$SENTINEL")" |
| # shellcheck shell=bash | ||
| # revdiff — agent-deck backend. SOURCED by launch-revdiff.sh (never run standalone). |
- silence SC1091 on the runtime source line (CI runs plain shellcheck without -x) - agentdeck-window.sh: do not install an EXIT trap from a sourced file (it would clobber the caller's cleanup trap); clean up explicitly at each exit path and only ever return (pre-trap) or exit - bound the wait on the review window still existing and fail loudly if 'tmux new-window' fails, instead of busy-waiting forever on a sentinel that will never appear
|
Thanks for the review — addressed in 1de0d10:
CI is green now — the failure was plain |
umputun
left a comment
There was a problem hiding this comment.
checked the update (1de0d10), all four addressed:
- EXIT trap gone, sentinel cleaned explicitly per path, the caller's
OUTPUT_FILEtrap stays in force. - new-window failure exits 1 instead of hanging, and the wait loop also breaks if the window vanishes without a sentinel - covers more than the popup backends do.
sh -ckept, consistent with the other backends andREVDIFF_CMDis sh-compatible.- SC1091 silenced on the source line, CI green.
one cosmetic nit, non-blocking: the codex agentdeck-window.sh doesn't carry the # source: header the other codex script copies have. The two copies are byte-identical otherwise.
lgtm.
What
Under agent-deck, revdiff's review overlay never appears if I'm in another session when revdiff is spawned.
agent-deck does surface real tmux windows. This PR adds a small backend that, when agent-deck is detected, runs revdiff in a background tmux window (named after the content under review) instead of a popup. It shows up in the agent-deck session tree for the user to switch to, and never pops over whatever other session they're working in.
How
agentdeck-window.sh, sourced bylaunch-revdiff.sh— it reuses the existingREVDIFF_CMD/OUTPUT_FILE/sq/write_rc_cmd/read_rc/print_output_and_exitplumbing and the sentinel/rc protocol, so the exit-code-on-annotations behaviour is preserved.launch-revdiff.shgains only a 4-line guardedsourcehook before the tmux popup path. Every non-agent-deck tmux returns immediately and uses the popup unchanged — no behaviour change and no added cost for existing users.AGENTDECK_INSTANCE_ID(also mirrored into the tmux session env) with theagentdeck_*session-name prefix as a fallback.new-window -dso it never steals the active window..claude-plugin/…) and codex (plugins/codex/…) plugin script sets.Opt in / out
REVDIFF_TMUX_WINDOW=1— force window mode (any tmux)REVDIFF_TMUX_WINDOW=0— force the popup pathTesting
bash -n+shellcheck -xclean on all four changed files.How it looks like: