Repository navigation
fix(source-control): route worktree create and remove through native tools under the sandbox - #18290
Conversation
…tools under the sandbox The sandbox refuses Bash git worktree add and remove, and a commit run from the main checkout into a worktree. In a sandboxed session inside a git repository, the worktree skill now creates with EnterWorktree(name:) and removes that worktree with ExitWorktree(action: "remove"), passing discard_changes when it holds commits. Outside a repository it stops instead of falling back to Bash. Unsandboxed sessions keep the helper route. Refs: #17901 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Move the sandbox exception into the new section as an explicit override instead of rewording the create invariants, Routing and Mutation gate lines, so the change adds text only. Point at the sandboxing page to tell whether commands run sandboxed, order the sandboxed removal as the read-only guards, down, then ExitWorktree (whose hook reaps), and say what happens with no hook and when the offered push fails. Refs: #17901 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7eb4ae89a7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
claude-security-review reviewed Security review (incremental, blocking only): no security issues foundThis review covers only what changed since
All three changes are instruction text. No code, hooks, manifests, workflows or trust controls change, and none of the files matches a trusted-path glob. Because this lane already reviewed an earlier head, the review was blocking only. Instruction-surface lens. I checked each rule the push narrowed or reworded by what breaks when it is gone:
PR context and settled threads. I found no embedded directives aimed at the review. Owner threat model. This push touches no friction hold. Spend: none beyond this review run. critical-findings: 0 |
|
claude-review reviewed Code review: PR #18290, incremental (7eb4ae8..543352f)No blocking findings in this push. This lane already reviewed an earlier head, so this review covered blocking findings only and dropped advisory ones. This push changes three files:
I read every hunk of all three in the incremental diff. Both earlier findings are fixed.
Other checks.
Closing issue #17901.
Housekeeping.
Verifier dropped 0 of 0 candidates. |
…andbox worktree route Native create states its fresh base and stops when worktree.baseRef is head; upstream behavior moves to section links; sandboxed cleanup skips the stale proof for the session's own claim. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Closes #17901
Summary
The sandbox refuses the worktree skill's Bash
git worktree addandgit worktree remove, and a commit run from the main checkout into a worktree (probe, Claude Code 2.1.330). The skill now states a route for sandboxed sessions.Fix
## Sandboxed sessionssection inplugins/source-control/skills/worktree/SKILL.md, the route the owner chose: inside a git repository,createusesEnterWorktree(name:)and removal of that worktree usesExitWorktree(action: "remove"), withdiscard_changes: truewhen it holds commits. Outside a git repository the tools fail, so the skill reports that and stops instead of falling back to Bashgit worktree. Unsandboxed sessions keep the helper andEnterWorktree(path:)route.WorktreeCreatehook runs outside the sandbox and places the worktree at the external root through the shared helper; with that hook not running, Claude Code uses<repo>/.claude/worktrees/. Removal runs the read-only stranded-work and carried-file guards, thendown, thenExitWorktree, whoseWorktreeRemovehook reaps install records and keeps the branch. Other cleanup candidates are reported for an unsandboxed session.context/create.mdandcontext/cleanup.mdStep 4a.docs/review/evals.md.Verification
scripts/check-as-of-recheck.sh --check: pass.scripts/check-changed-links-online.sh origin/main: 5 changed external links resolve.scripts/check-skill-portability.sh origin/main,scripts/check-purged-em-dashes.sh: pass.skills/worktree/nesting-invariant-ssot.test.sh: 22 cases, 0 failures.scripts/check-affected.sh --base origin/main: 22 passed, 2 skipped.Related
EnterWorktree/ExitWorktree.🤖 Generated with Claude Code