Skip to content

fix(pr-pipeline): stop check-trusted-trigger on a PR whose base is not the default branch - #9019

Merged
kyle-sexton merged 2 commits into
mainfrom
fix/trusted-trigger-default-base-8979
Oct 22, 2026
Merged

kyle-sexton merged 2 commits into
mainfrom
fix/trusted-trigger-default-base-8979

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

Closes #8979

Summary

check-trusted-trigger returned proceed: true for a pull request without checking its base branch. Lanes read the trusted-actor list and their scripts from the default branch, so only the default branch is a trusted base, and a listed author's PR stacked on another branch passed the gate.

Fix

  • evaluateTrigger now stops with a new reason, untrusted-base, when the PR's base.ref is not the event payload's repository.default_branch. It also stops when the payload has no default branch or the value fails the branch-name pattern. The check runs once, after the PR is resolved, so it covers pull_request, workflow_dispatch (fetched PR) and workflow_run (PR looked up from the run's head SHA) with no extra API call. It runs before the actor checks, so a stacked PR from an unlisted actor also gets untrusted-base.
  • untrusted-base is not in report-check-run/gate-skip-reasons.json, so the check posts failure, not neutral. decide.test.mjs gets a case that pins this.
  • The require-pr: false path (push, workflow_dispatch and issues without a PR) has no PR base, so the check does not apply there.
  • The three event fixtures now carry repository.default_branch, as real payloads do. Two existing tests that removed the default branch now expect untrusted-base, which the new check returns before the dispatcher and reconciler checks run.
  • The action README, action.yml and docs/conventions/pr-pipeline/pr-run-activity.md list the new reason, and a pr-pipeline changelog fragment records the fix.
  • The issue mentions a caller opt-out for other bases. It is not added, because no caller needs one: every lane runs the gate from the default branch tip.

Verification

  • Red first: before the implementation, the four new stop tests failed (stacked base on pull_request, missing default branch, workflow_dispatch and workflow_run with a non-default base). The matching-base test (default branch trunk, base trunk) passed.
  • After the change, node --test in .github/actions/check-trusted-trigger: 303 passed, 0 failed.
  • node --test in .github/actions/report-check-run: 100 passed. resolve-config/callers.test.mjs: 86 passed. check-signed-commits: 33 passed.
  • The pre-push check-affected hook passed after merging origin/main.

Related

🤖 Generated with Claude Code

kyle-sexton and others added 2 commits October 22, 2026 00:25
…t the default branch

Lanes read the trusted-actor list and scripts from the default branch, so
only it is a trusted base. A listed author's PR stacked on another branch
passed the gate. It now stops with untrusted-base on pull_request,
workflow_dispatch and workflow_run, as does a payload without
repository.default_branch. The reason has no skip mapping, so
report-check-run posts failure, not neutral.

Closes #8979

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton marked this pull request as ready for review October 22, 2026 04:31
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-22T04:32:56.046477Z 53063be Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 53063bee14ddb015b6b0449fc463e827f000e52a: 0 finding(s), 0 as inline comments.

No security findings in PR #9019 at head 53063be.

Scope: The PR adds an untrusted-base stop to check-trusted-trigger. When a PR's base.ref isn't the payload's repository.default_branch, the gate stops. The rest is docs, fixtures, tests and a changelog fragment. I read the diff and the changed gate code (check-trusted-trigger.mjs:742-829).

Logic:

  • The check sits after the fork and head/base SHA validation and before the denied-actor and actor checks. It runs on every pull_request, workflow_dispatch and workflow_run path that needs a PR, so no path skips it.
  • It fails closed: a missing or non-string default_branch, a value that fails the HEAD_REF pattern, or any base.ref mismatch all give proceed=false.
  • default_branch comes from the event payload's repository object, which GitHub populates. A PR author can't set it.
  • The gate only gets stricter. No allowlist, actor check or fork check is loosened.

Failure vs neutral:

  • report-check-run reads its skip reasons from a base-branch file, via readSkipReasons in report-check-run.mjs:91.
  • untrusted-base isn't in that list, so it posts failure, not neutral. The new decide.test.mjs case covers this.
  • Because the stop is a failure, a stacked PR can't pass as a neutral skip.

Manifests: No plugin manifests changed, so no manifest <field> lines apply.

Instruction surfaces: No standing instruction was deleted or softened. The changes to pr-run-activity.md and the action README add a rule and don't remove one.

Actions hardening: No workflow triggers, permissions or pins changed.

@github-actions

Copy link
Copy Markdown
Contributor

claude-review reviewed 53063bee14ddb015b6b0449fc463e827f000e52a: 0 finding(s), 0 as inline comments.

No findings. I read the full diff, the PR context and the surrounding evaluateTrigger code. I did not run the tests, so the PR's test counts are author-claimed and unverified.

Closing issue #8979

  • Criterion "A PR whose base is not the default branch stops with a named reason" is met. check-trusted-trigger.mjs:776-779 throws Stop("untrusted-base") after the PR is resolved. That covers pull_request, workflow_dispatch and workflow_run. New tests for all three events pin it.
  • Criterion "A PR into the default branch still proceeds" is met. The trunk/trunk test and the existing PROCEED tests, whose fixtures now carry default_branch, cover it.
  • Criterion "The PR's CI runs check-trusted-trigger.test.mjs, and it passes" has CI status I can't read from here. The test file is updated, and its pass count is author-claimed.
  • The issue's "unless a caller explicitly allows other bases" opt-out is deliberately not added. The PR body gives a reason: every lane runs the gate from the default branch tip.

Checks that came out clean

  • The new check runs after the base.sha validation, so pull.base is defined when pull.base.ref is read. A missing or non-string base.ref simply fails the equality and stops with untrusted-base.
  • gate-skip-reasons.json has no entry for untrusted-base, so report-check-run posts failure, not neutral. decide.test.mjs pins that.
  • The README, action.yml and pr-run-activity.md list the new reason. A search for untrusted-rerunner, the closest sibling reason, found no other file that enumerates the stop reasons.
  • The two existing tests that deleted default_branch now expect untrusted-base. The reconciler test also had to change its event source, since the old workflow-run fixture alone would have stopped earlier.
  • The changelog fragment's bump: patch fits a fix to a gate.

Manifest items: the diff touches no plugin.json or marketplace.json, so there are no manifest <field> lines.

Paved paths, path-scoped rules: nothing flagged.

@kyle-sexton
kyle-sexton added this pull request to the merge queue Oct 22, 2026
Merged via the queue into main with commit 1020e99 Oct 22, 2026
56 checks passed
@kyle-sexton
kyle-sexton deleted the fix/trusted-trigger-default-base-8979 branch October 22, 2026 04:40
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.

fix(ci): check-trusted-trigger proceeds on a PR whose base is not the default branch

1 participant