Skip to content

fix(ci): checks:read, and a bot PR's CI waits for approval rather than failing - #595

Merged
athvin merged 1 commit into
mainfrom
bm/ci-merge-bus-checks-read
Nov 5, 2026
Merged

athvin merged 1 commit into
mainfrom
bm/ci-merge-bus-checks-read

Conversation

@athvin

@athvin athvin commented Nov 5, 2026

Copy link
Copy Markdown
Owner

The first real batch was built, then the wait step died

The bus got further than ever: bus PR #585 for #510, with a genuine merge commit of main@1b4668bb and #510's head. Then:

GraphQL: Resource not accessible by integration
  (repository.pullRequest.statusCheckRollup…)

statusCheckRollup needs checks: read, undeclared. mergeStateStatus kept working — which is why the loop logged BLOCKED six times before dying — because only the rollup needs it. Third scope learned this way after actions: read; the lesson is the block itself: naming any permission sets every other to none.

Two defects worse than the missing scope

The rollup read was fatal. Under set -euo pipefail the failed assignment aborted the step, so the first successful batch left its bus PR open with no report and no cleanup. An unreadable rollup now means keep waiting.

ACTION_REQUIRED was listed as a batch failure, and it is not. A bot-authored PR's runs are created conclusion: action_required with zero jobs, waiting for a human to press "Approve and run" — observed on #585, all three runs held (also why /check-runs returned HTTP 500). Calling that "the batch went red" accuses the members of a failure nothing executed, and it is indistinguishable from starvation by step count, because both are zero.

held is now its own verdict: blames nobody, names the remedy, excluded from the starvation relabel.

The open question this answers next run

The wait step now attempts to release the runs itself (hence actions: write). Approving runs no new untrusted code — the bus PR is a merge of PRs whose own CI already ran this exact content — so the gate's substance is unaffected. If the token may not approve, it says so and stops rather than inventing a cause.

Whether a GITHUB_TOKEN may approve its own held runs is the one thing standing between this and unattended batching, and the next dispatch settles it empirically. If it may not, the bus needs a different CI vehicle than a pull request — dispatching the three workflows on the batch branch is the obvious candidate — because a human click per round is not automation.

Verification

held-released and held-stuck scenarios. Three mutants caught: treating ACTION_REQUIRED as red, removing the self-approval, and removing the guard keeping held out of the starvation path.

That last mutant initially passed, and the reason matters more than the fix: my stub served 42 executed steps for held runs, where real ones execute zero — so the guard looked untested because the condition it protects never arose. Fourth time in this exercise that a sanitised scenario proved nothing. With the scenario made faithful, removing the guard misreports a held batch as starvation, sending you to check billing when the real action is one click.

Also fixed: paste -sd', ' treats its delimiter as a cycling list, so context names joined as entities,test rather than entities, test in PR comments.

Suite 84 assertions · skills-check all exit 0 · S9 pin gate exit 0.

Touches .github/workflows/, so hand-merged by its own rule.

🤖 Generated with Claude Code

…n failing

The bus built and validated its first real batch — bus PR #585 for #510, a
genuine merge commit of main@1b4668bb and #510's head — and then died in the
wait step:

    GraphQL: Resource not accessible by integration
      (repository.pullRequest.statusCheckRollup…)

`statusCheckRollup` needs **`checks: read`**, which the permissions block did
not declare. `mergeStateStatus` kept working throughout, which is why the loop
logged BLOCKED six times before dying — only the rollup needed it. Third scope
learned this way after `actions: read`; the lesson is the block itself: naming
any permission sets every other to `none`.

Two further defects, both worse than the missing scope:

THE ROLLUP READ WAS FATAL. Under `set -euo pipefail` the failed assignment
aborted the step, so the first successful batch left its bus PR open with no
report and no cleanup. An unreadable rollup now means "keep waiting".

`ACTION_REQUIRED` WAS LISTED AS A BATCH FAILURE, and it is not. A bot-authored
pull request's runs are created `conclusion: action_required` with ZERO jobs,
waiting for a human to press "Approve and run" — observed on #585, all three
runs held, which is also why `/check-runs` returned HTTP 500. Reporting that as
"the batch went red" accuses the members of a failure nothing executed, and it
is indistinguishable from starvation by step count because both are zero.

So `held` is now its own verdict that blames nobody, names the exact remedy, and
is excluded from the starvation relabel. The wait step first ATTEMPTS to release
the runs itself (hence `actions: write`); approving runs no new untrusted code,
since the bus PR is a merge of PRs whose own CI already ran this content. If the
token may not approve, it says so and stops rather than inventing a cause.

Whether a `GITHUB_TOKEN` may approve its own held runs is the one open question,
and the next dispatch answers it. If it may not, the bus needs a different CI
vehicle than a pull request — dispatching the three workflows on the batch
branch is the obvious candidate — because a human click per round is not
unattended batching.

Covered by `held-released` and `held-stuck`. Three mutants caught: treating
ACTION_REQUIRED as red, removing the self-approval, and removing the guard that
keeps `held` out of the starvation path.

That last one needed the scenario fixed before it meant anything — the stub was
serving 42 executed steps for held runs, where real ones execute zero, so the
guard looked untested because the condition it protects never arose. Fourth time
this exercise that a sanitised scenario proved nothing; faithfulness to the real
failure is the whole value.

Also fixed: `paste -sd', '` treats the delimiter as a cycling LIST, so context
names joined as `entities,test` rather than `entities, test` in PR comments.

Suite now 84 assertions.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@athvin
athvin merged commit 62209d6 into main Nov 5, 2026
39 checks passed
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.

2 participants