fix(claude): narrow and ask before landing merges #217

Merged
claudiomaradonna merged 2 commits from fix/merge-exclusion-options into main 2026-11-11 10:41:43 +01:00
Collaborator

Why

Issue #214: the sandbox exclusion for the landing merge,
git merge --ff-only *, lets a merge with any trailing options leave
the sandbox, so the call that runs outside it can do more than a
fast-forward. No ask rule covers it either, so where a developer's own
settings allow git merge, it runs unasked. An ask rule on every
git merge was weighed and set aside, since merges inside the sandbox
already stay under the Read rules.

What changed

Only git merge --ff-only --end-of-options <rev> now leaves the
sandbox, and deliver's land.md lands in that form; after
--end-of-options git takes every argument as a revision and refuses an
option. A new ask rule, Bash(git merge --ff-only *), has the landing
merge ask first, whatever the developer's own allow rules say.

docs/SANDBOX.md and the README name the new form and say the merge
always asks, while run-sandboxed.sh still asks as the permission mode
decides. Not a breaking change: an adopted repository's land.md takes
the new form through foundry-upgrade.

How to verify

In a Claude Code session on this branch, with the sandbox on, land a
branch from the main checkout with
git merge --ff-only --end-of-options <branch>: Claude Code asks, and
the merge runs outside the sandbox. Then run
git merge --ff-only --end-of-options --no-ff <branch> in a scratch
repository: git refuses it with --no-ff - not something we can merge,
where git merge --ff-only --no-ff <branch> makes a merge commit.

The checks of docs/MAINTENANCE.md pass on the tip, and the two
extended tests of tests/agent-config/claude-settings.sh fail on
main. The bubblewrap tests and evals could not run inside Claude
Code's sandbox.

Considerations

That the ask rule prompts in bypassPermissions mode rests on the same
behaviour 0593332 states for the Edit ask rules, unconfirmed here for
a Bash rule; auto mode is confirmed. --end-of-options before
git merge's revisions was checked on git 2.53.0 only, within the
README's Git 2.48 floor.

## Why Issue #214: the sandbox exclusion for the landing merge, `git merge --ff-only *`, lets a merge with any trailing options leave the sandbox, so the call that runs outside it can do more than a fast-forward. No ask rule covers it either, so where a developer's own settings allow `git merge`, it runs unasked. An ask rule on every `git merge` was weighed and set aside, since merges inside the sandbox already stay under the `Read` rules. ## What changed Only `git merge --ff-only --end-of-options <rev>` now leaves the sandbox, and `deliver`'s `land.md` lands in that form; after `--end-of-options` git takes every argument as a revision and refuses an option. A new ask rule, `Bash(git merge --ff-only *)`, has the landing merge ask first, whatever the developer's own allow rules say. `docs/SANDBOX.md` and the README name the new form and say the merge always asks, while `run-sandboxed.sh` still asks as the permission mode decides. Not a breaking change: an adopted repository's `land.md` takes the new form through `foundry-upgrade`. ## How to verify In a Claude Code session on this branch, with the sandbox on, land a branch from the main checkout with `git merge --ff-only --end-of-options <branch>`: Claude Code asks, and the merge runs outside the sandbox. Then run `git merge --ff-only --end-of-options --no-ff <branch>` in a scratch repository: git refuses it with `--no-ff - not something we can merge`, where `git merge --ff-only --no-ff <branch>` makes a merge commit. The checks of `docs/MAINTENANCE.md` pass on the tip, and the two extended tests of `tests/agent-config/claude-settings.sh` fail on `main`. The bubblewrap tests and evals could not run inside Claude Code's sandbox. ## Considerations That the ask rule prompts in `bypassPermissions` mode rests on the same behaviour 0593332 states for the `Edit` ask rules, unconfirmed here for a `Bash` rule; auto mode is confirmed. `--end-of-options` before `git merge`'s revisions was checked on git 2.53.0 only, within the README's Git 2.48 floor.
The sandbox now lets only `git merge --ff-only --end-of-options <rev>`
out, where git takes every later argument as a revision, so the call
that leaves it can do nothing but a fast-forward. An explicit ask rule
on `git merge --ff-only` prompts in every mode, also where a developer's
own settings allow the merge, since what it lands is what the clients
load next.

Refs #214
docs: say the landing merge always asks
All checks were successful
Maintenance / checks (pull_request) Successful in 4m27s
Maintenance / checks (push) Successful in 4m0s
8ad02830c5
Refs #214
claudiomaradonna deleted branch fix/merge-exclusion-options 2026-11-11 10:41:47 +01:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
claudiomaradonna/agent-foundry!217
No description provided.