Skip to content

fix(pr-bot-review): mint the fold push token from a dedicated App - #29

Merged
ken-b4m merged 2 commits into
mainfrom
fix/pr-bot-review-fold-push-app
Oct 1, 2026
Merged

ken-b4m merged 2 commits into
mainfrom
fix/pr-bot-review-fold-push-app

Conversation

@ken-b4m

@ken-b4m ken-b4m commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

The fold push token was minted from the same App as the skill-repo read token. That App holds contents: read only, so the mint failed with "The level of access for permissions requested are not granted to this installation". Fold runs never pushed.

The fold push mint now uses a dedicated App, through vars.BOT_REVIEW_CLIENT_ID and secrets.BOT_REVIEW_APP_PRIVATE_KEY. That App has contents, issues and pull requests write, no workflows scope, and is installed on the calling repo only. The skill-repo read mint keeps its existing credentials. The README's secrets: inherit line names both pairs.

A caller must be able to see both new org credentials. Both are visible to bike4mind today.

checkBotFoldWritePath.test.mjs passes 33/33. The step's input key set is unchanged, so the existing pin still holds. The fold canary in bike4mind verifies the push end to end after a pin bump.

The App behind the skill-repo read token holds contents: read only, so the fold push mint failed on every repo. The fold push now uses BOT_REVIEW_CLIENT_ID and BOT_REVIEW_APP_PRIVATE_KEY, an App with contents: write installed on the calling repo. The skill-repo read mint is unchanged.

@ken-b4m ken-b4m left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Review: fix(pr-bot-review): mint the fold push token from a dedicated App

Assessment: APPROVE (posted as a comment, because this is a self-review of my own PR). The credential swap is correct and narrowly scoped. There is one P3, and it is optional.

  1. P3 .github/workflows/pr-bot-review.yml:1116: the mint-failure comment says "the App most likely lacks contents: write". After this PR, the likelier cause is a caller missing BOT_REVIEW_CLIENT_ID / BOT_REVIEW_APP_PRIVATE_KEY, or the new App not being installed on the repo. Name the var, the secret and the App install in that text. :1085 has the same unnamed "The App installation" wording. Disposition: fold in if you push again, but it does not justify a push on its own.

CI: 5/5 checks pass at faf6398. Mergeable: yes, 0 behind main, one commit.

Findings in full
P3 - .github/workflows/pr-bot-review.yml:1116 - mint-failure text points at the wrong cause

Report fold failure (:1103-1105) fires when push_token.outcome != 'success' and posts a PR comment. The comment's failure branch blames a missing contents: write scope, and it never says which App. Suppose a caller bumps its pin before provisioning the new credentials. That operator is sent to check scopes on an App, and PREMIUM_OVERLAY is the one they already know. Nothing breaks. Only the diagnosis is pointed the wrong way.

Verified and clean
  • Nothing downstream depends on the old App's identity. The caller stub triggers on types: [labeled] only (README.md:20), so the synchronize from a fold push never starts this workflow. The workflow has no github.actor, triggering_actor or event.sender check (grep empty). The commit author is hardcoded to claude[bot] at :1057-1058. Residual risk I cannot see from here: a caller repo whose ruleset bypass list or CI actor filter names the old App.
  • A missing credential breaks fold runs only. The mint is gated on env.FOLD_MODE == 'true' plus a posted review (:783-785). The push is gated on the mint's success (:805). Non-fold runs never read the new inputs, and the skill-repo read at :327 keeps PREMIUM_OVERLAY.
  • There is no new secret exposure. PUSH_TOKEN is still confined to the fold_push env (:807). The private key goes only to create-github-app-token. The mint still narrows to permission-contents: write on this one repository, so the App's broader issues and PR write is not reachable through this token.
  • The org holds BOT_REVIEW_CLIENT_ID and BOT_REVIEW_APP_PRIVATE_KEY, both with visibility ALL. That matches the PR body's claim. Whether the App is installed on each caller repo I did not check.
Method

This review is not independent: I authored the PR. I ran one Security lens (opus), because the diff changes which credential mints a write token. I skipped the DevOps/SRE lens, and I answered its questions inline (secret provisioning, gating, failure surfacing). I re-derived every cited line against faf6398.

The mint-failure comment now names the var, the secret and the App install. Both mint steps' credentials are pinned by value. The README says the App must be installed on the calling repo.
@ken-b4m
ken-b4m marked this pull request as ready for review October 1, 2026 00:57
@ken-b4m
ken-b4m merged commit 468d672 into main Oct 1, 2026
5 checks passed
@ken-b4m
ken-b4m deleted the fix/pr-bot-review-fold-push-app branch October 1, 2026 00:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant