Skip to content

ci: sponsor high-blast-radius surfaces, consolidate the governance stack - #920

Merged
lidge-jun merged 1 commit into
devfrom
codex/ci-governance-consolidated
Aug 3, 2026
Merged

ci: sponsor high-blast-radius surfaces, consolidate the governance stack#920
lidge-jun merged 1 commit into
devfrom
codex/ci-governance-consolidated

Conversation

@lidge-jun

Copy link
Copy Markdown
Owner

Summary

Consolidates the parts of @Wibias's five-PR governance stack worth keeping into
one PR, and drops the parts that work against the goal the stack was opened for.

The ordering came from measurement, not preference. Over 33 recent Cross-platform
CI runs, Windows was the last job to finish in 23 of 23 current-schema runs
(median 17m41s against ubuntu 5m58s), which is why #899 went first. Everything
here is judged by whether it makes that lane worse.

What this adds

Sponsored surfaces (from #902). Authentication, credential handling, GitHub
Actions workflows, release automation, and dependency installation need a
maintainer to apply maintainer-sponsored before merge. MAINTAINERS.md already
requires security review for exactly these — this makes the requirement visible
on the PR instead of relying on a reviewer noticing.

It runs inside the existing hygiene job rather than adding a workflow, and it
applies to every contributor. Blast radius does not depend on how many PRs
someone has merged, so the upstream first-timer exemption is gone. An author with
push permission is exempt because their own review is the sponsorship.

CODEOWNERS for the high-impact runtime directories (from #905).

Contributor documentation (from #905), rewritten. The submitted version
documented an approved-for-work gate, size caps, and automatic closure timers —
none of which exist here. Publishing rules the repository does not enforce is
worse than publishing none.

What this drops, and why

From Dropped Reason
#902 500-line cap, one-open-PR limit A provider preset with registry rows, adapter wiring, tests, and five locales clears 500 lines by itself. Several good first contributions here have. Telling a newcomer their fix is too big is a worse failure than reviewing a large diff.
#900 Pre-approved-issue admission gate, 5-day auto-close The DeepSeek reasoning replay, the Cursor Grok parameters, the AgentRouter EOF tolerance, the tool-result image forwarding — every one arrived as an unplanned PR from someone who hit the bug. A gate requiring a planning discussion first would have lost all of them.
#901 Readiness gate, entirely It makes CodeRabbit's judgment blocking (request-changes on "technically credible" reasons) and triggers per check_run, which scales with the job count #899 just raised — up to 18–24 invocations per update.

Verification

  • node --test .github/scripts/pr-sponsored-surface.test.cjs: 7 pass, 0 fail
  • node --test .github/scripts/pr-hygiene.test.cjs: 21 pass, 0 fail
  • bun test tests/ci-workflows.test.ts: 66 pass, 0 fail
  • Both new script tests wired into issue-quality-tests.yml, which is where this
    repository already runs its policy-script tests

Credit

The sponsorship rule, the CODEOWNERS entries, and the documentation skeleton are
@Wibias's work from #900/#902/#905; the commit carries his co-authorship. The
narrowing, the rewrite, and the dropped policies are mine, and the reasons are
recorded on each original PR rather than only here.

…n the docs

Consolidates the parts of @Wibias's five-PR governance stack (#900, #902, #905)
that reduce risk without adding friction, and drops the parts that do the
opposite. The measurement behind the ordering: Windows was the last job to
finish in 23 of 23 recent CI runs at a 17m41s median, so #899 was the actual
bottleneck and everything here is judged by whether it makes the lane worse.

Kept, from #902's trust lane: authentication, credential handling, GitHub
Actions workflows, release automation, and dependency installation need a
maintainer to sponsor the change before it merges. MAINTAINERS.md already
requires security review for exactly these; this makes the requirement visible
on the pull request instead of relying on a reviewer noticing. It runs inside
the existing hygiene job rather than adding a workflow, and it applies to every
contributor — blast radius does not depend on how many PRs someone has merged,
which is why the upstream first-timer exemption is gone.

Dropped, from the same PR: the 500-line cap and the one-open-PR limit. A
provider preset with its registry rows, adapter wiring, tests, and five locales
clears 500 lines by itself, and several good first contributions here have.
Telling a newcomer their fix is too big is a worse failure than reviewing a
large diff.

Dropped, from #900: the admission gate requiring a pre-approved issue, and the
five-day auto-close. The DeepSeek reasoning replay, the Cursor Grok parameters,
the AgentRouter EOF tolerance, the tool-result image forwarding — every one
arrived as an unplanned PR from someone who hit the bug. A gate that required a
planning discussion first would have lost all of them.

Kept, from #905: CODEOWNERS entries for the high-impact runtime directories, and
the contributor documentation — rewritten to describe what is actually enforced.
The submitted version documented the approved-for-work gate, the size caps, and
the automatic closure timers, none of which exist here, and publishing rules the
repository does not enforce is worse than publishing none.

Not included: #901's readiness gate. It makes CodeRabbit's judgment blocking and
triggers per check_run, which scales with the job count #899 just raised.

Co-authored-by: Wibias <37517432+Wibias@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@lidge-jun, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 14 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 231b6ccb-265b-41f3-ade5-38b8a1f3d2b9

📥 Commits

Reviewing files that changed from the base of the PR and between fd1c5b4 and 04ccb79.

📒 Files selected for processing (7)
  • .github/CODEOWNERS
  • .github/scripts/pr-sponsored-surface.cjs
  • .github/scripts/pr-sponsored-surface.test.cjs
  • .github/workflows/issue-quality-tests.yml
  • .github/workflows/pr-hygiene.yml
  • CONTRIBUTING.md
  • docs-site/src/content/docs/contributing/pr-quality.md

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the chore Maintenance, CI, tests, refactors, or build changes (not a user-facing bug or feature). label Aug 3, 2026
@lidge-jun
lidge-jun merged commit 08f7188 into dev Aug 3, 2026
6 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 04ccb7939a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +96 to +98
// Sponsorship is head-independent: it is about which surfaces the
// change touches, not about the state of a particular revision, so
// it is NOT cleared by the synchronize sweep above.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Revoke sponsorship when the head changes

When a sponsored PR receives a synchronize event, this deliberately preserves maintainer-sponsored, so an author can obtain sponsorship for one revision and then push unreviewed authentication, release, or workflow changes while the gate remains green. Clear the label alongside the other approvals or bind sponsorship to the reviewed head SHA so each security-sensitive revision receives explicit review.

AGENTS.md reference: .github/AGENTS.md:L5-L8

Useful? React with 👍 / 👎.

authorHasPushPermission: ["OWNER", "MEMBER", "COLLABORATOR"].includes(
pr.author_association,
),
changedFiles: files.map((file) => file.filename),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Classify both sides of restricted-file renames

The listFiles response places the old side of a rename in previous_filename, but only the new filename is passed to the sponsorship classifier. Renaming src/oauth/store.ts to an unrestricted path therefore bypasses sponsorship even when the PR also rewrites that authentication code; collect both names, as assessHygiene already does for rename-sensitive checks.

AGENTS.md reference: AGENTS.md:L199-L205

Useful? React with 👍 / 👎.

Comment on lines +24 to +27
const RESTRICTED_PREFIXES = [
".github/workflows/",
"src/oauth/",
];

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Include all credential-handling files in the gate

This allowlist does not cover the credential-handling scope advertised by the check and documentation: for example, src/providers/api-keys.ts persists provider secrets and src/codex/account-store.ts persists and refreshes access/refresh tokens, yet neither matches these prefixes nor appears in RESTRICTED_FILES. A contributor can change either file without sponsorship, so the classifier needs to include the actual credential stores and handlers rather than only selected auth filenames.

AGENTS.md reference: AGENTS.md:L199-L205

Useful? React with 👍 / 👎.

labels = [],
}) {
// A maintainer's own change carries its own sponsorship.
if (authorHasPushPermission) return [];

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Require independent sponsorship for maintainer-authored changes

Returning here exempts every push-capable author's PR before its restricted paths are inspected, treating the author's own review as sponsorship. MAINTAINERS.md:30-34 explicitly disallows authors approving their own PRs and separately requires security review for these surfaces, so maintainer-authored authentication or workflow changes receive no visible security-review gate; require sponsorship from a distinct maintainer instead.

AGENTS.md reference: .github/AGENTS.md:L5-L8

Useful? React with 👍 / 👎.

Comment on lines +60 to +63
function hasSponsorship(labels) {
return (labels || []).some(
(label) => (typeof label === "string" ? label : label?.name) === "maintainer-sponsored",
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Verify that the label was applied by a security reviewer

hasSponsorship trusts only the label name and discards who applied it, so any repository user with label permission can satisfy the security-review gate. This includes writers outside the deliberately narrow security ownership listed in MAINTAINERS.md:98-101, allowing them to sponsor another contributor's authentication, Actions, or release change; validate and persist an authorized labeling actor or derive the verdict from an eligible review instead.

AGENTS.md reference: .github/AGENTS.md:L5-L8

Useful? React with 👍 / 👎.

Comment on lines +43 to +46
- **Cross-platform CI.** The suite runs sharded on Linux and in full on macOS for
every pull request. Windows runs at the shipping boundary — on promotion to
`main` or `preview` — so a slow or flaky Windows runner cannot decide when your
pull request turns green.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Synchronize the existing contributor CI documentation

This new page says Windows runs only at the shipping boundary, while docs-site/src/content/docs/contributing.md:66-70 still tells contributors that pull-request CI has Linux, Windows, and macOS coverage plus a second three-OS lane. The contradictory canonical English pages leave authors unsure whether a PR was tested on Windows; update the existing contributing page alongside this new description so both match ci.yml.

AGENTS.md reference: docs-site/AGENTS.md:L7-L10

Useful? React with 👍 / 👎.

@lidge-jun
lidge-jun deleted the codex/ci-governance-consolidated branch August 3, 2026 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Maintenance, CI, tests, refactors, or build changes (not a user-facing bug or feature).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant