Repository navigation
feat(cli): belt the role panes' git pushes and gh - #37
Merged
Merged
Conversation
A role's pane now runs its copilot with a second belt behind the guard: settings in its environment, which every command and script there inherits, so that git's pushes out of the machine and gh fail, even where the guard can't see them (decision 55, fact 38, risk 2). - git: after the GIT_CONFIG_COUNT settings that baton inherits, a pushInsteadOf rule per character that starts a URL that leaves the machine sends the push to a remote helper that doesn't exist, plus a rule per remote URL that leaves and a cleared pushurl per remote with one (an insteadOf rule before git 2.46). Local pushes, fetches, pulls and clones don't change. - gh: GH_CONFIG_DIR under /dev/null, so every gh command fails before it starts and never reaches the Keychain. The pane goes without the GitHub tokens; copilot gets GH_TOKEN's or GITHUB_TOKEN's as COPILOT_GITHUB_TOKEN for its own login. - repo.RemoteURLs and repo.ClearsPushURLs read the remotes' raw URLs and whether git clears pushurls. - The orchestrator's pane goes without the belt (decision 54). Docs: decision 55, fact 38, risk 2, the Panes and Safety sections, decisions 9, 50, 51 and 52, fact 37's start script, rows guard-orchestrator (Done) and belt (In review), README's login line, AGENTS.md's test tokens.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



What
A role's pane now runs its
copilotwith a second belt behind the guard. The belt is a set of settings in the pane's environment, which every command and script there inherits, however it runs. They make git's pushes out of the machine fail, andghtoo (decision 55, fact 38, risk 2). The user picked the git andghparts (option A) through nudge on 2026-11-04. The rest is the lead's call, flagged in decision 55.git. After the
GIT_CONFIG_COUNTsettings that baton inherits, which it keeps, the belt adds:pushInsteadOfrule for each character that can start a URL that leaves the machine (a–z, A–Z, 0–9,[). Each sends the push tobaton-blocks-push::<url>, a remote helper that doesn't exist, so git fails with 128 before any network.file://URLs local;pushurlfor each remote whose push URL leaves, which clears them (git ≥ 2.46). Older gits get aninsteadOfrule for that push URL instead.Pushes to local paths, fetches, pulls and clones don't change.
gh.
GH_CONFIG_DIR=/dev/null/baton-blocks-gh, so everyghcommand fails before it starts and never reaches the Keychain. An empty folder wouldn't do: gh would still find its Keychain login.Tokens. The pane goes without
GH_TOKEN,GITHUB_TOKENand their enterprise forms. IfCOPILOT_GITHUB_TOKENisn't set,copilotgets the value ofGH_TOKEN(or elseGITHUB_TOKEN) asCOPILOT_GITHUB_TOKEN, so its own login keeps working. A user whosecopilotlogs in only throughghrunscopilot loginonce (README).Refusals.
baton panebuilds the belt before it waits. It fails if git can't read the config or its version, or ifGIT_CONFIG_COUNTis one that git reads but Go doesn't (such as" 1").The orchestrator's pane has no belt, since the user approves its outward actions there (decision 54).
New in
internal/repo:RemoteURLs(the rawremote.*.urlandpushurlvalues, before insteadOf rewrites) andClearsPushURLs(git ≥ 2.46).Costs:
git push backup.git) fail.http://localhost/…).ghreads in role panes.Gaps (risk 2):
git send-pack, likelygit http-push, andgit lfs push(unchecked).git -c, and the user's own equal-or-longer push rules for typed URLs.git -C other, or remotes added later).COPILOT_GITHUB_TOKENis readable in the pane.env -i, its own helper onPATH).Copilot's command sandbox stays the user's call: its policy lives in the user's settings.
Docs:
docs/plan.md: decision 55, fact 38, and a rewrite of risk 2.baton feature startscript ran but failed withbaton: command not found, since baton wasn't on the live pane'sPATH.guard-orchestratoris now Done (feat(cli): guard the orchestrator's pane #36),beltIn review (feat(cli): belt the role panes' git pushes and gh #37).TestMainclears the GitHub tokens.Checks
mise run checkis green: lint 0 issues, no vulnerabilities, total coverage 99.3%, cli 99.8%. The one uncovered spot iswaitForWork's old guard; the belt code is fully covered.belt.go,remotes.goandpane.go, all caught. Ten were rewritten after they failed to build.TestPaneWaitsForTheRolesWork, because its write to the pane's pipe blocked once the pane had ended.stillWaiting, now fails the test cleanly instead.baton feature starton a tmux server of its own (-f /dev/null, its ownTMUX_TMPDIRandHOME,env -i), with a stand-incopilot.GIT_CONFIG_COUNT1→67, with the inherited setting kept.GH_TOKENbecameCOPILOT_GITHUB_TOKEN.origin(its pushurl cleared), and to typedhttpsand scp-like URLs, failed with 128. Pushes to a local remote and to a typed path went through.gh --versionandgh auth statusfailed before starting.copilot, offline, approved by the user through nudge.COPILOT_OFFLINE, a stand-in model on 127.0.0.1, a throwawayCOPILOT_HOMEandHOME.bashtool appended its three git settings after the belt's (count 70). The same push andghresults held.~/.copilotand its Keychain item were unchanged.