Skip to content

release: organ owner-wide writers on the pyautolabs-bot App (token phase 2b) #534

Closed

Description

@Jammy2211

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

  1. 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).
  2. 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.
  3. 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.
  4. Every clone and push uses actions/checkout token: or gh auth setup-git with plain URLs; bot identity pyautolabs-bot[bot]; a missing credential fails loudly.
  5. Docs that described the PAT mechanism (Gut README/AGENTS, Mind smoke_bootstrap policy and spawn_spec, Brain repo_cleanup reference) are reworded.
  6. 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

  1. PyAutoBrain/.github/workflows/branch_sweep_all.yml: mint (owner-wide, permission-contents: write); replace x-access-token:$PAT@ URLs and GH_TOKEN: secrets.PAT_PYAUTOLABS with the step output + gh auth setup-git; keep the dry-run input semantics.
  2. PyAutoBrain/.github/workflows/branch_archive.yml: mint (repositories: PyAutoGut plus 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 (memory feedback_branch_archive_pat_lacks_workflow_scope obsolete — note in PR).
  3. PyAutoGut/.github/workflows/void.yml: mint (owner-wide, permission-contents: write); remove GIT_CONFIG_KEY_0/extraheader base64 plumbing and the "refuses if a global extraheader exists" guard; gh auth setup-git; own-repo steps keep github.token. Update README.md / AGENTS.md wording about the PAT and "a repo born after the PAT was minted may be missing".
  4. PyAutoMind/.github/workflows/spawn_drift.yml: mint (repositories: the *-template repos, permission-contents: write, permission-pull-requests: write); read clones may stay on GITHUB_TOKEN; remove x-access-token URLs. Update docs/pyautobrain/spawn_spec.md ("dropped from templates because it depends on the PAT" → App).
  5. 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: false stays; update policy/smoke_bootstrap.md.
  6. PyAutoMind/.github/workflows/arxiv_papers.yml, arxiv_interests.yml: mint (repositories: PyAutoMemory, permission-contents: write) for the inbox push; CLAUDE_CODE_OAUTH_TOKEN and webhook secrets untouched; remove x-access-token URLs and the "scoped to template repos, push may be denied" comment.
  7. 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.md
  • PyAutoGut/.github/workflows/void.yml, README.md, AGENTS.md
  • PyAutoMind/.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-id false 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_all with its dry-run input; branch_archive and void and the propagators get a git push --dry-run proof step or an existing dry_run/check input; 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_archive gains workflows: write on 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/workflows is empty in all six repos; no || github.token / || secrets.GITHUB_TOKEN fallback 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 (no repositories: = 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; memory feedback_branch_archive_pat_lacks_workflow_scope becomes obsolete.
  • Gut void.yml: delete held refs on siblings → contents write, owner-wide; drop GIT_CONFIG_KEY_0 extraheader plumbing and its guard; own-repo steps keep github.token.
  • Mind spawn_drift.yml: *-template repos → 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 — update policy/smoke_bootstrap.md and docs/pyautobrain/spawn_spec.md wording).
  • Mind arxiv_papers.yml, arxiv_interests.yml: push into PyAutoMemory → contents write on PyAutoMemory. CLAUDE_CODE_OAUTH_TOKEN and 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

  1. Jammy2211 commented on Oct 23, 2026

    @Jammy2211
    ContributorAuthor

    Shipped

    • PyAutoBrain#537 — branch sweep (owner-wide contents write; audit mode dry-run pushes to every repo) + branch archive (source repo + PyAutoGut, contents + workflows write; extraheader guard gone; dry_run input); foreground gc fix for the cleanup race that failed the 2026-09-27 scheduled sweep.
    • PyAutoGut#31 — void deletes sibling refs with the App; GIT_CONFIG_KEY_0/extraheader plumbing, masks and guard removed; dry_run probe job.
    • PyAutoMind#509 — spawn_drift (template repos, contents + pull-requests write), both propagators (owner-wide contents write), arxiv_papers/interests (PyAutoMemory contents write; silent "PAT not set" skip removed); dry_run inputs; 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.token is empty in all three repos. Not proven by dry run: the archive's workflows-write scope (only a real archive exercises it).

    Remaining PAT_PYAUTOLABS readers: the seven phase-3 dispatchers (4 *_visualization/render.yml, 2 *_profiling/pages_dashboard.yml, autolens_inference/inference-summary.yml).

    🤖 Generated with Claude Code

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