Skip to content

release: organ readers/dispatchers on the pyautolabs-bot App (token phase 2a) #531

Closed

Description

@Jammy2211

Overview

Phase 2a of the GitHub token consolidation (parent Mind prompt github_token_and_secret_setup_full_review; phase 1 merged as PyAutoHeart#316 + PyAutoHands#322, record complete/2026/10/github-token-p1-hands-app.md). The organ workflows that read across repos, dispatch, or open a PR move off the person-owned PAT_PYAUTOLABS and two never-created secrets onto the org-owned pyautolabs-bot App, and every silent credential fallback is removed. Phase 2b (owner-wide writers: Brain sweep/archive, Gut void, Mind pushers) follows separately.

Plan

  1. Brain nightly release driver mints a scoped App token (actions write + contents read on PyAutoHands) to dispatch and poll the Hands release.
  2. Brain repo_settings.yml is retired: it needs the Administration permission the App deliberately lacks. The equivalent local gh api loop is recorded in the Brain reference that pointed at it.
  3. Heart health replaces the never-created HEART_TIMINGS_TOKEN with an owner-wide read-only App token, so cross-repo artifact reads stop 403ing. The fallback to the job token is deleted.
  4. Scientist organism board replaces the PAT with an owner-wide read-only App token; the || github.token fallback and the silent request-budget drop are deleted.
  5. Memory queue filing replaces the never-created QUEUE_PR_TOKEN with an App token scoped to PyAutoMemory so the PR actually opens and triggers CI.
  6. One PR per repo; each migrated workflow is run once in a side-effect-free mode after merge and reported.

Tier: judge — merge mode: human /prm

Detailed implementation plan

Affected Repositories

  • PyAutoBrain (primary)
  • PyAutoHeart
  • PyAutoScientist
  • PyAutoMemory

Branch Survey

Repository Current Branch Dirty?
organs/PyAutoBrain main clean (unregistered feature/pyautodna-stack-management worktree exists)
organs/PyAutoHeart main clean
organs/PyAutoScientist main clean (same unregistered worktree)
organs/PyAutoMemory main clean

Suggested branch: feature/github-token-p2a-readers-app

Implementation Steps

  1. PyAutoBrain/.github/workflows/nightly-release.yml: add actions/create-github-app-token@v3 (client-id: ${{ vars.APP_CLIENT_ID }}, private-key: ${{ secrets.APP_PRIVATE_KEY }}, owner: PyAutoLabs, repositories: PyAutoHands, permission-actions: write, permission-contents: read); replace GH_TOKEN: ${{ secrets.PAT_PYAUTOLABS }} with the step output. Update PyAutoHands/docs/nightly_release_design.md's secrets list only if it is in this repo set (it is not: note it in the PR for phase 5).
  2. PyAutoBrain/.github/workflows/repo_settings.yml: delete. Grep Brain skills/ and docs/ for repo_settings and replace the pointer with the local loop for r in $(gh repo list PyAutoLabs -L 200 --json name --jq '.[].name'); do gh api -X PATCH repos/PyAutoLabs/$r -f delete_branch_on_merge=true; done.
  3. PyAutoHeart/.github/workflows/heart-health.yml: mint step with permission-actions: read (no repositories: → all installed repos); GH_TOKEN: ${{ steps.app_token.outputs.token }}; delete ${{ secrets.HEART_TIMINGS_TOKEN || secrets.GITHUB_TOKEN }} and the comment explaining the fallback.
  4. PyAutoScientist/.github/workflows/organism_board.yml: mint step with permission-contents: read + permission-metadata: read, owner-wide; GH_TOKEN from the step; remove || github.token; set the request budget to the single PAT value and delete the fallback branch; update REPORTING.md.
  5. PyAutoMemory/.github/workflows/queue_filing.yml: mint step (repositories: PyAutoMemory, permission-contents: write, permission-pull-requests: write); PR_TOKEN from the step; remove the compare-link fallback; push with the App token (not the job token) so the PR's CI triggers; update README.md's QUEUE_PR_TOKEN paragraph.
  6. Bot identity for any commit: pyautolabs-bot[bot] / 346909844+pyautolabs-bot[bot]@users.noreply.github.com.

Key Files

  • PyAutoBrain/.github/workflows/nightly-release.yml, repo_settings.yml
  • PyAutoHeart/.github/workflows/heart-health.yml
  • PyAutoScientist/.github/workflows/organism_board.yml, REPORTING.md
  • PyAutoMemory/.github/workflows/queue_filing.yml, README.md

Testing

  • YAML parse + actionlint on every touched workflow (the client-id input warning is a known actionlint metadata false positive).
  • Each repo's pytest where present.
  • Post-merge: gh workflow run heart-health.yml, organism_board.yml; nightly only in a non-release/inspect mode if one exists; Memory proven via its PR-trigger mint.

Trade-offs

  • Owner-wide tokens (no repositories:) for Heart and Scientist because they read every repo; permissions are read-only so the blast radius is nil.
  • Retiring repo_settings.yml rather than granting Administration keeps the App unable to delete repos.

Original Prompt

Click to expand starting prompt

GitHub token consolidation phase 2a: organ readers and dispatchers (Brain nightly, Heart, Scientist, Memory) on the App

Type: release
Target: PyAutoBrain
Repos:

  • PyAutoBrain
  • PyAutoHeart
  • PyAutoScientist
  • PyAutoMemory
    Difficulty: hard
    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; sibling 2b = draft/release/pyautobrain/github_token_phase2b_owner_wide_writers_app_token.md
    Witness: grep -rl PAT_PYAUTOLABS .github/workflows empty in Brain (except branch_sweep_all/branch_archive, 2b), Heart, Scientist, Memory; no || github.token / || secrets.GITHUB_TOKEN fallback on any cross-repo credential; repo_settings.yml gone; one green run of each migrated workflow in a side-effect-free mode
    Review-minutes: 20
    Unattended: never

Phase 1 proved the App (Heart#316, Hands#322). Move the organ workflows that
READ across repos, DISPATCH, or OPEN A PR off PAT_PYAUTOLABS / never-created
secrets 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-*:); GH_TOKEN env
for gh, actions/checkout token: for clones. Missing credentials fail the job
loudly: delete every silent fallback. One PR per repo.

  • Brain nightly-release.yml: dispatch + poll Hands release.yml → actions write + contents read on PyAutoHands. Repo variables NIGHTLY_* unchanged.
  • Brain repo_settings.yml: RETIRE (needs Administration, which the App deliberately lacks). Delete the workflow; record the equivalent local gh api -X PATCH repos/PyAutoLabs/<repo> -f delete_branch_on_merge=true loop in whichever Brain skill/reference pointed at it (grep repo_settings).
  • Heart heart-health.yml: replace the never-created HEART_TIMINGS_TOKEN with an App token (actions read, owner-wide = no repositories:) so cross-repo artifact reads stop 403ing; delete the || secrets.GITHUB_TOKEN fallback; update the inline comment.
  • Scientist organism_board.yml: cross-repo activity reads → contents read + metadata, owner-wide; delete the || github.token fallback and the silent 180→60 budget drop (update REPORTING.md).
  • Memory queue_filing.yml: replace the never-created QUEUE_PR_TOKEN with an App token (pull-requests write + contents write on PyAutoMemory) so the PR actually opens and triggers CI instead of the compare-link fallback; update README.

Validation: YAML parse + actionlint (ignore the known client-id false
positive); each repo's own tests; dispatch each migrated workflow in a
side-effect-free mode after merge to main (Heart health render, Scientist board
render, Brain nightly with its dry/inspect input if one exists — never a live
release) and report; for Memory, a PR-trigger path filter is acceptable proof of
the mint. Keep PRs to .github/, skills/docs; another session's unregistered
pyautodna-stack-management branch exists on Brain and Scientist.

Out of scope: 2b owner-wide writers (Brain sweep/archive, Gut void, Mind pushers), phase 3 dispatchers, phase 4 secret deletion, phase 5 policy page.

🤖 Generated with Claude Code

Activity

  1. Jammy2211 commented on Oct 23, 2026

    @Jammy2211
    ContributorAuthor

    Shipped

    • PyAutoBrain#532 — merged 9483eda (nightly driver on the pyautolabs-bot App incl. the window-anchor variable via the App's new Variables permission; repo_settings.yml retired, local gh api loop documented in skills/repo_cleanup/reference.md)
    • PyAutoHeart#317 — merged d437fc0 (heart-health reads cross-repo with a read-only App token; HEART_TIMINGS_TOKEN || GITHUB_TOKEN fallback removed)
    • PyAutoScientist#89 — merged d8f4b21 (organism board on a read-only App token; || github.token fallback and the silent 180→60 budget drop removed)
    • PyAutoMemory#141 — merged a8d8d07 (queue filing pushes and opens its PR with the App; compare-link fallback removed)

    All CI green; none of these repos' CI exercises the edited workflows, so post-merge proof = dispatches on main (nightly dry_run, heart-health, organism_board) reported on this issue; Memory proves on its next real filing.

    🤖 Generated with Claude Code

  2. Jammy2211 commented on Oct 23, 2026

    @Jammy2211
    ContributorAuthor

    Post-merge proofs: Heart heart-health run 39971435680 success; Scientist organism_board run 39971440448 success; Brain nightly dry_run on main (39971454356) failed at the mint — permission is named actions_variables — fixed by #533 (dry run 39971711185 success on the branch), merged.

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