You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Scope a Wrapper's GIT_DIR to Its Own Body in the Write Guard #3309
Raised by the Copilot review on #3306, which closed #3078's wrapper half.
A Wrapper's GIT_DIR Is Applied to Every Wrapper Body in the Command
host-setup/agent-safety/claude/gh-write-guard.py carries a GIT_DIR or GIT_WORK_TREE that reaches a wrapper shell into the git commands in its body (_wrapper_dir_prefixes, _all_git_invocations). It collects those pairs from every wrapper in the command, then reads each inner invocation again under each pair, since it does not pair a body with the wrapper that runs it.
This only adds readings, so it fails closed, but it over-denies. Constructed case: GIT_WORK_TREE=/example/primary bash -c 'git status'; bash -c 'git reset --hard', run from a linked worktree. The second wrapper's reset --hard is read against /example/primary too, and rule 6 denies it, though nothing points that wrapper there.
Possible Direction
Have _wrapper_env_groups return each shell's bodies beside its assignments, and carry each pair only into the invocations read from those bodies and the bodies nested in them.
Closed as out of the write guard's scope under the maintainer's decision (ptr727, 2026-10-23) on #3391, item 1. The guard bounds a good-faith agent's mistake rather than an adversary, so a parse gap reached only by a command shape no agent plausibly types in a coding session is closed rather than fixed, and the guard's own growth is a cost each later review pays again. The scope statement lands in the guard's docstring and README under #3391. Reopen only with a command a session actually produced.
Activity
Read Config and Alias Rewrites the Write Guard Missed (#3306)
ptr727 commentedon Oct 23, 2026
Closed as out of the write guard's scope under the maintainer's decision (ptr727, 2026-10-23) on #3391, item 1. The guard bounds a good-faith agent's mistake rather than an adversary, so a parse gap reached only by a command shape no agent plausibly types in a coding session is closed rather than fixed, and the guard's own growth is a cost each later review pays again. The scope statement lands in the guard's docstring and README under #3391. Reopen only with a command a session actually produced.