Fail the bump fast on a bad Claude token - #298
Conversation
The third end-to-end run reached the repair stage and every one of the 99 jobs failed with: Failed to authenticate. API Error: 401 OAuth access token is invalid. Discovering that cost a full ~40-minute probe build plus 99 doomed jobs, which is how three consecutive runs were spent. A one-minute round-trip before the fan-out turns that into an immediate, unambiguous failure. The preflight gates only the paid stage and runs in parallel with pin and probe, so the free breakage report is still produced when the token is bad -- that half of the workflow does not depend on Claude at all.
| - name: Explain a failure | ||
| if: failure() | ||
| run: | | ||
| echo "::error::CLAUDE_CODE_OAUTH_TOKEN is invalid or expired." \ | ||
| "Regenerate it with \`claude setup-token\` and update the secret," \ | ||
| "then verify with the Claude auth check workflow." |
There was a problem hiding this comment.
Error message assumes auth is always the failure cause
The ::error:: annotation unconditionally tells the operator to regenerate the token, but the claude-code-action step can fail for reasons other than a 401 — for example, a malformed or unrecognised --model value returns a 4xx that is not an auth error. An operator following this message would regenerate a perfectly valid token and still see the same failure. Distinguishing "probable auth error" from a broader "Claude action failed" would make the diagnostic less misleading in those edge cases.
Greptile SummaryThis PR adds an
Confidence Score: 4/5Safe to merge — the gating logic is correct and the only change is adding a fast preflight that makes existing auth failures surface earlier. The workflow change is small and well-scoped. The auth → repair dependency chain behaves correctly: a failed auth blocks repair via GitHub Actions' implicit dependency skipping, while a skipped auth (when repair=false) cannot trigger repair because repair's own if condition guards on needs.detect.outputs.repair == 'true'. The one minor issue is that the Explain a failure error annotation unconditionally attributes failures to a bad token, when the action could also fail for other reasons (e.g. an unrecognised model name), potentially sending the operator on a wild-goose chase. Files Needing Attention: Only .github/workflows/mathlib-bump.yml changed; the failure-annotation message on lines 155–157 is worth a second look.
|
| Filename | Overview |
|---|---|
| .github/workflows/mathlib-bump.yml | Adds an auth preflight job that validates the Claude OAuth token before the costly repair fan-out; repair now lists auth in its needs array so a bad token blocks it immediately. One minor concern: the Explain a failure step's error annotation unconditionally blames a bad/expired token, but the action can also fail for non-auth reasons (e.g. an unrecognised model name), which would produce a misleading diagnostic. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
detect[detect\nIs there a new release?]
auth[auth\nPreflight Claude auth\nNEW]
pin[pin\nMove pins & plan shards]
probe[probe\nBuild shards in parallel]
triage[triage\nMerge logs → breakage map]
repair[repair\nOne Claude job per broken project]
assemble[assemble\nApply patches & open draft PR]
detect -->|found=true & repair=true| auth
detect -->|found=true| pin
detect -->|found=true| probe
pin --> probe
probe --> triage
auth -->|must succeed| repair
triage -->|has_breakage=true & repair=true| repair
detect --> repair
triage --> assemble
pin --> assemble
repair --> assemble
style auth fill:#d4edda,stroke:#28a745,color:#000
Reviews (1): Last reviewed commit: "Fail the bump fast on a bad Claude token" | Re-trigger Greptile
The canary from #297 gave a definitive answer in one minute:
Every one of the 99 repair jobs was failing on that. Discovering it cost a full ~40-minute probe build plus 99 doomed jobs — which is how three consecutive end-to-end runs were spent.
This adds the same one-minute round-trip as a preflight to
mathlib-bump.yml. It gates only the paidrepairstage and runs in parallel withpin/probe, so a bad token still produces the free per-project breakage report — that half of the workflow doesn't touch Claude at all.Everything else in the pipeline is now confirmed working end to end:
detect→pin→ 10 probe shards →triage→assemble, which opened draft #295 with an honest "0 repairs applied" summary.