Skip to content

fix(plugin): fall back to substitution-free launch when sandbox blocks osascript - #373

Merged
umputun merged 3 commits into
umputun:masterfrom
omarkhan:omar/fix-sandbox
Oct 21, 2026
Merged

umputun merged 3 commits into
umputun:masterfrom
omarkhan:omar/fix-sandbox

Conversation

@omarkhan

@omarkhan omarkhan commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

What is the problem?

Claude Code's sandbox no longer honors excludedCommands for commands containing a $(...) substitution, so the documented */launch-revdiff.sh* exclusion doesn't work anymore. Ghostty/iTerm2 launches fail inside the sandbox, even with the exclusion.

How does this solve it?

This updates the skill to switch to a two-call form when a launch fails with an osascript error: run resolve-launcher.sh on its own, then run the printed launcher path literally, which the existing exclusion matches.

…s osascript

Claude Code's sandbox doesn't honor `excludedCommands` for commands
containing a `$( )` substitution, so the documented
`*/launch-revdiff.sh*` exclusion no longer matches the skill's one-call
resolver+launcher invocation. Ghostty/iTerm2 launches fail inside the
sandbox, even with the exclusion.

This updates the skill to switch to a two-call form when a launch fails
with an osascript error: run resolve-launcher.sh on its own, then run
the printed launcher path literally, which the existing exclusion
matches.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@omarkhan
omarkhan requested a review from umputun as a code owner October 6, 2026 17:45
@omarkhan

omarkhan commented Oct 6, 2026

Copy link
Copy Markdown
Contributor Author

Also: thank you for all your hard work on this project. I love revdiff - it has become a major part of my workflow ❤️

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

the problem is real and the two-call form fixes the plain launch. A few wording changes before merge, all in .claude-plugin/skills/revdiff/SKILL.md:

  • :143,155 - an osascript failure is treated as proof of a sandbox block, but the launcher exits 1 the same way on Ghostty older than 1.3.0, a denied Automation permission, or iTerm2 "session not found", and the user is then told to edit sandbox settings that can't help. Fix: say the sandbox may be the cause when it is enabled, retry once by literal path, and on a second failure report stderr and suggest the exclusion only when the sandbox is on. Pls name the key there as sandbox.excludedCommands.
  • :139 - still says the resolver and launcher MUST run in the same bash invocation, four lines above the two-call instruction. Fix: state the fallback as the one exception.
  • :143 - "the sandbox blocks all commands with $( ) substitutions" is wrong, they run and stay sandboxed. Fix: "a call containing a $( ) substitution always stays sandboxed, so the exclusion can't apply to it".
  • :64 - the piped retry stays sandboxed too: every command in a call has to match the exclusion and gh pr diff doesn't. Fix: drop this line.
  • :150-153 - the path in step 2 is unquoted, unlike lines 136 and 147, so a path with a space fails. Fix: quote it.

what Claude Code version are you on? Pls paste the output of the quoted literal-path launch passing with the exclusion configured, I have nothing newer than #102 showing that pattern matches.

Since Claude Code 2.1.277 a sandbox exclusion applies only when every part of a command matches, so the "$(resolve-launcher.sh ...)" launch line and diffs piped into the launcher stay sandboxed, breaking Ghostty and iTerm2 even with the documented */launch-revdiff.sh* exclusion.

Resolve the launcher separately and run its printed path as a plain command. The launcher-only --stdin-file option lets diff reviews use the same plain-command form.
@umputun
umputun merged commit d0f049f into umputun:master Oct 21, 2026
3 checks passed
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