Skip to content

ci(evals): let compare runs use the subscription token on trusted PRs - #18505

Merged
kyle-sexton merged 3 commits into
mainfrom
ci/evals-compare-subscription
Nov 23, 2026
Merged

kyle-sexton merged 3 commits into
mainfrom
ci/evals-compare-subscription

Conversation

@kyle-sexton

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

Copy link
Copy Markdown
Member

Closes #18480

Summary

The org API key is off (CLAUDE_API_KEYS_DISABLED=true), so no compare run of pr-run-plugin-evals.yml can run and eval-held PRs such as #18356 cannot land. The owner decided ("Eval runs on a subscription token, case pruning, and how #18356 lands", 2026-11-23, architecture docs/owner-decisions.md, amending Q14 and Q53) that a compare run may use the maintenance subscription token, bounded. This PR adds that path and changes nothing on the API-key path.

Fix

  • pr-run-plugin-evals.yml: a dispatch-only credential input (api-key default, subscription). On subscription, compare-prepare runs check-trusted-trigger with pr-number: ${{ inputs.pr }}. That is the existing trusted-actor list and mechanism, and it refuses with untrusted-author unless the PR author is listed. Stop on an untrusted pull request author then fails the job before any arm patch is built. compare-before/compare-after get only the selected secret (inputs.credential != 'subscription' && secrets.MAINTENANCE_CLAUDE_API_KEY || '', the token likewise) and pass credential through. compare-prepare gains actions: read, which check-trusted-trigger needs to read the run's re-runner.
  • maintenance-measure-skill-edit-pass.yml: a credential input and a MAINTENANCE_CLAUDE_CODE_OAUTH_TOKEN secret. check-key-credit and run-eval skip on subscription. A new run-eval-subscription job runs on the token alone. scripts/sync-credential-legs.mjs renders that job from run-eval through the new declaration scripts/credential-legs/maintenance-measure-skill-edit-pass.mjs, and the --check test in callers.test.mjs holds it in sync. The job has no credit gate, no credit-stop marker and no fallback leg. ANTHROPIC_API_KEY is never set in it, and --no-publish and --max-cost-usd are unchanged. Its judge passes FALLBACK_READY: "true" to eval-handoff.mjs, so the token's limit, credit or auth stop counts as a stop: the pass uploads nothing and Stop at the token's stop fails with ::error::... no fallback leg runs. FALLBACK_CLAUDE_CODE_OAUTH_TOKEN stays unused.
  • lane-funding.json and the callers.test.mjs leg exemptions: the compare jobs and the pass now read the key and the token, and are exempt only from the fallback leg, with a reason ending in (docs/review/evals.md). The suite/label run-eval stays key-only.
  • docs/review/evals.md: the key-only line now states the subscription exception, its bounds and the owner decision.

The pass needs its own job rather than an expression-selected credential in run-eval, because callers.test.mjs forbids any step that references both Claude secrets.

Verification

  • node --test --test-concurrency=4 over .github/scripts/plugin-eval/*.test.mjs, .github/actions/resolve-config/callers.test.mjs, scripts/sync-credential-legs.test.mjs, .github/actions/check-kill-switch/check-kill-switch.test.mjs, .github/scripts/maintenance-measure-skill-edit/*.test.mjs, .github/actions/check-trusted-trigger/check-trusted-trigger.test.mjs and .github/scripts/pr-merge/release-eval-hold.test.mjs: 1082 pass, 0 fail. Earlier runs of the other suites that read these files (check-upstream-status, api-budget-coverage, live-config, trusted-actors, pr-merge/*, label-unblocked, check-label-sender.test.sh) also passed.
  • credential-legs.test.mjs now covers both credentials. Each credential input runs exactly one leg, the credit gate runs only for api-key, and CLAUDE_EVALS_DISABLED stops both. The truth table drives every token state and every launcher outcome through the subscription leg's stop condition, including limit-stop.
  • workflow.test.mjs covers the author refusal. It evaluates the author step's and the stop step's if: for both credentials, and checks that the refusal precedes Build the arm patches. It also runs check-trusted-trigger's evaluateTrigger on a dispatched compare: our login's PR and a listed bot's PR proceed, and an unlisted author's PR stops with untrusted-author. Each arm gets only the selected secret.
  • node scripts/sync-credential-legs.mjs --check: in sync. actionlint is clean on both workflows. zizmor --offline reports no findings. scripts/check-artifact-retention.sh matches 166 upload steps.
  • No eval was run and no workflow was dispatched.

Related

🤖 Generated with Claude Code

https://claude.ai/code/session_01UJUn7LPUb4rRDJ2JhJRGZf

kyle-sexton and others added 2 commits November 23, 2026 11:38
A compare dispatch of pr-run-plugin-evals.yml takes a credential input,
api-key (default) or subscription. On subscription, compare-prepare runs
check-trusted-trigger on the pull request and stops unless its author is
on the trusted-actor list, and both passes run on
MAINTENANCE_CLAUDE_CODE_OAUTH_TOKEN; the API key is not passed to them.

The measuring pass gains a run-eval-subscription job, rendered from
run-eval by sync-credential-legs.mjs: no key-credit gate, no credit-stop
marker, no fallback leg. Its limit, credit or auth stop ends the pass
with an error. api-key runs as before.

docs/review/evals.md states the rule and its bounds, citing the owner
decision that amends Q14 and Q53.

Closes #18480

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01UJUn7LPUb4rRDJ2JhJRGZf
@kyle-sexton
kyle-sexton marked this pull request as ready for review November 23, 2026 16:41
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 23, 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-23T16:44:12.989246Z 491e81e 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 150c0f7216d1dbb578f77ad31c45677e519b8dcf: read 13 of 13 changed file(s); 0 finding(s), 0 as inline comments.

Security review: PR #18505 (head 150c0f7)

No security issues found.

This PR lets a dispatched compare run of pr-run-plugin-evals.yml use the maintenance subscription token instead of the API key. I read every hunk of all 13 changed files. For the controls they touch, I also read compare-prepare's gates and compare-head.sh at head, and searched check-trusted-trigger.mjs for its fork and author checks.

Checks on the new subscription path

  • Who can start it. credential is a workflow_dispatch input only. On a workflow_run start, inputs.credential is empty, so the != 'subscription' expressions pass the API key and an empty token. compare-prepare runs only on dispatch from the default branch (L992-L995). Its existing step "Check the dispatcher is a trusted human" still refuses re-runs, the lanes bot and any unlisted dispatcher (L1040-L1064).

  • What content reaches the token. compare-head.sh requires the PR to be open, from this repository, into the default branch, and at exactly head-sha (L22-L29). On subscription, the new check-trusted-trigger step also requires the PR author to be on the trusted-actor list (untrusted-author is thrown at check-trusted-trigger.mjs L1039). The following stop step fails the job when proceed != 'true', so an empty or unreadable output also stops it. Both run before Build the arm patches (L1108-L1123). The arms need compare-prepare.result == 'success'. So the token reaches less PR text than the API key already did: the API-key path has no author check.

  • Exposure inside the leg. The new run-eval-subscription job keeps the same protections as the run-eval job it is rendered from:

    • the kill switch and CLAUDE_EVALS_DISABLED;
    • the managed-settings read denials and the policy probe, which fails if the credential appears in its output;
    • runner isolation and CLAUDE_CODE_SUBPROCESS_ENV_SCRUB: "1";
    • env -u ... CLAUDE_CODE_OAUTH_TOKEN on the classifier calls;
    • --no-publish and the 1-12 USD max-cost-usd check;
    • the credential scan before upload;
    • permissions: contents: read.

    No fallback token is read anywhere.

  • Token scope. The new actions: read on compare-prepare is a read scope of the job's GITHUB_TOKEN, used by check-trusted-trigger to read the run's re-runner. That job runs no PR code: it fetches the head only as git objects into .head. No App token request changes.

  • Other trust controls. The kill switch gets a new entry in its test map and is consulted by the new job. No merge hold is touched. No trusted-actor list, token broker or plugin manifest changes.

Spend (not a finding)

A credential: subscription compare run spends maintenance subscription plan usage instead of API-key credit, for two passes per dispatch.

critical-findings: 0

@github-actions

Copy link
Copy Markdown
Contributor

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

Code review: PR #18505, subscription-token compare runs

No blocking or advisory findings. I read every hunk of all 13 changed files in .claude-lane/pr.diff.

What I checked

  • Credential routing. The credential input exists only under workflow_dispatch. On a workflow_run start, inputs.credential is empty, so '' != 'subscription' holds and both arms get the key. They also pass credential: '' to the pass, which then runs check-key-credit and run-eval exactly as before. run-eval-subscription runs only on inputs.credential == 'subscription' and still honours CLAUDE_EVALS_DISABLED and the kill switch. The pass outputs run-eval-subscription.outputs.X || run-eval.outputs.X resolve to whichever leg ran. The only caller of maintenance-measure-skill-edit.yml passes no credential, so it keeps the default api-key.
  • Author gate. check-trusted-trigger with pr-number covers workflow_dispatch. Per its action.yml, it checks the actor, the PR author and the re-runner against the base-SHA list, refuses fork PRs, and always exits 0 with proceed. The stop step comes before Fetch the pull request's commits as data and Build the arm patches, and both arms need compare-prepare to succeed. A dispatch sent by github-actions[bot] is refused, because no dispatcher-run-id is passed. That is stricter, not looser.
  • Downstream. release-eval-hold.mjs trusts only the Compare Record job (L153). Nothing there depends on the pass's inner job names.
  • Closing issue ci(evals): let a compare run use the maintenance subscription token on our own PRs #18480, Done-when items:
    • A subscription compare runs both passes on the token and refuses any other author in compare-prepare: met. workflow.test.mjs tests it, including evaluateTrigger refusing with untrusted-author.
    • api-key behaves as today: met. The token secret is empty on that path, and credential-legs.test.mjs and callers.test.mjs cover it.
    • Tests cover both credentials and the refusal, and docs/review/evals.md states the rule: met.
    • All five Bounds hold in the YAML: dispatch only, opt-in, trusted author, --no-publish/--max-cost-usd/cases unchanged, and no fallback.
  • Verification. The test runs, --check sync, actionlint and zizmor results in the PR body are claimed by the author and unverified; this lane has no shell.

Loosened checks. The changed assertions all follow from the key-only eval credential rule and the compare jobs' secrets, which the closing issue's "Loosened checks" section names as loosenings with a reason:

  • callers.test.mjs: which jobs may read the token, and the pass's secrets.
  • workflow.test.mjs: OAUTH_TOKEN narrowed to FALLBACK_CLAUDE_CODE_OAUTH_TOKEN.
  • credential-legs.test.mjs truth table.
  • sync-credential-legs.test.mjs.
  • The leg and pin counts in eval-handoff.test.mjs and hill-climb-workflow.test.mjs.

So they pass. The LEG_EXEMPTIONS change narrows exemptions from [subscription, fallback] to [fallback], which is stricter. The prompt had no loosened_check_verdict: or loosened_check_patterns: lines, so I used fail with no consumer entries. It had no loosened_check_decision_record: line either, so I did not check the owner-decision citation requirement. Loosened checks would be marked: fail (bundled default); patterns: 0.

Spend (not a hold). A compare dispatched with credential: subscription spends maintenance subscription plan usage, capped per run by the list-price estimate --max-cost-usd.

Security. Trust-boundary questions are left to the dedicated security lane: whether dispatched head-sha matches the gated PR's head, and token exposure to PR plugin text.

Verifier dropped 0 of 0 candidates.

@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

The pr-verify verifier failed head 150c0f7216d1dbb578f77ad31c45677e519b8dcf. What it wrote, as data:

What it wrote (38 lines)
Summary: Issue #18480 asks for an opt-in, dispatch-only `credential: subscription` path for compare
  runs of pr-run-plugin-evals.yml. On the code side the diff delivers it. The default `credential`
  input is `api-key`. compare-prepare runs check-trusted-trigger against the main branch's
  trusted-actor list and stops before building any arm patch. Each compare arm gets only the secret
  that matches the input. A generated run-eval-subscription job in the measuring pass has no credit
  gate and no fallback leg, and keeps --no-publish, the max-cost-usd cap, the kill switch and
  CLAUDE_EVALS_DISABLED. Tests cover both credentials and the author refusal, and
  docs/review/evals.md states the new rule. When `credential` is empty (workflow_run, or the
  maintenance-measure-skill-edit.yml caller), the API-key path is unchanged. The Test Node and Test
  Bash jobs passed on the judged head
  (https://github.com/melodic-software/claude-code-plugins/actions/runs/45221296528/job/137858105108,
  https://github.com/melodic-software/claude-code-plugins/actions/runs/45221296528/job/137858104908).
  I found no correctness bug, no secret and no change to the takeover set: check-trusted-trigger is
  only called, not modified. It still fails for one reason. The diff loosens checks the issue itself
  lists as loosened: the key-only eval credential rule, the "no job reads a subscription token"
  assertion, the key-only leg exemptions and the funding test. A spec only authorizes a loosened
  check when it carries a line link (`docs/owner-decisions.md#L<line>`) to the owner's decision and
  the owner's words after `verbatim:` in double quotes. Issue #18480 links the whole
  owner-decisions.md file with no line anchor and quotes no verbatim words, so these loosenings go
  beyond what the spec authorizes. I saw no text trying to steer the reviewer.
- Issue #18480 body: this loosening is only authorized once the issue has a line link to the owner's
  decision (https://github.com/melodic-software/architecture/blob/<commit or
  main>/docs/owner-decisions.md#L<line>) and the owner's words after `verbatim:` in double quotes.
  It has neither: the link points to the whole file with no #L anchor, and there is no verbatim
  quote. Add both to the issue, or revert the loosened checks listed below.
- .github/actions/resolve-config/callers.test.mjs:10368: this replaces the assertion that no eval
  job reads a subscription token, and moves compare-before, compare-after and the pass's run-eval
  from evalKeyOnly to evalNoFallback (LEG_EXEMPTIONS near line 10835). That loosens a check without
  the owner-decision line link and verbatim quote. Keep the change only once issue #18480 has both.
- .github/scripts/plugin-eval/credential-legs.test.mjs:1: the key-only truth table now accepts a
  subscription leg. That loosens a check without the owner-decision line link and verbatim quote.
  Keep it only once issue #18480 has both.
- scripts/sync-credential-legs.test.mjs:220: the test now funds run-eval-subscription for the
  measuring pass instead of refusing it. That loosens a check without the owner-decision line link
  and verbatim quote. Keep it only once issue #18480 has both.
- docs/review/evals.md:72: the rule "No eval run uses a subscription token (Q14, Q53)" is relaxed.
  The citation should be a line link (owner-decisions.md#L<line>), not a link to the whole file, and
  the loosening must match an issue that has that line link and the owner's verbatim words.

This pull request leaves the merge queue, and ci-status holds it out while it carries pr-verify-failed. A pr-verify pass removes the label, at a new commit or at this same head: once a trusted person edits the body, and only trusted people have edited it since the fail, this head is judged again, so a fail on the body or the issues it links needs only the body fixed, no new commit.

@github-actions github-actions Bot added the pr-verify-failed pr-verify failed this head; a pass at a new commit, or after a trusted body edit, removes it. label Nov 23, 2026
@kyle-sexton
kyle-sexton removed this pull request from the merge queue due to a manual request Nov 23, 2026
@github-actions github-actions Bot removed the pr-verify-failed pr-verify failed this head; a pass at a new commit, or after a trusted body edit, removes it. label Nov 23, 2026
@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 23, 2026
Merged via the queue into main with commit 2525368 Nov 23, 2026
70 checks passed
@kyle-sexton
kyle-sexton deleted the ci/evals-compare-subscription branch November 23, 2026 19:08
@github-actions github-actions Bot added the merge-path: owner-agent Post-merge accounting record (README.md, Merge paths) label Nov 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Post-merge mutation testing

Killed 6, survived 1, timeout 0, no coverage 0, invalid 0, not run 0.
Covered-code score 86%; mutation score 86%.

File Killed Survived Timeout No coverage Invalid Not run
scripts/credential-legs/maintenance-measure-skill-edit-pass.mjs 6 0 0 0 0 0
scripts/sync-credential-legs.mjs 0 1 0 0 0 0

Surviving mutants

Location Operator Disposition Cause
scripts/sync-credential-legs.mjs:21 SBR productive input-gap

The run's summary has the full report.

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.

ci(evals): let a compare run use the maintenance subscription token on our own PRs

1 participant