Skip to content

feat(launch): add agterm overlay backend - #238

Merged
umputun merged 2 commits into
masterfrom
agterm-overlay-backend
Jun 23, 2026
Merged

umputun merged 2 commits into
masterfrom
agterm-overlay-backend

Conversation

@umputun

@umputun umputun commented Jun 23, 2026

Copy link
Copy Markdown
Owner

Adds agterm to the terminal overlay backends in launch-revdiff.sh, so a coding agent running inside an agterm session opens revdiff in a full-pane agterm overlay instead of falling through to a non-agterm backend.

How it works. When $AGTERM_SESSION_ID is set and agtermctl is on PATH, the launcher runs agtermctl session overlay open "<revdiff cmd>" --target $AGTERM_SESSION_ID --block --socket $AGTERM_SOCKET. The --block flag opens the overlay, blocks until revdiff exits, and returns revdiff's exit code directly, so unlike the kitty/zellij/herdr backends there is no sentinel file to poll. Full-pane mode is just omitting --size-percent. It is checked first in the priority chain, so an agterm session always uses its native overlay even when a multiplexer is also present.

Docs and sync. Backend table and priority updated in README.md, site/docs.html, and plugins/codex/README.md. Both launch-revdiff.sh copies (.claude-plugin and plugins/codex) stay byte-identical except the sync comment, and both pass shellcheck.

Verified by mocking agtermctl/revdiff on PATH: an agterm session builds the overlay command correctly (env prefix, --output, --target, --block, --socket), and a non-agterm session falls through unchanged.

detect $AGTERM_SESSION_ID and open revdiff in a full-pane agterm overlay via
`agtermctl session overlay open <cmd> --target <sid> --block`. agterm's --block
blocks until the overlay exits and returns revdiff's exit code, so no sentinel
poll is needed. Checked first so an agterm session always uses its native
overlay. Documented in README, site/docs.html, and the codex plugin README;
both launcher copies kept in sync.
Copilot AI review requested due to automatic review settings June 23, 2026 19:28

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

Adds agterm as the highest-priority terminal overlay backend for the revdiff launcher scripts, and updates documentation to reflect the new supported terminal and detection/priority behavior.

Changes:

  • Add an agterm backend to both launch-revdiff.sh copies, using agtermctl session overlay open … --block when $AGTERM_SESSION_ID is present.
  • Update terminal-support tables and priority order in user-facing docs (README.md, site/docs.html) and Codex plugin docs (plugins/codex/README.md).

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
plugins/codex/skills/revdiff/scripts/launch-revdiff.sh Adds agterm overlay backend (highest priority) using agtermctl and blocking execution.
.claude-plugin/skills/revdiff/scripts/launch-revdiff.sh Mirrors the agterm backend logic for the Claude Code plugin copy.
README.md Documents agterm support and updates the backend priority chain.
site/docs.html Updates the published docs HTML with agterm support and revised priority chain.
plugins/codex/README.md Updates Codex skill requirements to include agterm as a supported terminal.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread site/docs.html Outdated
<p>Priority: agterm &rarr; tmux &rarr; zellij &rarr; herdr &rarr; kitty &rarr; wezterm/kaku &rarr; cmux &rarr; ghostty &rarr; iTerm2 &rarr; Emacs vterm (first detected wins). cmux is checked before ghostty when <code>$CMUX_SURFACE_ID</code> is set, <code>__CFBundleIdentifier=com.cmuxterm.app</code>, or <code>GHOSTTY_RESOURCES_DIR</code> / <code>GHOSTTY_BIN_DIR</code> contains <code>cmux.app</code>. iTerm2 uses a split pane rather than a full-screen overlay.</p>
<p><strong>Sandbox note:</strong> Ghostty and iTerm2 launchers use <code>osascript</code> (Apple Events), which is blocked by Claude Code's sandbox. If you use these terminals with sandbox enabled, add the launcher to <code>excludedCommands</code> in your Claude Code <code>settings.json</code>:</p>
<div class="code-block"><code>{ "permissions": { "excludedCommands": ["*/launch-revdiff.sh*"] } }</code></div>
<p>Terminals that use CLI tools instead of AppleScript (tmux, Zellij, herdr, kitty, wezterm, cmux) are not affected.</p>
Comment thread README.md
| **Emacs vterm** | New frame via `emacsclient` | `$INSIDE_EMACS` env var |

Priority: tmux → Zellij → herdr → kitty → wezterm/Kaku → cmux → ghostty → iTerm2 → Emacs vterm (first detected wins). If none are available, the plugin exits with an error.
Priority: agterm → tmux → Zellij → herdr → kitty → wezterm/Kaku → cmux → ghostty → iTerm2 → Emacs vterm (first detected wins). If none are available, the plugin exits with an error.
the "not affected by osascript restrictions" note omitted agterm (added here) and Kaku (uses kaku cli, not AppleScript). Only ghostty and iTerm2 use osascript. Keeps README and site/docs.html in sync.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 23, 2026 •

Copy link
Copy Markdown

Deploying revdiff with  Cloudflare Pages  Cloudflare Pages

Latest commit: 0e44296
Status: ✅  Deploy successful!
Preview URL: https://321172a3.revdiff.pages.dev
Branch Preview URL: https://agterm-overlay-backend.revdiff.pages.dev

View logs

@umputun
umputun merged commit 1ddcce4 into master Jun 23, 2026
5 checks passed
@umputun
umputun deleted the agterm-overlay-backend branch June 23, 2026 19:52
umputun added a commit that referenced this pull request Jun 30, 2026
* fix: detect renames when the new file is untracked

a plain `mv old new` (no `git mv`/staging) left `old` as an unstaged
deletion and `new` untracked, so `git diff -M` never paired them - the
tree showed a deletion plus an all-+ add instead of one rename.

`UntrackedRenames` recovers the pairing off a throwaway index: copy
`.git/index`, `git add -N` the untracked paths against the copy via
`GIT_INDEX_FILE`, then `git diff -M` reports the rename. The real index
and working tree are never touched. `FileDiff` renders these the same
way via `untrackedRenameDiff`. Git-only (hg/jj have no untracked-rename
concept), gated to unstaged working-tree mode.

Related to #243

* fix(test): clear AGTERM env so launcher exit-code test stays hermetic

`cleanOverlayEnv` cleared every overlay-detection var except the agterm
ones. On an agterm host `AGTERM_SESSION_ID` leaked from the real
environment, so the launcher took its agterm branch (real `agtermctl
session overlay open`) instead of the fake backend under test. That path
doesn't pipe the fake revdiff's stdout/exit back, so every non-clean
case returned exit 0 / empty output, while the "clean" case passed by
coincidence. CI stayed green because CI isn't an agterm session.

now clear `AGTERM_SESSION_ID` and `AGTERM_SOCKET` too. The agterm overlay
backend (#238) added the launcher branch but left this helper out of sync.

* fix(review-loop): iteration 1 addressed 8 findings

- [major] [annotations_load.go] --annotations preload now runs the untracked-rename detector (foldUntrackedRenames) so (-)/context annotations on an untracked rename round-trip instead of being dropped as all-added
- [major] [diff.go] untracked-rename git calls use GIT_LITERAL_PATHSPECS=1 (renameIndexEnv) so a filename like ":(top)x" is treated literally, not as pathspec magic
- [minor] [diff.go] temp index path made absolute (filepath.Abs) so GIT_INDEX_FILE and cleanup agree when TMPDIR is relative
- [minor] [diff.go] UntrackedRenames returns nil on a missing .git/index (fresh repo, no commits) instead of a spurious WARN
- [over-engineering] [loaders.go] dropped the redundant renameNew map in mergeUntrackedEntries (entrySet already covers rename new-sides)
- [test-gap] [diff_test.go] added pure-rename, path-with-spaces, pathspec-magic-name, and no-commit-repo tests
- [test-gap] [annotations_load_test.go] added untracked-rename preload round-trip test
- [doc-gap] [site/docs.html] rename-detection paragraph now covers the working-tree --untracked case

CLAUDE.md gotcha updated to match.

* fix(review-loop): final cleanup pass — addressed 1 finding

- [minor] [diff.go] scope the no-index no-op to the missing-.git/index case via an errNoIndex sentinel; previously errors.Is(err, fs.ErrNotExist) wrapped the whole tempIndexWithIntentToAdd call, so an ENOENT from os.CreateTemp (missing TMPDIR) or a corrupt index was swallowed and silently disabled rename detection. other ENOENT now propagates with a warning.
- [test] [diff_test.go] added TestGit_UntrackedRenames_RealErrorNotSwallowed
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