Skip to content

feat(ci): record why the pr-verify capture is blocked - #16459

Merged
kyle-sexton merged 5 commits into
mainfrom
feat/pr-verify-capture-blocked-cause
Nov 16, 2026
Merged

kyle-sexton merged 5 commits into
mainfrom
feat/pr-verify-capture-blocked-cause

Conversation

@kyle-sexton

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

Copy link
Copy Markdown
Member

Closes #16193

Summary

The pr-verify capture stays on pr-verify's API key for both its driver legs and its driven session (the owner's option A on #16193). What changes is what a capture the key cannot make says:

  • It records an advisory cause, credit-stop, empty-key, probe-handoff or unrecognized, each with its own reason. The cause informs an operator and gates nothing: the strip that keeps it the job's own runs after the head checkout. The fixed "subscription token cannot go behind the proxy (R41)" reason is gone.
  • The pull request's verdict (verdict.json evidence) carries that cause, and the verdict step annotates pr-verify capture::pr=<n> capture=blocked cause=<cause>.
  • A credit stop on the probe's key raises the handoff warning naming the pr-verify role's key and the run, in the annotations and the run summary.

Fix

  • .github/workflows/pr-verify-capture.yml
    • "Write the blocked capture" maps trusted inputs to a cause:
      • the credit read's held key → credit-stop, with a reason that names the credit-stop marker (forgeable by a same-repository workflow) and the run it names;
      • the next-leg call's reason credit-stop → credit-stop;
      • no-key → empty-key;
      • auth → probe-handoff;
      • any other value → unrecognized, job green, the value printed nowhere.
    • It now also runs when the credit gate holds the key off. That path still skips the resolver and every GitHub read (the API-budget cut from perf(ci): read the capture key's credit before the resolver #16416 stands). The capture is named from the event's pull request and head, and nothing is written when the event names none. Scan and upload key on the step's written output.
    • "Collect the capture" drops cause from the driven session's summary with jq, at the top level and inside capture, and removes its temporary file if jq fails.
    • "Report the key's handoff" names the run URL and also writes the line to the run summary. This is the same warning shape upstream-apply-changelog.yml and the other lanes raise on a key's credit stop, and the probe leg's lane-outcome record still carries the class. No new service, secret or permission.
  • .github/scripts/pr-verify/write-verdict.mjs
    • The writer accepts cause only in run-e2e's nested shape, the one the job writes, on a blocked capture and from CAUSES. A cause in the flat shape, or anything else off-schema, records the capture unreadable (blocked).
    • Evidence carries cause when the capture recorded one.
    • captureLine prints the outcome and cause from the closed lists only, never the reason text.
  • docs/conventions/pr-pipeline/README.md (Verifier verdict) and a .changes/pr-pipeline/ fragment describe the above.

Credential separation is unchanged

  • No change to bwrap arguments, the sandbox env allowlist, the key proxy or its config, the credential probes, "Check the driver legs hold no real key", any permissions: block, or which credential any leg uses.
  • The cause comes from the credit read (steps.credit.outputs.next-leg, origin-run) and the next-leg call (steps.next.outputs.next-reason). Both run before any head checkout, and each value is matched against a fixed list or a digit pattern before use.
  • Nothing the sandbox writes is echoed, written to $GITHUB_OUTPUT/$GITHUB_ENV, or interpolated. The collect step reads the sandbox summary as data with jq after the existing symlink and regular-file checks.
  • The gate-held path checks out no head code and runs no model. It writes the blocked summary, then the existing scan-upload step scans it before upload.

Verification

  • node --test --test-concurrency=4 ".github/scripts/pr-verify/*.test.mjs": 406 tests, 406 pass, 0 fail.
  • New and changed cases:
    • each cause with its own reason, plus the unknown-reason and no-PR paths;
    • the credit-held walk now records the blocked capture and still makes no GitHub read;
    • the collect step strips a forged cause;
    • the handoff warning names the role's key and the run, and writes the summary line;
    • the writer takes a listed cause, refuses an unlisted one or one on another outcome, and prints the annotation.
  • shellcheck on the three changed run blocks: clean.
  • actionlint stops on the pre-existing cache-mode job key, so it was not usable here.
  • Only a real Actions run can show:
    • the event payload's pull_requests[0].number on a gate-held run;
    • the artifact the judges then find;
    • the warning on a live credit stop.

Related

🤖 Generated with Claude Code

kyle-sexton and others added 2 commits November 15, 2026 17:05
The capture stays key-only on both legs. A capture the key cannot make
now records its cause, credit-stop, empty-key or probe-handoff, each
with its own reason, in place of the fixed "subscription token cannot go
behind the proxy (R41)" text. The cause comes only from the credit read
and the next-leg call; the collect step drops any cause from the driven
session's summary, and write-verdict accepts one only on a blocked
capture and only from that list.

While the credit gate holds the key off, the job still skips the
resolver and every GitHub read, and now uploads the blocked capture,
named from the event's pull request and head.

The verdict's evidence carries the cause, and the verdict step annotates
the capture outcome and cause. A credit stop on the probe's key raises
the handoff warning naming the pr-verify role's key and the run, also in
the run summary.

Closes #16193

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton kyle-sexton added the do-not-merge Hard merge gate: do not merge while applied. label Nov 15, 2026
@kyle-sexton kyle-sexton removed the do-not-merge Hard merge gate: do not merge while applied. label Nov 15, 2026
@kyle-sexton
kyle-sexton marked this pull request as ready for review November 15, 2026 22:09
@kyle-sexton kyle-sexton added the do-not-merge Hard merge gate: do not merge while applied. label Nov 15, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 15, 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-15T22:11:04.314669Z 0b5353d 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

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

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

Security review: PR #16459, incremental since 0b5353d6

No security issues found. I read every hunk of all 6 files in the incremental diff. The lane already reviewed an earlier head, so this review was blocking only: it reports only CRITICAL and IMPORTANT findings. Two of the changed files are on trusted paths, .github/workflows/pr-verify-capture.yml and .github/scripts/pr-verify/write-verdict.mjs, and I read the whole change in each.

Paths checked

Unknown next-leg reason now records cause=unrecognized

  • Before this change, an unknown reason made the step run exit 1. Now the step writes a blocked capture with fixed text (pr-verify-capture.yml#L1203-L1206).
  • $WHY is never put into the reason, the JSON or the log. The test confirms that limit-stop $(id) appears nowhere in the output, so there is no injection or workflow-command path.
  • The capture is blocked on both base and head. On the base, the failed step left no artifact, and find-capture's miss also produced blocked. The merge gate reads the same outcome, so no hold is weakened.

Credit-stop reason wording

  • Only the fixed text changed. ORIGIN_RUN still has to match ^[1-9][0-9]{0,19}$ before it goes into the reason.

Stripping a cause the driven session wrote

  • The jq filter now also deletes a top-level .cause (the flat shape), as well as .capture.cause (pr-verify-capture.yml#L1618-L1623).
  • If the strip fails, the temporary file is removed and blocked() runs. blocked() ends in exit 0 (L1588-L1594), so the mv is never reached on that path. This narrows what the driven session can pass through.

Writer reads a cause only from the nested shape

  • write-verdict.mjs now accepts the caused key set only when raw.capture is an object. A flat summary that carries a cause is recorded unreadable (blocked), which narrows what it accepts.
  • A cause still stands only on a blocked capture and only from CAUSES.
  • The captureLine annotation still prints only values from the closed lists.

The cause stays advisory

  • The docs say the head checkout could influence the cause. I searched for code that reads evidence.cause and found none outside the writer's own evidence and annotation.
  • A forged cause is limited to the closed list and never changes capture from blocked. It gates nothing.

Other notes

  • No permissions: block, token request, trusted-actor check, kill switch, merge-hold script or credential leg changed.
  • The PR context and prior-findings files contain no text that tells the lane what to do.
  • The diff removes no standing instruction.
  • No plugin manifest changed.
  • Spend: nothing changes model runs, turn limits or the schedule, and nothing can bill.

critical-findings: 0

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

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

Code review (incremental, blocking only): #16459, record why the pr-verify capture is blocked

No blocking findings. This lane already reviewed an earlier head (0b5353d6), so this pass reports blocking findings only. I read every hunk of all 6 files changed since then in .claude-lane/incremental.diff. I also read the unchanged code those lines depend on: the collect step's blocked() helper and the whole "Write the blocked capture" step in .github/workflows/pr-verify-capture.yml, plus fromE2eSummary and captureEvidence in write-verdict.mjs.

What I checked

  • The unrecognized cause. A next-leg reason outside credit-stop/no-key/auth used to fail the step. It now records cause=unrecognized with a fixed reason. $WHY never reaches the reason, the notice or the summary, and the new test asserts that with a $(id) payload. CAUSES and the writer test both add unrecognized, so the cause still gets through captureEvidence.
  • The flat-shape cause strip. The collect step's jq now also drops a top-level .cause. On a non-object summary, del(.cause) errors the same way the old .capture | type did, so no new failure mode. When jq fails, the temp file is removed before blocked(), and blocked() exits 0 before the mv (pr-verify-capture.yml#L1588-L1594). The stubbed-jq test checks both the blocked summary and that the temp directory is left empty.
  • The writer. captureEvidence now accepts the cause key set only when the raw summary is nested (write-verdict.mjs#L134-L138). A flat summary with a cause is now unreadable. The only flat producer, the CAPTURE_BLOCKED fallback at L131, never sets a cause, so no valid input is lost.
  • Reason wording. The credit-stop reason now names the marker instead of claiming a stop was observed. The workflow comments, the README section and the changelog fragment all describe the cause as advisory, consistently.

Notes

  • Closing-issue criteria: the earlier review found them met. This push adds a fourth cause and changes nothing that review relied on.
  • Author-claimed, unverified: test results. I ran no tests.
  • Cost: none.
  • I found no embedded instructions in the inputs I read.

Verifier dropped 0 of 0 candidates.

kyle-sexton and others added 2 commits November 15, 2026 17:17
…green

Security review fixes for the capture's blocked cause:

- The collect step strips `cause` from the top level as well as from
  `capture`, and write-verdict admits a cause only in the nested shape
  the job writes, so a driven session cannot forge one through the flat
  summary shape.
- The gate-held reason names the credit-stop marker that held the key
  off, since a same-repository workflow can forge that marker.
- A next-leg reason outside the known three records the cause
  `unrecognized` and keeps the job green; the reason itself is printed
  nowhere.
- The header and the README call the cause advisory: the strip runs
  after the head checkout, so it informs an operator and gates nothing.
- The strip removes its temporary file when jq fails.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton kyle-sexton removed the do-not-merge Hard merge gate: do not merge while applied. label Nov 15, 2026
@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 16, 2026
Merged via the queue into main with commit a42f369 Nov 16, 2026
119 of 123 checks passed
@kyle-sexton
kyle-sexton deleted the feat/pr-verify-capture-blocked-cause branch November 16, 2026 00:24
@github-actions github-actions Bot added the merge-path: owner-agent Post-merge accounting record (README.md, Merge paths) label Nov 16, 2026
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.

Give the capture the subscription and fallback legs the other Claude lanes have

1 participant