Skip to content

feat(pr-pipeline): accept native stack layers that target main - #15400

Merged
kyle-sexton merged 9 commits into
mainfrom
feat/pr-pipeline-accept-stack-layers
Nov 11, 2026
Merged

kyle-sexton merged 9 commits into
mainfrom
feat/pr-pipeline-accept-stack-layers

Conversation

@kyle-sexton

@kyle-sexton kyle-sexton commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

No related issue: implements owner decision Q40 (2026-11-11) on stacked PRs directly.

Summary

The lanes now accept a PR that is a layer of a native GitHub stack when the stack's base (pull_request.stack.base.ref) is the default branch. Every lane script, action, config and list still loads from the default branch, never from the layer's base branch, so no unmerged code runs with lane credentials. The trust property moves from "the PR targets main" to "lane code is read from main".

Fix

  • .github/actions/check-trusted-trigger/check-trusted-trigger.mjs: new trustedBaseSha. A PR into the default branch keeps its base.sha; a stack layer whose stack.base.ref is the default branch outputs stack.base.sha (a main commit) as base-sha, never base.sha (the lower layer's unmerged head). Anything else stops untrusted-base, as before. The workflow_run GraphQL fallback carries no stack, so a layer read through it fails closed. A new output, pr-base-sha, keeps the PR's own base.sha as a diff base only, never checked out.
  • .github/workflows/pr-review-main.yml: the trigger output and the three legs' GATE_BASE read pr-base-sha, so a layer's review diffs against the layer below and reads that layer's change alone (Codex review finding).
  • .github/actions/check-trusted-base/action.yml: accepts base.ref == default or stack.base.ref == default (event field on pull_request, REST read otherwise), then still fails unless the gated SHA is an ancestor of the default branch before checking it out.
  • .github/workflows/pr-require-checks.yml (ci-status, "Resolve the hold config's commit"): a stack layer into main reads merge-holds.mjs, the trusted-actor list and the hold config at the main tip. Before, any PR into a non-default branch read them at the event's base.sha, which for a layer is the unmerged layer below. When the tip read fails, a layer falls back to stack.base.sha and fails red when the event names none (claude-review finding, 788d544); a PR into main keeps its own base SHA as the fallback.
  • Docs: ADR 0055 addendum with the sandbox evidence, pr-run-activity.md step 4 and the stacked-PR paragraph, the gate README and output description, a pr-pipeline changelog fragment.

Audit of base reads (no change needed):

  • Every other .base checkout in the PR lanes uses the default-branch tip (steps.tip.outputs.sha) or the gate's base-sha through check-trusted-base (pr-run-activity-read.yml:954-961, pr-run-activity-write.yml:838-845); collect-base-activity copies from that checkout.
  • Review lanes (pr-review-hosted.yml:95, :173, :274; security lane alike) and pr-merge.yml (:195, :1034, ...) check out the main tip.
  • pr-review-main.yml:1705, :2622 (matrix.base) is fed from the main checkout's SHA.
  • eval-browser-dispatch.yml:375 and ci-status's cost-hold compare (pr-require-checks.yml:5609) use the event base SHA only as a diff base; code runs from .base.
  • pr-unblock.yml:268-288 resolve-conflicts already declines a PR whose base is not the default branch, so main is never merged into an upper layer.

Verification

Sandbox evidence, melodic-software/pr-pipeline-sandbox stack 329 (layers #327, #328), created with gh stack link (gh-stack v0.3.0):

Tests (TDD, each new case red before the change):

  • node --test .github/actions/check-trusted-trigger/check-trusted-trigger.test.mjs: 484 pass. New: layer with stack base main proceeds with base-sha = stack base SHA (pull_request, workflow_dispatch, workflow_run); stack base release/x refused on all three; malformed stack base SHA refused; a bottom layer into main keeps its own base SHA. Existing controls kept: non-stack PR on feat/stack-parent refused on all three events.
  • node --test .github/actions/check-trusted-base/check-trusted-base.test.mjs: 15 pass. New: layer accepted and the stack base SHA checked out; a layer whose base SHA is the lower layer's head fails "not on the default branch" with nothing checked out (scripts never load from the layer base); stack into another branch refused; default-tip accepts a layer and checks out the tip; workflow_dispatch reads the stack base from the PR (main accepted, other refused, none refused).
  • node --test .github/scripts/pr-merge/ci-status-hold-ref.test.mjs (new): 7 pass. A layer reads the tip, not the layer below; on an unreadable tip a layer falls back to the stack base SHA, or fails with none; a PR into main falls back to its own base; a non-stack PR into another branch and a stack into another branch keep the event base. Each layer case fails against the old step.
  • node --test .github/scripts/pr-review-main/workflow.test.mjs: pass; the trigger output and every leg's GATE_BASE read pr-base-sha.
  • actionlint .github/workflows/pr-require-checks.yml: clean.

Related

Follow-ups

🤖 Generated with Claude Code

https://claude.ai/code/session_01VQb9Q2ceZLXhTR4d1vkTCe

kyle-sexton and others added 3 commits November 11, 2026 12:36
Owner decision Q40: a layer of a native GitHub stack runs its lanes when
the stack's base (pull_request.stack.base.ref) is the default branch.
Lane scripts, actions, config and lists still load only from the
default branch, never from the layer's base branch.

- check-trusted-trigger accepts such a layer and outputs the stack
  base's SHA as base-sha, never the lower layer's unmerged head.
- check-trusted-base accepts the layer and still fails unless that SHA
  is on the default branch.
- ci-status reads its hold config at the default branch tip for such a
  layer instead of the event's base SHA (the layer below).
- ADR 0055 addendum, pr-run-activity.md, the gate README and the
  pr-pipeline changelog record the new rule and the sandbox evidence.

Co-authored-by: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VQb9Q2ceZLXhTR4d1vkTCe
The pr-pipeline convention releases from fragments, so the hand
CHANGELOG entry moves to .changes/pr-pipeline/.

Co-authored-by: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VQb9Q2ceZLXhTR4d1vkTCe
@kyle-sexton
kyle-sexton marked this pull request as ready for review November 11, 2026 17:39
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-11T17:41:46.391270Z ee8e484 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.

@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: ee8e484cb3

ℹ️ 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".

The gate's base-sha for a stack layer is the stack base on main, which
lanes check out. pr-review-main also used it as the review's diff base,
so a layer's review read every unmerged layer below it. A new gate
output, pr-base-sha, carries the PR's own base.sha as a diff base only,
and pr-review-main's trigger and legs read it.

Co-authored-by: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VQb9Q2ceZLXhTR4d1vkTCe
@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed 8a4c39b84c07274870f079f3494acbc47add7a5d: read 13 of 13 changed file(s); 0 finding(s), 0 as inline comments.

Code review (blocking only): accept native stack layers that target main (#15400)

Scope: full diff, all 13 changed files, every hunk read. This lane already reviewed an earlier head, so this review reports blocking findings only.

Result: no blocking findings.

Prior finding, now fixed. The earlier finding (prior post) was that when ls-remote failed, a stack layer's hold config fell back to pull_request.base.sha, which is the unmerged layer below. At this head, the "Resolve the hold config's commit" step handles a layer differently (pr-require-checks.yml:5287-5305):

  • It falls back to STACK_BASE_SHA (pull_request.stack.base.sha).
  • It fails with exit 1 when that SHA is not 40 hex.
  • ci-status-hold-ref.test.mjs tests both cases ("falls back to the stack base SHA, never the layer below" and "unreadable tip and no stack base SHA fails").

What I checked:

  • check-trusted-trigger.mjs trustedBaseSha:
    • A PR into the default branch keeps base.sha.
    • A layer gets stack.base.sha only when stack.base.ref is the default branch and the SHA is 40 hex.
    • Anything else returns "", so the gate stops with untrusted-base.
    • pr-base-sha is added both to the proceed output and to stopped().
  • check-trusted-base/action.yml:
    • On workflow_dispatch, the jq (.stack.base.ref // "") prints an empty second line for a PR outside any stack, so stack_base_ref is empty and the PR is refused.
    • The ancestry check still runs on the SHA the gate passed, so the lower layer's head can never be checked out. The test with sha.D covers this.
    • The script has no set -u, so the older tests that leave EVENT_STACK_BASE_REF unset still run correctly.
  • pr-review-main.yml:
    • pr-base-sha now reaches the trigger output and all three legs' GATE_BASE.
    • Downstream it is used only as the diff base in Write the diff (git fetch plus write-diff.py, run from .base) and as base_sha in write-verdict.mjs, which only checks it is well-formed.
    • Code still runs from .base at main, so nothing is checked out from the layer below.

Known gaps the PR leaves to follow-ups (not findings): the run-activity lanes still diff a layer against base-sha (the stack base), so their diff includes the lower layers' changes. The merge lane and issue lane for layers are also not handled yet. The PR lists both under #15410.

Settled threads: the thread at check-trusted-trigger.mjs:1460 stays settled; its lines have not changed since it was resolved.

Closing issue: none. The PR implements owner decision Q40 directly, so there are no acceptance criteria to check.

Manifests: no .claude-plugin manifest changed. The changelog fragment's bump: minor matches a new capability.

Spend: none.

Verification: I ran nothing. The test counts and sandbox runs in the PR description are the author's claims and I have not verified them.

I found no embedded instructions in the PR context, the settled-threads file or the prior-findings file.

…ckage

plan-test-lanes refused .github/scripts/pr-require-checks/, which no
Node package in the test-node lane holds. The pr-merge package already
tests pr-require-checks.yml and takes every workflow as a trigger.

Co-authored-by: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VQb9Q2ceZLXhTR4d1vkTCe
@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 8a4c39b84c07274870f079f3494acbc47add7a5d: read 13 of 13 changed file(s); 0 finding(s), 0 as inline comments.

Security review: PR #15400 at 8a4c39b8

I found no security issues. I read every hunk of all 13 changed files in .claude-lane/pr.diff. The prior-findings file says blocking only: yes, so this review reports only CRITICAL and IMPORTANT findings. None came up, so no SUGGESTION was dropped.

critical-findings: 0

Trust controls I read

check-trusted-trigger (check-trusted-trigger.mjs#L1379, #L1468-L1480)

  • The base check now accepts one more PR shape: a layer whose pull.stack.base.ref is the default branch.
  • It does not widen who is trusted:
    • The fork, actor, re-runner, author and denied-id checks are unchanged.
    • The trusted-actor list and the scripts are still read at a default-branch commit.
  • For a layer, base-sha becomes stack.base.sha, which must be 40 hex. It is never the lower layer's unmerged head.
  • The stack record comes from GitHub (the event payload, the REST pull, commits/{sha}/pulls), not from text the PR author controls.
  • The new pr-base-sha output is used only as pr-review-main's diff base. Code there still comes from .base at main.

check-trusted-base (action.yml#L62-L66)

  • It accepts base.ref == default or stack.base.ref == default.
  • It still requires merge-base --is-ancestor "$BASE_SHA" origin/$DEFAULT_BRANCH before any checkout. A layer whose gated SHA is the lower layer's head fails, and the test at L95-L101 covers that case.
  • On REST reads, .stack.base.ref // "" gives an empty string when there is no stack, so the check fails closed.

ci-status hold-config ref (pr-require-checks.yml#L5287-L5306)

  • This narrows what the PR author can influence. A stack layer now reads merge-holds.mjs, the trusted-actor list and the hold config at the main tip. Before, it read them at base.sha, the lower layer's unmerged head.
  • If the tip read fails, a layer falls back to stack.base.sha (hex-checked). With no stack base SHA, the step exits 1, so it fails closed.
  • This weakens no merge hold.

Merge lane. Layers stay out of it: enable-auto-merge.mjs lists only baseRefName: "main" PRs (L295). Admitting layers does not let the lanes merge into an unmerged branch.

Untouched controls. The diff does not touch the token request or broker, the kill switch, permissions: blocks, or the merge-hold scripts.

Other checks

  • Instruction surface. The pr-run-activity.md, ADR 0055 and README edits describe the code change. They delete no model-facing guardrail, and the code enforces the rule they describe, which I judged above. I did not consult the instruction exception register's protected-class list.
  • Plugin manifests. None are touched, so there are no manifest lines.
  • Spend. Lane runs (review, unblock, run-activity) now also run on native stack layers into main. That uses prepaid API credits only; it is not a hold or a finding.

Prior findings and settled threads

  • This lane's earlier summary comment had no findings, so nothing needed reposting.
  • The settled thread on check-trusted-trigger.mjs L1460 (pr-review-main's diff base, fixed in efdfa4aa, lines unchanged since) stays settled. I did not raise it again.

Embedded text

None of the lane input files I read (PR context, settled threads, prior findings, diff) contained instructions aimed at the review lane.

kyle-sexton and others added 4 commits November 11, 2026 13:13
The link checker reads the stack page as 404 without a session; the
layer PR and run links beside it carry the evidence.

Co-authored-by: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VQb9Q2ceZLXhTR4d1vkTCe
When ci-status cannot read the default branch tip, a stack layer fell
back to its event base SHA, the unmerged layer below, and read
merge-holds.mjs and the hold config there. It now falls back to
pull_request.stack.base.sha, a default-branch commit, and fails red
when the event names none. A PR into the default branch keeps its own
base SHA as the fallback.

Co-authored-by: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VQb9Q2ceZLXhTR4d1vkTCe
@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 11, 2026
Merged via the queue into main with commit 2ef1dab Nov 11, 2026
67 checks passed
@kyle-sexton
kyle-sexton deleted the feat/pr-pipeline-accept-stack-layers branch November 11, 2026 19:25
@github-actions github-actions Bot added the merge-path: owner-agent Post-merge accounting record (README.md, Merge paths) label Nov 11, 2026
kyle-sexton added a commit that referenced this pull request Nov 11, 2026
Take #15400's pr-run-activity.md paragraph (native stack layers into
the default branch run their lanes), keeping this branch's step 3
correction for every other non-default base. Update stacked-prs.md to
match: the review and run lanes accept such a layer, the merge and
issue lanes do not yet (#15410), so unattended lanes still do not
stack. Drop the #when-to-stack heading anchors (Codex review).

Co-authored-by: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VQb9Q2ceZLXhTR4d1vkTCe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-path: owner-agent Post-merge accounting record (README.md, Merge paths)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant