Skip to content

gh-write-guard Rule 6 Blocks the Operational Workflow's Commit on develop in the Live Checkout #3200

Closed

Description

@ptr727

Problem

gh-write-guard rule 6 denies add, commit, push and the other mutating git subcommands in any primary checkout, with no exemption for a repository on the operational workflow model. The comment above the deny set states the premise: "no documented fleet workflow ever pushes from a primary checkout: every push runs from a task's own worktree instead."

That premise does not hold for an operational repository whose primary checkout is the live service directory. GOVERNANCE.md "Operational Repositories" says commits go directly to develop, and a carried OPERATIONS.md such as HomeAssistant-Config's says "Commit and push from develop in place." In that repository the live directory is the primary checkout, it sits on develop, and the service itself writes into it. A change made through the Home Assistant MCP server, for example an automation update, lands as an uncommitted modification in the primary checkout, because that is the file the running service reads.

What an agent can and cannot do today

  1. Replicate the change in a task worktree, commit and push it, and merge it. That works.
  2. Bring the live checkout back in line with develop. That step cannot be done by an agent. merge --ff-only is exempt, but git refuses the fast-forward while the same file is modified in the working tree, even when the content is identical to the incoming commit. The two commands that clear the way, git add <file> and git checkout -- <file>, are both denied by rule 6.

So every MCP-driven change to an operational repository ends with a manual step handed to the maintainer, and the documented "commit in place on develop" path is not available to an agent at all.

Reproduction (constructed)

# Primary checkout on develop, the service has modified a tracked file in place.
cd /srv/live-config                       # primary checkout, branch develop
echo "x: 1" >> automations.yaml           # stands in for a write made through the service API
git add automations.yaml                  # denied by gh-write-guard rule 6
git commit -m "Record live change"        # denied by gh-write-guard rule 6

Expected

An agent on an operational repository can carry out the workflow the carried rules document, either by committing on develop in the primary checkout or by an exempt path that reconciles a live checkout with develop once the change has landed there. Which of the two is the right fix is a design question for the hub. The only override today, GH_WRITE_GUARD_ALLOW_PRIMARY_CHECKOUT, is all or nothing for the session, which is wider than this case needs.

Context

Found in a HomeAssistant-Config session on 2026-10-18. The maintainer confirmed that direct commits to develop are standard for operational repositories and that the guard blocking them is a defect.

Activity

  1. ptr727 commented on Oct 24, 2026

    @ptr727
    OwnerAuthor

    Closed as resolved by the write guard rewrite (#3407, on main through promotion #3417). The command shape this issue records is one of the source-tagged cases in the rewritten guard's self-test corpus, so the shape is read the way the issue asks, and the corpus case is what keeps it so. Reopen with the command if a session still hits it.

  2. reopened this on Nov 5, 2026
  3. ptr727 commented on Nov 5, 2026

    @ptr727
    OwnerAuthor

    Reopening per the closing comment's instruction, because a HomeAssistant-Config session hit this again on 2026-11-05, on a guard that is byte-identical to hub main at that date.

    What still happens

    The rewrite (#3407) did not change the outcome this issue asks about. In host-setup/agent-safety/claude/gh-write-guard.py on main, add and commit are still in _ALWAYS_DENY_SUBS, and the self-test corpus pins the exact command from this issue as an expected denial, sourced to this issue:

    ("git add automations.yaml", _PRIMARY, {}, "deny", "3200"),

    So the corpus case keeps the defect in place rather than guarding its fix. The reconcile path the issue describes is still closed:

    1. A change made through the Home Assistant MCP server lands as an uncommitted modification in the live checkout, which is the primary checkout on develop.
    2. The agent replicates the change in a task worktree, commits, and pushes develop. That works.
    3. git merge --ff-only origin/develop in the live checkout is exempt, but git refuses the fast-forward while the same tracked file is modified in the working tree, even with identical content.
    4. The two commands that clear the way, git add <file> and git checkout -- <file>, are both denied by rule 6. The second would also briefly revert the file the running service reads.

    Every MCP-driven change therefore still ends with a manual step handed to the maintainer.

    Reproduction (constructed)

    cd /srv/live-config                      # primary checkout, operational repo, branch develop
    echo "x: 1" >> automations.yaml          # stands in for a write made through the service API
    # the same change is committed to origin/develop from a task worktree
    git add automations.yaml                 # denied, rule 6
    git merge --ff-only origin/develop       # allowed, but git refuses: local changes would be overwritten

    Interim

    The maintainer has opted this one repository's sessions into GH_WRITE_GUARD_ALLOW_PRIMARY_CHECKOUT=1 through a git-ignored project-local Claude Code settings file. That override is all or nothing for the session. It also lifts the guard on reset --hard, stash, clean -f and the other rule-6 commands, in any primary checkout the session touches, so it is wider than this case needs.

    Ask

    A narrow exemption in place of the session-wide override. Two shapes would close it:

    • For a primary checkout whose repository is on the operational workflow model and is on develop, allow add and commit of tracked paths and a push of develop, while reset, rebase, restore, stash, clean and branch-switching stay denied.
    • Or a reconcile-only exemption: allow git add <path> when the working-tree content of every named path equals that path's blob in the commit a following merge --ff-only would land, so the add can only ever stage what develop already holds.

    Either way, the corpus case above should flip to allow for the exempt shape, keeping a deny case for a non-operational primary checkout.

  4. added a commit that references this issue on Nov 5, 2026
    30a7cf7
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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions