Repository navigation
Re-pin lane: one token per repository, and the workflows permission the two workflow-file sites need (defect 3) - #726
Conversation
…he two workflow-file sites need (defect 3) Run 34033398015 (2026-09-06 12:32Z) advanced all five pinned sites against codexFactory main 7f147070 and passed the freshness judge, then GitHub refused the push: "refusing to allow a GitHub App to create or update workflow .github/workflows/merge-master-approval.yml without `workflows` permission". Two of the five sites are workflow files (the core checkout `ref:` in merge-master-approval.yml and pytest-suite.yml). The mint requested no permission-* inputs at all (so the token carried whatever the installation has, and the installation has no `workflows`), over BOTH repositories at once (so any write it carried applied to codexFactory too, which the binding's never_grants forbids). Fix: two mints, one per repository the binding names, each requesting exactly that repository's grants -- `source-token` over codexFactory with contents:read (resolve, fetch the floor, check out the candidate core), and `app-token` over openxFactory with contents:write + pull-requests:write + workflows:write (check out this repository, push the bot branch, open/update the one pull request). The binding template grants workflows:write on the floored repository with the measurement as its reason; `workflows:write-to-default- branch` stays refused. Runbook: the permission table and a paragraph on the two places the permission must exist and what the refusal looks like without it. FAIL-LOUD: create-github-app-token refuses to mint a permission the installation does not carry, so until the `openxfactory` App is granted Workflows: Read and write and the grant is accepted on the org installation (the owner's act), the lane fails at the mint with a named error -- never a partial push. Tests (tests/review_lane_pin/test_repin_lane.py, 126 passed / 2 skipped, no skips added): one mint per declared repository with the minted set equal to the declared set; each mint requests EXACTLY its repository's grants (an empty request set fails); GITHUB_TOKEN's job block never exceeds the binding and the authoring mint equals it; workflow-file pinned sites (measured from PINNED_SITES) require workflows:write in the binding and on the mint, with a negative control on a stripped copy. No pin moved; no script change; every embedded script passes bash -n. Refs codexFactory #232 Lane: openxfactory-2
There was a problem hiding this comment.
Hi @brettheap! 👋
Your private repo does not have access to Sourcery.
Please upgrade to continue using Sourcery ✨
There was a problem hiding this comment.
🟡 Changes recommended
A newly added “negative control” test is currently vacuous (it doesn’t assert the promised failure), reducing confidence that regressions around the workflows grant will actually be caught.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR updates the review-lane-repin GitHub Actions lane to mint one GitHub App token per repository (codexFactory read-only vs openxFactory write/PR/workflows) and updates the binding/docs/tests to reflect the newly required workflows:write permission for pushes that touch pinned workflow files under .github/workflows/.
Changes:
- Split the lane’s App-token mint into two scoped mints (codexFactory
contents:read; openxFactorycontents:write,pull-requests:write,workflows:write) and route codexFactory API/checkouts through the read token. - Extend the binding template and runbook to include and justify
workflows:writefor the openxFactory side. - Strengthen tests to assert “one mint per declared repository” and “requested permissions == binding grants” (with one identified test gap noted in review comments).
File summaries
| File | Description |
|---|---|
tests/review_lane_pin/test_repin_lane.py |
Updates least-privilege assertions and adds tests ensuring per-repo mints and exact permission requests (includes a negative-control test that currently doesn’t assert the intended failure). |
docs/review-lane-repin-runbook.md |
Documents why workflows:write is required and where it must be granted (App installation + mint inputs). |
contracts/review-lane-repin-binding.template.yaml |
Adds workflows:write to floored repository grants with measured rationale and keeps default-branch refusal. |
.github/workflows/review-lane-repin.yml |
Implements two per-repo mints and switches codexFactory reads/checkouts to the read-scoped token; adds permission-workflows: write for openxFactory authoring token. |
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…he check; fix a test name The workflow-file-sites check is now a function both the positive test and its negative control call; the control strips workflows:write from a copy of the binding, then permission-workflows from a copy of the mint, and asserts the check RAISES on each, then re-runs it on the real pair. test_each_mint_requests_exactly_its_repository_grants renamed in the test and the workflow comment. Lane: openxfactory-2
There was a problem hiding this comment.
🟢 Approval recommended
The workflow, binding/template, tests, and runbook are updated consistently to enforce least-privilege per-repo minting and the required workflows:write permission for pinned workflow-file updates.
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 0 new
- Review effort level: Lite
|
Lane: openxfactory-2 (openXfactory-2) Landing on Brett Heap's word, in session, verbatim "fix both defects, then report the next sweep when it lands" (2026-09-06T17:42Z). Pre-flight 2026-09-06T18:45:40Z: head 50e1380; all 9 checks green incl. pytest-suite; 0 of 2 Copilot threads unresolved (round taken); MERGEABLE; 0 behind main (workflow + binding template + tests + runbook; no pin moved); no Rule 6 object. Squash --admin (the review rule; gh opens PRs as brettheap). Codex quota-refused. |
|
Lane: openxfactory-2 (openXfactory-2) MERGED → squash |
…nattended cycle (#738) * Tick §5 of mirror-floor-regeneration-automation: the first observed unattended cycle Brett Heap, in session, 2026-09-06T23:24Z, verbatim "merge 732 when green, then tick section 5 in both packets". Every box ticks only on the observed evidence written on its line; a box the evidence does not reach stays open and says why. Ticked: 5.2 (codexFactory run 34024535671 opened #248, no operator ran the generator), 5.3 (run 34066668104 opened #732 with no operator copying a digest; the five sites read back from the merged squash 9ffc625, not from the lane's report; snapshot bytes hash equal to the floor at 19f2ab0c), 5.4 (pytest-suite 34066687673 green with the freshness verifier passing BY NAME against the candidate core; skipped==21 unchanged), 5.7 (two refusal kinds observed on real runs, quoted: GitHub's workflows-permission push refusal on seven runs before #726, and the binding's own loud mint refusal on four runs until the grant). Open, with reasons: 5.1 (promotion-free cycle under the ruled pin-only reading; covered-pending 0 throughout), 5.5 (three human merges observed and quoted; the count never left zero so its return cannot be observed), 5.6 (wall time recorded -- 14 h 22 min 33 s end to end; 3 h 21 min from the last floor move; 23 s sweep-to-PR once mintable -- and stated not to be the unattended figure: three repairs and a grant wait sat inside it). 6.4 carries a dated TAKEN note in two parts (the named grant proven by use on run 34024566099; the workflows extension given 20:25Z, visible on the mint at 23:21Z). No requirement text moves; no pin moves. Drafted by an Opus author that died on its session limit; completed by the orchestrator (disclosed). Refs codexFactory #232 Lane: openxfactory-2 * Take Copilot round 1 on #738: state the ticked and open boxes as two plain sentences Lane: openxfactory-2 --------- Co-authored-by: Brett Heap <[email protected]>
Lane: openxfactory-2 (openXfactory-2)
Word: Brett Heap, in session, 2026-09-06T17:42Z, verbatim "fix both defects, then report the next sweep when it lands". Governing: codexFactory #232 (defect 3). Authored directly by the orchestrator after the Opus author died on its session limit (disclosed).
Defect (found by the first observed cycle). Run 34033398015 (12:32Z) advanced all five pinned sites against codexFactory main 7f147070 and passed the LQ-A7 judge, then GitHub refused the push:
refusing to allow a GitHub App to create or update workflow .github/workflows/merge-master-approval.yml withoutworkflowspermission. Two of the five sites ARE workflow files (the core checkoutref:inmerge-master-approval.ymlandpytest-suite.yml). The mint requested nopermission-*inputs (the token carried whatever the installation has — and the installation has noworkflows) over both repositories at once (any write it carried applied to codexFactory too, which the binding'snever_grantsforbids).Fix. Two mints, one per repository the binding names, each requesting exactly that repository's grants — the shape the codexFactory regeneration lane already uses:
source-token→ codexFactory,permission-contents: read(resolve the default branch, fetch the floor, check out the candidate core);app-token→ openxFactory,permission-contents: write+permission-pull-requests: write+permission-workflows: write(check out this repository, pushbot/review-lane-repin, open/update the one PR).Binding template: floored grants
[contents:write, pull-requests:write, workflows:write]with the measurement as the reason;workflows:write-to-default-branchstays refused. Runbook: the permission table and a paragraph on the two places the permission must exist.Owner's act (Brett).
create-github-app-tokenrefuses to mint a permission the installation does not carry. Until theopenxfactoryApp (app id 4253636) is granted Workflows: Read and write (App settings → Permissions → Repository permissions → Workflows) and the grant is accepted on the org installation, the lane fails at the MINT step with a named error — fail-loud, never a partial push. Today the installation carries contents=write, metadata=read, organization_self_hosted_runners=read, pull_requests=write.Tests (
tests/review_lane_pin/test_repin_lane.py, R8): one mint per declared repository, minted set == declared set; each mint requests EXACTLY its repository's grants (an empty request set fails); GITHUB_TOKEN's job block ⊆ binding and the authoring mint == binding; workflow-file sites measured fromPINNED_SITESrequireworkflows:writein the binding and on the mint, with a negative control. 126 passed / 2 skipped, no skips added (EXPECT_SKIPPED untouched). No pin moved (all five sites byte-identical to main); no script change; every embedded script passesbash -n.Then: after this lands AND the installation grant exists, the next :17 sweep should open the re-pin PR for the first time.
Refs codexFactory #232