Repository navigation
ci(claude): name a capped review bot instead of "review failed" - #4126
Conversation
When the review bot hit the Anthropic weekly cap, the pr-review lane went red with "Claude produced no review" and a warning blaming an upstream install crash — the same two lines a genuinely broken review emits. Authors and the fleet spent days pulling job logs to find out which it was. The lane now classifies the run from claude-code-action's execution_file and gives each verdict its own named step, so the checks list carries the cause: a run that reached a model always bills tokens into modelUsage, so is_error with an empty usage map means the request was refused before any model work. The verdict keys on those numbers, never on the rejection wording — the text quotes a reset date that moves, embeds a U+00B7, and in both observed cases (#4119, #4120) was absent entirely. Wording only narrows an outage the numbers already established, to name the budget case specifically. It still fails. An outage that renders as a pass is how 50 PRs merged unreviewed; the goal is a legible red, not a green. The detection has to live in workflow YAML: pull_request_target checks out the untrusted fork tree with secrets in scope, so this file may not run a script from that tree. The tests execute the step's real `run:` body against captured execution logs instead, and skip where bash or jq is unavailable.
|
The safety note this PR rewrites is 46 action versions out of date, which quietly voids the one check it asks future bumpers to perform. The header caveat still says the The good news is the mechanism is fine and you can say so with evidence rather than a re-test: today's runs on v1.0.230 still produce 🔍 Technical details
Evidence that the output survived the bump: PR #4124's {"type":"result","subtype":"success","is_error":true,"duration_ms":461,
"num_turns":1,"total_cost_usd":0,"permission_denials_count":0,"modelUsage":{}}That is also a live confirmation of this PR's classifier: empty Suggested edit is just the two comment lines — bump |
Offline replay — this PR's CI structurally cannot exercise this change
It got all 25 right. The 17 spend-cap jobs are now named as a budget outage instead of "the review failed", the 7 genuine reviews still read as successes, and one job that had been lumped in with the outage turns out to be a third cause entirely — a GitHub API rate limit that killed the action before Claude started. The case that mattered most is the second disguise — the ~36s jobs whose annotation reads "the action crashed or errored before completing (often the upstream install-phase ENOENT flake)". That wording was never true: those jobs reached the CLI, got refused, and saved an execution log. They now classify as a budget outage, and ENOENT is only named when there is genuinely no log. One honest caveat, and it is a wording issue rather than a misclassification: the no-log branch tells the reader to suspect the pinned action SHA, but PR #4105's log plainly said 🔍 Technical detailsMethod. Each archived job log was replayed through the Fidelity check. The reconstruction was validated against the runner's own live verdict: every job
Both disguises resolve to the same record, which is why one classification removes both: Emitted annotation for both: Still exits 1 on Why zero cost alone would have been wrong: a Claude subscription bills $0 per request, so cost cannot carry the signal by itself; the empty Scope limits worth stating. The 7 green runs are from an older window (PRs #3604–#3627) because no |
An offline replay of 25 archived pr-review jobs turned up a cause the no-log branch did not account for: PR #4105 (job 106596633316) died on `API rate limit exceeded for installation`, a GitHub API limit, with no execution log at all. The message told that reader the pinned claude-code-action SHA was the suspect, which is the wrong fix. Both causes are indistinguishable from inside the step — the action's own output is not reachable from a later step — so the message now names both and points at the failed `Run Claude` annotation, which does say which one. The headline the outage classification exists to deliver is unchanged: the review never ran, so the red says nothing about the PR.
|
The That leaves the gating, not the detection, as the open question. After this merges, a green One option, and it is your call: split the gate by classification rather than by caller.
That preserves your stated intent for the case where it is load-bearing, while the case that can only be a platform fault goes red everywhere. The contributor-noise cost looks cosmetic: 🔍 Technical detailsPayload, identical across {
"type": "result",
"subtype": "success",
"is_error": true,
"duration_ms": 385,
"num_turns": 1,
"total_cost_usd": 0,
"permission_denials_count": 0,
"modelUsage": {}
}Against Two smaller observations from the same logs:
|
A review bot that ran out of budget now looks different from a review that found problems. Until now both rendered the same:
pr-review / runwent red with "Claude produced no review" plus a warning blaming an upstream install crash, and the only way to tell a spend cap from a genuinely broken review was to pull the job log and read the CLI's raw result object. On #4119 and #4120 that was a weekly-cap rejection both times, and the lane said "the action crashed" — a cause that wasn't there.The lane still fails. That's the point: an outage that renders as a pass is how 50 PRs once merged unreviewed. What changed is that the red is now legible — each verdict gets its own named step, so the checks list carries the cause without opening a log.
🔍 Technical details
claude-run.ymlclassifies the run fromclaude-code-action'sexecution_fileintook/errored/not_started/no_output, and each gets its own named step.The outage gate keys on the CLI's own numbers, never on the rejection wording: a run that reached a model always bills tokens into
modelUsage, sois_errorwith an empty usage map and zero cost means the request was refused before any model work. Wording is used only to narrow an outage the numbers already established (to name the budget case and say "don't rotate the credential"), never to create or suppress one — the rejection text quotes a reset date that moves, embeds a U+00B7, and in both observed cases carried no body at all. That's the same failure mode #4120 fixed on the eval preflight's probe classifier, which owns the authoritative phrase list.The ENOENT install-crash claim now fires only when there is genuinely no execution log — which is what that crash actually looks like.
Only
require_commentcallers (pr-review) fail, unchanged from before: an outage on the optional lanes still must not red-X a contributor's PR.Not doable outside YAML:
pull_request_targetchecks out the untrusted fork tree with secrets in scope, so this file must not run a script from that tree — the detection itself has to be inline bash + jq. The tests compensate by extracting the step's realrun:body and executing it against captured execution logs.Test plan
pytest tests/unit/test_claude_review_posting.py— 24 tests. Nine execute the step's actualrun:body against real captured execution logs, including the verbatim test(eval): write scorecard fixtures as UTF-8 so Windows can run them #4119/fix(ci): read "weekly limit" as a quota outage, not an unknown failure #4120 outage result.modelUsageterm, dropping the cost term, or accepting anyis_errorrecord instead of the CLI'sresultrecord each fails exactly one test.ok/errored, never as an outage.pr-reviewchecks list shows "Claude never reached a model — budget or credential, not this PR" rather than "Claude produced no review".Closes nothing; makes #4080 self-reporting. Companion to #4120, which fixed the same misclassification on the eval preflight's probe.