Skip to content

fix(ci): hand an eval leg off when its suite ends auth_failed - #13699

Merged
kyle-sexton merged 2 commits into
mainfrom
fix/eval-auth-failed-handoff
Nov 6, 2026
Merged

kyle-sexton merged 2 commits into
mainfrom
fix/eval-auth-failed-handoff

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

Refs: #12035
Refs: #13586

Summary

#12035's re-run (https://github.com/melodic-software/claude-code-plugins/actions/runs/42172606678) ended partial (auth_failed) on the key leg, but the handoff classifier printed outcome=success, so the subscription leg never ran and the run went green with no result. The traces held no credential error, so the classifier had nothing to read.

Fix

  • eval-handoff.mjs also reads each suite's results.json. A suite with partial: true and partialReason: "auth_failed" counts as a refused credential, as a 401 already does: the key leg hands off, the subscription leg hands off when a fallback leg follows, and the fallback leg prints lane-class=auth outcome=failure. A stream that already handed off keeps its verdict.
  • Why hand off, not fail: the chain already hands off on a refused key (401/402) and an exhausted one, since the credential caused the stop and the next leg brings another. plugin-evals defines auth_failed as "your credential was rejected before or at the first run"; of the documented partial reasons (cost_ceiling, interrupted, auth_failed) only it is about the credential, and a test pins that the other two still print outcome=success.

Cause of the auth failure (not changed here)

Both failing sessions logged exit 1: Not logged in · Please run /login, a missing credential rather than a rejected one. https://code.claude.com/docs/en/env-vars says CLAUDE_CODE_SUBPROCESS_ENV_SCRUB removes ANTHROPIC_API_KEY from "the subprocesses Claude Code starts" while "The Claude Code process keeps the credentials for its own API calls"; https://code.claude.com/docs/en/plugin-evals runs each case "as a claude -p child process". The probe step in the same job authenticated with the same key under the scrub five seconds earlier, so a revoked key is ruled out. Turning the scrub off on the eval step is a credential-control decision and is not made here; until then the key leg hands off and the subscription leg runs the eval. UNVERIFIED: local reproduction (the CLI refused: too many linked worktrees on this host's checkout).

Verification

  • node --test in .github/scripts/plugin-eval: 108 pass, 0 fail; .github/actions/resolve-config: 929 pass, 0 fail; scripts/check-affected.sh: 9 passed. Disabling the new check makes the two new tests fail.

Follow-ups

  • Pre-existing (advisory): a fallback leg's outcome=failure reaches report-lane-outcome (ci-workflows), which annotates with core.error but calls setFailed only on a wiring error, so the job may still end green (UNVERIFIED on a live fallback failure).

🤖 Generated with Claude Code

kyle-sexton and others added 2 commits November 6, 2026 07:36
A `claude plugin eval` suite whose credential is refused writes
`partial: true, partialReason: "auth_failed"` and exits 2, and its runs
can hold no trace the classifier reads as an auth stop. eval-handoff.mjs
judged only traces, so such a key leg printed `outcome=success`, the
subscription and fallback legs were skipped, and the run went green.

The leg now reads each results file too. An auth_failed suite counts as
a refused credential, the same rule a 401 follows: the key leg hands off,
the subscription leg hands off when a fallback leg follows, and the
fallback leg reports `lane-class=auth outcome=failure`. A stream that
already handed off keeps its verdict; cost_ceiling and interrupted
partials are not the credential's stop and are left alone.

Refs: #12035

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton marked this pull request as ready for review November 6, 2026 12:40
@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

PR body contract — issue linkage

This PR body does not yet satisfy the issue-linkage contract:

  • Missing a "## Related" section. List related PRs, ADRs, or decision-log entries this PR does not close.

Edit the body and this comment updates itself on the next run.

@github-actions github-actions Bot added the needs-issue-linkage Pull request body has no issue linkage line; set by the check-contract step, advisory. label Nov 6, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

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

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-06T12:40:46.575676Z
We couldn’t complete this review. Comment @codex review to try again.
02df44f 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

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

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

Security review: PR #13699 (head 02df44f)

No security issues found. I read every hunk of both changed files (.github/scripts/plugin-eval/eval-handoff.mjs and its test) and the whole head file of eval-handoff.mjs. Neither file matches a trusted-path glob.

What changed. The new function withPartials (eval-handoff.mjs#L111-L115) reads each suite's results.json that main already parsed. When a suite has partial: true and partialReason: "auth_failed", the leg's verdict is now treated as a refused credential (status 401). That verdict goes through the existing handoffReason rule, so it adds no new handoff path:

  • The key leg hands off.
  • The subscription leg hands off only when FALLBACK_READY is true.
  • The fallback leg never hands off; it now reports outcome=failure where it used to report a false success.

Paths I checked:

  • Can untrusted input trigger it? The partial and partialReason fields sit at the top level of the results file that the plugin-evals harness writes. The run traces this script already passed to the classifier are more open to influence than these two fields. Even a forced auth_failed gets only what a 401 in a trace already gets: the next credential leg runs. That leg is configured by the workflow, not by this script.
  • Does it widen anything? It changes no token scope, trusted actor, kill switch or merge hold. No new text reaches a credentialed lane: the new code only compares two fields and never passes their contents on. File paths still come from the RESULTS environment variable, as before.
  • Is any verdict weakened? A stream that already handed off keeps its verdict (L112). The cost_ceiling and interrupted partial reasons leave the verdict unchanged. The change makes the result stricter: an auth_failed run can no longer read as success.

What it spends: an auth_failed key leg now hands off, so the subscription leg (and possibly the fallback leg) runs the eval. That uses subscription usage that was skipped before. It is not a billing change.

PR context: I found no embedded instructions in the PR description or the closing issues.

critical-findings: 0

@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

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

Code review: no findings

I read every part of the change in both files: .github/scripts/plugin-eval/eval-handoff.mjs and eval-handoff.test.mjs. I also read the whole head version of eval-handoff.mjs to check the new code against the existing handoffReason, judgeLegStreams and main.

What changed. A new function, withPartials, runs after the stream classifier. When a suite's results.json says partial: true with partialReason: "auth_failed", and no stream has already handed off, the leg is judged as a refused credential. It calls handoffReason(leg, "auth", 401, { fallbackReady }), so:

  • the key leg hands off;
  • the subscription leg hands off only when FALLBACK_READY is true;
  • the fallback leg never hands off and prints lane-class=auth outcome=failure.

The other partial reasons, cost_ceiling and interrupted, leave the streams' verdict as it was. A null result, from an unreadable file, is skipped safely through result?.partial.

Correctness checks (I read these myself; I ran nothing):

  • handoffReason returns "" for the fallback leg and for a subscription leg without fallbackReady. So a leg that does not hand off still gets laneClass: "auth", and main turns that into outcome=failure. This fixes the false green described in the PR.
  • When a stream has already handed off, its verdict is kept (line 112).
  • The CLI test passes no PROBE, and its trace path is /absent/..., so no stream is ever judged. The test therefore covers the case the fix targets: runs that left no trace to read.
  • Tests cover all three legs, both other partial reasons, a non-partial result, a null result, and the rule that an earlier stream handoff stands.

Closing issue. The PR body only says Refs: #12035 and Refs: #13586; it closes no issue. So there were no acceptance criteria to check.

Rules and paved paths. None of the .claude/rules/ files has a paths: glob that matches the changed files. No plugin manifest changed.

Author-claimed and not checked by me: the node --test results (108 pass and 929 pass) and the claim that removing the new check makes the two new tests fail.

Usage (not a finding): a key leg whose suite ends auth_failed now hands off, so the subscription leg also runs the eval. That uses more subscription usage per affected run.

@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 6, 2026
Merged via the queue into main with commit f1fffa4 Nov 6, 2026
67 of 68 checks passed
@kyle-sexton
kyle-sexton deleted the fix/eval-auth-failed-handoff branch November 6, 2026 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-issue-linkage Pull request body has no issue linkage line; set by the check-contract step, advisory.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant