Skip to content

Grant the auto-merge caller the reusable gate's read scopes - #4908

Merged
swu-echo[bot] merged 2 commits into
mainfrom
chore/auto-merge-gate-read-scopes
Oct 21, 2026
Merged

swu-echo[bot] merged 2 commits into
mainfrom
chore/auto-merge-gate-read-scopes

Conversation

@jaywedgeworth22

@jaywedgeworth22 jaywedgeworth22 commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Granted the auto-merge workflow’s token read access to Checks, Actions, and Issues while preserving its existing write access to repository contents and pull requests.
  • These scopes support the reusable workflow’s in-flight auto-merge gate, whose token cannot exceed the caller’s permissions and may fail to start when required read scopes are omitted.
  • The reusable workflow is currently pinned to a SHA that predates the gate, so the new permissions do not affect that pinned revision.
  • Test coverage was added in test/branch-protection-gate.test.ts, whose auto-merge caller guard now asserts that the workflow-level permissions: block keeps contents: write, pull-requests: write, checks: read, actions: read and issues: read (commit 0d98fc5).

Summary

  • Ensure the auto-merge caller retains the read scopes required by the reusable branch-protection gate: checks: read, actions: read, and issues: read, alongside contents: write and pull-requests: write.
  • Add regression coverage that prevents these workflow-level permissions from being removed. Without the read scopes, the reusable gate cannot inspect check runs or queued workflows and fails before pull requests can be armed.

Tests

  • Updated test/branch-protection-gate.test.ts to assert that all five required permissions remain declared at the auto-merge workflow level.

The in-flight gate added to the shared auto-merge reusable (AFC #822)
reads check-runs, workflow runs, and PR comments.  A called workflow's
GITHUB_TOKEN is capped by the caller's grants, and a called workflow that
declares scopes the caller omits fails at startup, so grant them here
before the reusable pin next advances.
@kody-ai

This comment has been minimized.

jaywedgeworth22 added a commit that referenced this pull request Oct 21, 2026
…Autofix re-kick constraint

The rollout note's Verification State said the full suite was not run locally.  It was:
tsc 0, eslint 0, vitest 9,726 passed / 51 skipped / 1 failed across 865 files, and
next build succeeded.  The single failure is a wall-clock assertion in
test/event-loop-stall-hot-path.test.ts, and neither it nor src/lib/db.ts is touched by
this diff, so it is a host-load artifact rather than a regression from this change.

Also recorded, because both are fleet findings rather than code findings:

- The Autofix failure had a second cause, in org configuration.  An org-wide Actions
  variable retargets every repository at once, but an org secret with selected
  visibility applies only to the repositories on its list, so the job failed
  everywhere else.  The selection was widened to the sixteen consumer repositories
  that consume the reusable, which touches no credential value, and the fix is
  confirmed in this repository by a green run on PR #4908.

- A workflow whose job is gated on the comment author's user type cannot be re-kicked
  by a human comment:  the run concludes skipped rather than failed, and a skipped
  run reads as a pass in the run list.  The levers that work are bot-authored events.

Updated:  STATUS.md, PLAN.md, docs/rollouts/2026-10-19-public-framework-pages.md
Comment thread .github/workflows/auto-merge-prs.yml
Comment thread .github/workflows/auto-merge-prs.yml
The reusable's in-flight gate reads the head commit's check runs and the head branch's queued workflow runs, and a called workflow cannot elevate the caller's token.  A scope the caller omits fails the reusable at startup and silently disables auto-merge arming for every pull request in this repo.  These grants are the contract, so assert them in the existing pinned-AFC case instead of trusting them to stay put.

Verified: npx vitest run test/branch-protection-gate.test.ts -> 11 passed, and the case fails when checks: read is removed from the workflow.
@kody-ai

kody-ai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Kody Review Complete

Great news! 🎉
No issues were found that match your current review configurations.

Keep up the excellent work! 🚀

⚠️ 2 Kody Rule(s) were not evaluated

These rules declare that they need repository context beyond this diff, and the review could not retrieve it, so they were not judged on this pull request:

  • Never move or delete existing app support.html URLs
  • Choose the Right Zod Strictness Mode for External Envelopes
Kody Guide: Usage and Configuration
Interacting with Kody
  • Request a Review: Ask Kody to review your PR manually by adding a comment with the @kody start-review command at the root of your PR.

  • Validate Business Logic: Ask Kody to validate your code against business rules by adding a comment with the @kody -v business-logic command.

  • Provide Feedback: Help Kody learn and improve by reacting to its comments with a 👍 for helpful suggestions or a 👎 if improvements are needed.

Current Kody Configuration
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ✅

Access your configuration settings here.

​

@kody-ai

kody-ai Bot commented Oct 21, 2026

Copy link
Copy Markdown

kody code-review Kody Rules high

PR description incorrectly says no test changes were included

Revises an earlier Kody suggestion on .github/workflows/auto-merge-prs.yml:64 (2026-10-21 13:54 UTC).

The PR description leaves a false record of test coverage even though the auto-merge caller guard now asserts checks: read, actions: read, and issues: read. Update its status to describe these regression assertions.

Kody rule violation: Preserve verification records

Prompt for LLM
PR description incorrectly says no test changes were included

**Revises an earlier Kody suggestion** on `.github/workflows/auto-merge-prs.yml:64` (2026-10-21 13:54 UTC).

The earlier request to add assertions for the three read scopes is now implemented by lines 277-283, but the PR description still says no test changes were included and that the guard does not assert them. Update that status to describe the added assertions; otherwise the PR preserves a false verification record about its coverage.

Kody rule violation: [Preserve verification records](https://app.kodus.io/settings/code-review/global/kody-rules/115a575d-3700-4ec6-b6fa-d7518615f969?teamId=69360e3a-6b41-45d2-9e49-fde78fe49457)

​

@swu-echo
swu-echo Bot added this pull request to the merge queue Oct 21, 2026
Merged via the queue into main with commit cd4916a Oct 21, 2026
31 checks passed
@swu-echo
swu-echo Bot deleted the chore/auto-merge-gate-read-scopes branch October 21, 2026 17:09
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