Repository navigation
Description
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
- Replicate the change in a task worktree, commit and push it, and merge it. That works.
- Bring the live checkout back in line with
develop. That step cannot be done by an agent.merge --ff-onlyis 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>andgit 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 6Expected
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
Rewrite the Write Guard as a Small Lexer With Plain-Shape Rules (#3407)
ptr727 commentedon Oct 24, 2026
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.
ptr727 commentedon Nov 5, 2026
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
mainat 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.pyonmain,addandcommitare 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:So the corpus case keeps the defect in place rather than guarding its fix. The reconcile path the issue describes is still closed:
develop.develop. That works.git merge --ff-only origin/developin 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.git add <file>andgit 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)
Interim
The maintainer has opted this one repository's sessions into
GH_WRITE_GUARD_ALLOW_PRIMARY_CHECKOUT=1through a git-ignored project-local Claude Code settings file. That override is all or nothing for the session. It also lifts the guard onreset --hard,stash,clean -fand 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:
operationalworkflow model and is ondevelop, allowaddandcommitof tracked paths and a push ofdevelop, whilereset,rebase,restore,stash,cleanand branch-switching stay denied.git add <path>when the working-tree content of every named path equals that path's blob in the commit a followingmerge --ff-onlywould land, so the add can only ever stage whatdevelopalready holds.Either way, the corpus case above should flip to
allowfor the exempt shape, keeping adenycase for a non-operational primary checkout.Let an Operational Repository Commit in Place Through a Repo Agent Po…