Skip to content

Open pin-bump PRs with the developer App token - #4678

Draft
pithead-developer[bot] wants to merge 7 commits into
developfrom
fix/pin-bump-app-token
Draft

pithead-developer[bot] wants to merge 7 commits into
developfrom
fix/pin-bump-app-token

Conversation

@pithead-developer

@pithead-developer pithead-developer Bot commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

What's the problem

The Tor and shipped-pin bump workflows find a newer upstream, push a bot/… branch and then fail at gh pr create: the repository keeps "Allow GitHub Actions to create and approve pull requests" off, so GITHUB_TOKEN cannot open the pull request each workflow exists to open. The branches sit on the remote and nobody is told, and the PRs the token did open triggered no checks of their own.

How I fixed it

  • Both bump jobs run in the pin-bump environment and mint a developer App token with actions/create-github-app-token (pinned by commit), with contents: write, pull-requests: write and issues: write on this repository only. That token pushes the branch, opens the PR and closes superseded ones. Pushes and PRs made with it start the PR's own checks.
  • GITHUB_TOKEN keeps contents: read and gains issues: write for the failure report; it writes nothing else. In the shipped-pin workflow the release lookup uses the App token too.
  • Each run first checks that the variable PIN_BUMP_APP_CLIENT_ID and the secret PIN_BUMP_APP_KEY are set, and fails with an error naming the missing one before it pushes anything. The repository setting stays off.
  • The superseded-PR helpers (scripts/watch/tor-bump.sh, scripts/watch/pin-bump.sh) count PRs by the developer App as their own, alongside the Actions bot, so a newer bump still closes the older one. They match only same-repo bump PRs on their own bot/ heads, and take the App only in its app/pithead-developer and pithead-developer[bot] logins; the workflows' own PR lookups also skip PRs from forks.
  • Every failed run comments on, or opens, an infra tracking issue named after the workflow (per component for the shipped pins), with a link to the run. Checkout is the first step, and the report uses the App token when the run minted one and the Actions token otherwise, which may open issues, so a missing setting or a revoked key is reported too.
  • Both PR bodies now say tiers 1 to 3 run as the PR's own checks, and docs/dev/releasing.md describes the one-time setup.
  • make test-tools checks both workflow files: the job runs in the pin-bump environment, checks out first, checks the settings before the push step, mints the App token with the pull-request and issues permissions, reports every failed run, and names github.token or GITHUB_TOKEN only on the one fallback line, which must appear exactly once, with the job's own issues: write that it relies on.

What to know:

  • One-time setup, done by the owner before merge: the environment pin-bump, limited to the develop branch, with the variable PIN_BUMP_APP_CLIENT_ID (the App's client ID) and the secret PIN_BUMP_APP_KEY, a private key of the App made for this use alone, so it can be revoked without touching the App's other keys. Neither exists at repository level, and the environment's branch rule means a run, a dry run included, works only from develop. Without them both workflows fail at the settings check with that message, before they push anything.
  • The existing bot/xmrig-proxy-v6.27.0 branch becomes a PR on the next run: the step adopts a branch whose tip is a pin-only commit. bot/tor-0.4.9.18-r0 is not needed once Twenty-nine fixes for 2.0.5 in one pull request, one commit each #4668, which carries the same pin, merges.
  • Not in scope: the rigforge leg of the shipped-pin workflow fails at "Resolve the newest release and its hash" for a separate reason. After merge that leg opens "Shipped pin bump run failed for rigforge" and comments on it each day; that issue is the leg's tracker until the leg is fixed.

Part of #4677

Here is the proof

Head bd35be94, on develop 495c6d3.

  • uvx zizmor@1.25.2 --offline .github/workflows/ (the version CI runs): no findings.
  • make test-tools: passes, including both watch self-tests and the new workflow check.
  • Mutants, each caught by a self-test row or the workflow check: the helpers trusting only the Actions bot; Tor's head match widened to any bot/ head; the App's PRs exempted from the head match; fork PRs counted; a bare pithead-developer login trusted; the environment line removed; an added github.token or secrets.GITHUB_TOKEN in any write step; the report step without its fallback or limited to runs that minted a token; the fallback line copied into another step; the App token's pull-request or issues permission removed; the job's own issues: write removed; checkout moved after the settings check; the settings check moved after the push step; the failure report removed. Not covered: the check counts the fallback line but does not tie it to the report step, so moving that one line into the push step while the report keeps only the App token would pass it.
  • make lint-yaml, lint-md, lint-docs-voice and lint-path-references: pass.
  • Live, after merge: a workflow_dispatch of "Shipped pin bump" from develop with dry_run on mints the App token in the pin-bump environment and pushes nothing; it is the first run that uses the key. The next scheduled Tor or pin bump that finds a newer upstream then opens a real PR.

Models: claude-opus-5-5 (developer)

🤖 Generated with Claude Code

The Tor and shipped-pin bump workflows run in the pin-bump environment
and mint a token for the developer App with contents and pull-request
write on this repository only. That token pushes the bump branch, opens
its PR and closes superseded ones; GITHUB_TOKEN keeps read access only.
Each run first checks that PIN_BUMP_APP_ID and PIN_BUMP_APP_KEY are set
and fails with a message naming the missing one before it pushes
anything. The superseded-PR helpers treat the App's PRs as their own,
the PR bodies say tiers 1 to 3 run as the PR's own checks, and
docs/dev/releasing.md describes the one-time setup. make test-tools
checks that both bump jobs keep this shape.

Fixes #4677

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pithead-developer pithead-developer Bot added this to the v2.0.5 milestone Dec 4, 2026
@pithead-developer
pithead-developer Bot marked this pull request as draft December 4, 2026 07:41
pithead-developer Bot and others added 2 commits December 4, 2026 02:01
The App token is minted with the client ID (PIN_BUMP_APP_CLIENT_ID), the
current input of create-github-app-token. The PR lookups and the
superseded helpers take only pull requests from this repository, and the
helpers trust the developer App only in its app/ and [bot] logins. A run
that fails after the token is minted comments on, or opens, an infra
tracking issue named after the workflow. The test-tools check also
refuses secrets.GITHUB_TOKEN and requires the pull-request permission
and the failure report, and the self-tests cover fork PRs, a bare login
and App PRs on other heads.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Checkout is the first step of both bump jobs, and the failure report
runs on any failure: it uses the App token when the run minted one and
the Actions token otherwise, with the job's issues permission, so a
missing setting or a revoked key also reaches the infra tracking issue.
The state lookups read up to 200 pull requests before they drop the
ones from forks. The test-tools check allows github.token only in that
one fallback line and requires the issues permission and checkout
before the settings check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pithead-developer pithead-developer Bot added the stage/needs-work returned by the reviewer, red CI, or conflicts with the base label Dec 4, 2026
The test-tools check now requires the job-level issues permission the
failure report falls back on, and the fallback GH_TOKEN line exactly
once. docs/dev/releasing.md says a missing setting fails the run at the
settings check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pithead-developer pithead-developer Bot added stage/in-progress and removed stage/needs-work returned by the reviewer, red CI, or conflicts with the base labels Dec 4, 2026
pithead-developer[bot] and others added 3 commits December 4, 2026 10:39
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ow serves

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…HIGH finding

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@pithead-developer pithead-developer Bot added stage/bench-testing its issue waits on a queued or running tier-4 bench job stage/needs-review green or pending CI, no reviewer verdict on the head yet and removed stage/in-progress stage/bench-testing its issue waits on a queued or running tier-4 bench job labels Dec 4, 2026
@pithead-reviewer

Copy link
Copy Markdown
Contributor

FAIL

What I investigated

The bench-ci evidence this diff requires is missing, stale or still running at the head, so the runner returned the PR before any reviewer session.

Reviewed head: 8a8d8bc12bd0f623dcc8f0c17b715850a7cbe006.

What are the gaps

  • bench-ci evidence (tier4-e2e): The diff changes docker-compose.yml or build/, which needs a tier4-e2e job on this head (options.mode targeted or matrix; check proves nothing about a branch), and the PR description cites no such job. Submit one on the full head SHA 8a8d8bc12bd0f623dcc8f0c17b715850a7cbe006; wait for it to conclude, then paste the unedited bench-ci evidence <id>@<sha> block into the PR description.

@pithead-developer pithead-developer Bot added stage/bench-testing its issue waits on a queued or running tier-4 bench job stage/in-progress and removed stage/needs-review green or pending CI, no reviewer verdict on the head yet stage/bench-testing its issue waits on a queued or running tier-4 bench job labels Dec 4, 2026
@pithead-developer

Copy link
Copy Markdown
Contributor Author

Blocked on p2pool-starter-stack/bench-ci#2905: tier4-e2e jobs 4888 and 4894 on head 8a8d8bc both errored at preflight (hugepages: 1256 free < 1296 needed), so no row ran. The branch is unchanged, and tiers 1 to 3 are green. Once the bench has its hugepages pool reserved and #2905 closes, the same targeted tier4-e2e is resubmitted and its evidence block goes into the description.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stage/blocked its issue waits on another issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants