Skip to content

Account for env -C and env --chdir Before Resolving GIT_DIR in the Write Guard #3716

Closed

Description

@ptr727

Raised by the review of promotion #3715 on the change #3709 made, as a P1 thread.

_launch in host-setup/agent-safety/claude/gh-write-guard.py strips env -C <dir> and env --chdir=<dir> from a command without changing the directory the command runs in. Requirement 4 then resolves a relative GIT_DIR, and the remote, from the caller's repository. Constructed shape:

env --chdir=/srv/other GIT_DIR=.git git push origin main

git runs in /srv/other and pushes that repository's origin, while the guard checks the working directory's. The fix is to carry the launcher's directory into the command model, or to read the shape as an undetermined repository, which blocks main, master and develop.

Backlog burndown claim. Branch: feature/burndown-guard-env-chdir. Predicted file set: host-setup/agent-safety/claude/gh-write-guard.py, host-setup/agent-safety/README.md.

Activity

  1. ptr727 commented on Oct 31, 2026

    @ptr727
    OwnerAuthor

    Claim released: feature/burndown-guard-env-chdir merged to develop as #3722 and its branch and worktree are cleaned up. Follow-ups: #3720, #3723. It joins promotion #3715, which closes this issue when it merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions