Repository navigation
Description
Overview
Phase 2b of the GitHub token consolidation (parent prompt github_token_and_secret_setup_full_review; phase 1 = Heart#316 + Hands#322; phase 2a = Brain#532/#533, Heart#317, Scientist#89, Memory#141). The organ workflows that WRITE across many repos — deleting branches, pushing archived history, voiding held refs, committing to every repo's default branch, pushing into PyAutoMemory and the template repos — move off the person-owned PAT_PYAUTOLABS onto per-job pyautolabs-bot App tokens, with URL-embedded tokens, extraheader plumbing and silent fallbacks removed. After this, PAT_PYAUTOLABS is read only by phase-3 dispatchers.
Plan
- Brain branch sweep and branch archive mint App tokens: owner-wide contents write for the sweep; contents + workflows write on PyAutoGut for the archive (restores archiving of branches that contain workflow files, which the PAT could not do).
- Gut void mints an owner-wide contents-write App token to delete held refs on sibling repos; its own-repo steps stay on the job token; the extraheader env plumbing and its guard are deleted.
- Mind spawn_drift mints a token for the template repos (contents + pull-requests write); the two propagators mint owner-wide contents-write tokens, so a newly born repo needs no token step any more; the two arxiv workflows mint contents write on PyAutoMemory.
- Every clone and push uses
actions/checkouttoken:orgh auth setup-gitwith plain URLs; bot identitypyautolabs-bot[bot]; a missing credential fails loudly. - Docs that described the PAT mechanism (Gut README/AGENTS, Mind smoke_bootstrap policy and spawn_spec, Brain repo_cleanup reference) are reworded.
- Proof without side effects: each writer gets a dry-run path (
git push --dry-run/ the workflow's existing dry-run or check input) exercised by a dispatch on the branch; no live sweep, void, propagate or spawn from this task.
Tier: judge — merge mode: human /prm
Detailed implementation plan
Affected Repositories
- PyAutoBrain (primary)
- PyAutoGut
- PyAutoMind
Branch Survey
| Repository | Current Branch | Dirty? |
|---|---|---|
| organs/PyAutoBrain | main | clean (unregistered feature/pyautodna-stack-management worktree exists) |
| organs/PyAutoGut | main | clean |
| organs/PyAutoMind | main | clean (shared state checkout; work only in the task worktree, PR limited to .github/, policy/, docs/) |
Suggested branch: feature/github-token-p2b-writers-app
Implementation Steps
PyAutoBrain/.github/workflows/branch_sweep_all.yml: mint (owner-wide,permission-contents: write); replacex-access-token:$PAT@URLs andGH_TOKEN: secrets.PAT_PYAUTOLABSwith the step output +gh auth setup-git; keep the dry-run input semantics.PyAutoBrain/.github/workflows/branch_archive.yml: mint (repositories: PyAutoGutplus the source repo being archived,permission-contents: write,permission-workflows: write); delete the "fails if an extraheader is set" guard; keep verify-then-delete order; the archive push of history containing.github/workflows/*now works (memoryfeedback_branch_archive_pat_lacks_workflow_scopeobsolete — note in PR).PyAutoGut/.github/workflows/void.yml: mint (owner-wide,permission-contents: write); removeGIT_CONFIG_KEY_0/extraheader base64 plumbing and the "refuses if a global extraheader exists" guard;gh auth setup-git; own-repo steps keepgithub.token. UpdateREADME.md/AGENTS.mdwording about the PAT and "a repo born after the PAT was minted may be missing".PyAutoMind/.github/workflows/spawn_drift.yml: mint (repositories:the*-templaterepos,permission-contents: write,permission-pull-requests: write); read clones may stay onGITHUB_TOKEN; removex-access-tokenURLs. Updatedocs/pyautobrain/spawn_spec.md("dropped from templates because it depends on the PAT" → App).PyAutoMind/.github/workflows/session_hook_propagate.yml,smoke_bootstrap_propagate.yml: mint (owner-wide,permission-contents: write); plain URLs +gh auth setup-git;persist-credentials: falsestays; updatepolicy/smoke_bootstrap.md.PyAutoMind/.github/workflows/arxiv_papers.yml,arxiv_interests.yml: mint (repositories: PyAutoMemory,permission-contents: write) for the inbox push;CLAUDE_CODE_OAUTH_TOKENand webhook secrets untouched; removex-access-tokenURLs and the "scoped to template repos, push may be denied" comment.- Brain
skills/repo_cleanup/reference.md: reword the "cross-repo sweeps use the PAT" explanation.
Key Files
PyAutoBrain/.github/workflows/{branch_sweep_all,branch_archive}.yml,skills/repo_cleanup/reference.mdPyAutoGut/.github/workflows/void.yml,README.md,AGENTS.mdPyAutoMind/.github/workflows/{spawn_drift,session_hook_propagate,smoke_bootstrap_propagate,arxiv_papers,arxiv_interests}.yml,policy/smoke_bootstrap.md,docs/pyautobrain/spawn_spec.md
Testing
- YAML parse + actionlint (known
client-idfalse positive) on all eight workflows; each repo's pytest. - Dry-run dispatches on the branch (workflows exist on main, so
--ref <branch>works):branch_sweep_allwith its dry-run input;branch_archiveandvoidand the propagators get agit push --dry-runproof step or an existingdry_run/checkinput; arxiv and spawn_drift only if they have a side-effect-free mode, else actionlint only and say so.
Trade-offs
- Owner-wide write tokens for sweep, void and the propagators are unavoidable (they touch every repo); each is still scoped to contents only and lives one hour.
branch_archivegainsworkflows: writeon purpose: archiving history that contains workflow files is the point of the Gut.
Original Prompt
Click to expand starting prompt
GitHub token consolidation phase 2b: owner-wide writers (Brain sweep/archive, Gut void, Mind pushers) on the App
Type: release
Target: PyAutoBrain
Repos:
- PyAutoBrain
- PyAutoMind
- PyAutoGut
Difficulty: hard
Unblocked: 2026-10-23 (2a merged — complete/2026/10/github-token-p2a-readers-app.md)
Autonomy: supervised
Priority: high
Status: formalised
Consequence: judge
Parent: draft/release/pyautohands/github_token_and_secret_setup_full_review.md (surveys in_surveys/; phase plan in 03_target_design_and_phases.md); phase 1 = complete/2026/10/github-token-p1-hands-app.md
Witness:grep -rl PAT_PYAUTOLABS .github/workflowsis empty in all six repos; no|| github.token/|| secrets.GITHUB_TOKENfallback on any cross-repo credential; one green dispatch of each migrated workflow that can run without side effects
Review-minutes: 30
Unattended: never
Phase 1 proved the App (Heart#316, Hands#322). Move every organ cross-repo
writer off PAT_PYAUTOLABS onto per-job actions/create-github-app-token@v3
(client-id: ${{ vars.APP_CLIENT_ID }}, private-key: ${{ secrets.APP_PRIVATE_KEY }},
owner: PyAutoLabs, narrowest repositories:/permission-*:), auth via
gh auth setup-git or actions/checkout token: — never URL userinfo, never
an extraheader env trick. Missing credentials fail the job loudly: delete every
silent fallback. Bot identity pyautolabs-bot[bot] /
346909844+pyautolabs-bot[bot]@users.noreply.github.com. One PR per repo.
Per workflow (from _surveys/01_inventory.md):
- Brain
branch_sweep_all.yml: delete stale branches on siblings → contents write, owner-wide (norepositories:= all installed repos). - Brain
branch_archive.yml: push archived refs into PyAutoGut, including history containing workflow files → contents write + workflows write on PyAutoGut; remove the extraheader guard; memoryfeedback_branch_archive_pat_lacks_workflow_scopebecomes obsolete. - Gut
void.yml: delete held refs on siblings → contents write, owner-wide; dropGIT_CONFIG_KEY_0extraheader plumbing and its guard; own-repo steps keepgithub.token. - Mind
spawn_drift.yml:*-templaterepos → contents write + pull-requests write. - Mind
session_hook_propagate.yml,smoke_bootstrap_propagate.yml: direct commits to every manifest repo's default branch → contents write, owner-wide (new repos need no per-token step any more — updatepolicy/smoke_bootstrap.mdanddocs/pyautobrain/spawn_spec.mdwording). - Mind
arxiv_papers.yml,arxiv_interests.yml: push into PyAutoMemory → contents write on PyAutoMemory.CLAUDE_CODE_OAUTH_TOKENand webhook URLs unchanged.
Validation per repo: YAML parse + actionlint (ignore the known client-id false
positive); each repo's own tests; where a workflow has a side-effect-free mode
(dry-run inputs, --check, read-only board renders), dispatch it on the branch
via a pull_request path-filtered trigger or after merge and report. For
writers with no safe mode (propagators, void, branch_archive) prove the token
scope with a git push --dry-run step added to the workflow's own log, not a
live run. Mind is the shared state checkout: work in the task worktree and
keep the PR to .github/, policy/, docs/.
Out of scope: 2a workflows (readers/dispatchers — own task), dispatchers in the viz/profiling/inference repos (phase 3), secret
deletion (phase 4), the policy page (phase 5).
🤖 Generated with Claude Code
Activity
Jammy2211 commentedon Oct 23, 2026
Shipped
dry_runinput); foreground gc fix for the cleanup race that failed the 2026-09-27 scheduled sweep.GIT_CONFIG_KEY_0/extraheader plumbing, masks and guard removed;dry_runprobe job.dry_runinputs; policy/spawn_spec reworded.Proof: dry-run dispatches on the branch — sweep audit 39976236635 (32/32 ok), archive 39975942351, void 39975947470, spawn_drift 39975952646, session_hook_propagate 39975957778, smoke_bootstrap_propagate 39975963392 (12/12), arxiv_papers 39975968608, arxiv_interests 39975974280 — all green. Witness grep for
PAT_PYAUTOLABS/x-access-token/GIT_CONFIG_KEY/|| github.tokenis empty in all three repos. Not proven by dry run: the archive's workflows-write scope (only a real archive exercises it).Remaining
PAT_PYAUTOLABSreaders: the seven phase-3 dispatchers (4*_visualization/render.yml, 2*_profiling/pages_dashboard.yml,autolens_inference/inference-summary.yml).🤖 Generated with Claude Code