Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

feat(plugins): render revdiff in a tmux window under agent-deck - #229

#229
Merged
umputun merged 2 commits into
umputun:masterumputun/revdiff:masterfrom
paskal:feat/agent-deck-window-backendpaskal/revdiff:feat/agent-deck-window-backendCopy head branch name to clipboard
Jun 14, 2026
Merged

feat(plugins): render revdiff in a tmux window under agent-deck#229
umputun merged 2 commits into
umputun:masterumputun/revdiff:masterfrom
paskal:feat/agent-deck-window-backendpaskal/revdiff:feat/agent-deck-window-backendCopy head branch name to clipboard

Conversation

@paskal

@paskal paskal commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

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

  • New agentdeck-window.sh, sourced by launch-revdiff.sh — it reuses the existing REVDIFF_CMD / OUTPUT_FILE / sq / write_rc_cmd / read_rc / print_output_and_exit plumbing and the sentinel/rc protocol, so the exit-code-on-annotations behaviour is preserved.
  • launch-revdiff.sh 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 — no behaviour change and no added cost for existing users.
  • Detection: AGENTDECK_INSTANCE_ID (also mirrored into the tmux session env) with the agentdeck_* session-name prefix as a fallback.
  • Window created with new-window -d so it never steals the active window.
  • Applied to both the main (.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 path
  • unset — auto: window mode only when agent-deck is detected

Testing

  • bash -n + shellcheck -x clean on all four changed files.
  • Verified end-to-end inside agent-deck: the review window opens in the background (active window not stolen), annotations are captured on close via the existing sentinel/rc flow, and exit-code-on-annotations is preserved.

How it looks like:

Screenshot 2026-06-15 at 00 02 53

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.
@paskal
paskal requested a review from umputun as a code owner June 14, 2026 23:04
Copilot AI review requested due to automatic review settings June 14, 2026 23:04

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.

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.sh backend from launch-revdiff.sh when 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
Comment on lines +51 to +55
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")"
Comment on lines +1 to +2
# 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
@paskal

paskal commented Jun 14, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the review — addressed in 1de0d10:

  1. EXIT trap from a sourced file. Good catch. Removed the trap … EXIT entirely so it can't clobber the caller's cleanup trap. The backend now cleans the sentinel explicitly on every exit path, and in the non-agent-deck case returns before any trap/sentinel work, leaving the caller's environment untouched.

  2. Unbounded busy-wait. tmux new-window failure is now handled (prints an error and exits non-zero instead of waiting on a sentinel that will never appear). The wait loop is bounded on the review window still existing — if the window disappears without writing the sentinel, we stop. A timer would be wrong here: a genuine review can legitimately take a long time, so window-existence is the correct bound.

  3. sh -c vs bash. Intentional, for consistency: the tmux popup path runs display-popup … -- sh -c "$REVDIFF_CMD", and every other backend (zellij/kitty/cmux/ghostty) runs the command through sh/#!/bin/sh. REVDIFF_CMD is built sh-compatible. Switching only this path to bash would be the divergent choice.

  4. Duplication across the two trees. Follows the existing layout — launch-revdiff.sh itself is already maintained as two separate copies (.claude-plugin/… and plugins/codex/…), so the backend matches that convention. Happy to factor both into one shared source as a follow-up if you'd prefer, but that's a repo-wide change beyond this PR.

CI is green now — the failure was plain shellcheck (no -x) not following the runtime-resolved source (SC1091); silenced with a disable=SC1091 directive on that line.

@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.

checked the update (1de0d10), all four addressed:

  • EXIT trap gone, sentinel cleaned explicitly per path, the caller's OUTPUT_FILE trap 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 -c kept, consistent with the other backends and REVDIFF_CMD is 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.

@umputun
umputun merged commit 116104a into umputun:master Jun 14, 2026
2 checks passed
@paskal
paskal deleted the feat/agent-deck-window-backend branch June 14, 2026 23:18
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.

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.