Repository navigation
Commit 30cccb9
feat(cursor-review): probe the direct Anthropic key and fall back to Cursor when it is capped (#431)
* feat(cursor-review): probe the direct Anthropic key before a round and fall back to Cursor when it is capped
A key whose organization reached its usage limit is present but refused,
so every direct cell, the direct judge and the direct axis runner errored
and rounds ended with no decision until someone deleted the caller's
direct-model variables by hand. The workflows checked presence only.
- gate: `Probe the direct Anthropic key` makes one 1-token Messages call
per configured model (hosted, no checkout, never prints the key or a
header) and classifies it: 2xx usable; the usage-limit 400, billing,
401/403 unusable; 429/529/5xx/no answer retried twice then unusable;
404 or a 400 naming an unknown model invalid. Best effort: a crash
leaves the outputs empty, which preflight reads as "not probed".
- preflight: unusable reads exactly like an absent key (the Cursor
`claude-*` cells and the Cursor judge run), with a warning per lane and
a job summary line; invalid fails the run, never a fallback on a typo.
- post-review: `--runner-note` says under the review header that the
direct lanes ran on Cursor this round.
- cursor-axis-base: a new `axis-probe` job (hosted, no checkout) runs the
same byte-identical probe and picks the Cursor `axis` job or
`axis-direct`; an absent key, a non-plain or unknown id, a non-checkout
axis and context_sources still fail the axis.
- docs: cursor-review and cursor-approve caller guides and the
cursor-review README describe the fallback and how to see it in a run.
No new inputs or secrets: today's callers work unchanged.
* fix(cursor-review): name each fallen lane's own reason in the fallback note
When the cells and judge models fail the probe differently (billing vs.
unavailable), the note named the first lane's reason for both. One shared
reason still reads once; differing reasons are listed per lane. Applied to
both byte-identical probe copies (gate + axis-probe).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(cursor-review): harden the Anthropic key probe per the panel's review round
- Write every probe output once, at the end, and catch every exception per
call, so a probe that dies midway leaves all lanes unprobed instead of one
lane decided and the note missing. Retries also stop at a wall-clock
PROBE_BUDGET_SECONDS inside the step timeout (urlopen's timeout bounds a
socket op, not a request).
- Refuse redirects: the request carries x-api-key, so a 3xx is now an
unusable refusal, never followed to another host.
- `invalid` is a 404 / not_found_error only; a 400's wording is no longer
guessed at. Any other refusal still falls back, now documented.
- A dash-free CLI model alias (`opus`, `sonnet`) that the raw API 404s is
not probed, so a config the `--model` CLI resolves keeps working.
- preflight checks the openai/anthropic id collision before a probe verdict
can fail the run.
- When the cells fall back to a panel list with no Cursor claude-* id, the
warning, job summary and posted note now say no Anthropic cell ran.
- axis-direct's comment names axis-probe as the other key-holding job.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(cursor-review): publish only the probe's reason class, never the API's raw message
The fallback note lands in the posted PR review, and the per-lane reasons in
::warning:: lines and job summaries, all world-readable on a public repo. An
Anthropic 429 message can name the organization and a billing one its credit
state, and clean() redacts only the exact key. Keep the reason class plus,
for a usage limit, the parsed reset time; drop the rest.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>1 parent 68dd712 commit 30cccb9
10 files changed
Lines changed: 994 additions & 38 deletions
File tree
- .github
- cursor-approve/tests
- cursor-review
- tests
- workflows
- docs/callers
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | | - | |
10 | | - | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | | - | |
| 14 | + | |
| 15 | + | |
14 | 16 | | |
15 | 17 | | |
16 | 18 | | |
| |||
30 | 32 | | |
31 | 33 | | |
32 | 34 | | |
33 | | - | |
34 | | - | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
35 | 39 | | |
36 | 40 | | |
37 | 41 | | |
| |||
68 | 72 | | |
69 | 73 | | |
70 | 74 | | |
| 75 | + | |
71 | 76 | | |
72 | 77 | | |
73 | 78 | | |
| |||
100 | 105 | | |
101 | 106 | | |
102 | 107 | | |
103 | | - | |
| 108 | + | |
| 109 | + | |
104 | 110 | | |
105 | 111 | | |
106 | 112 | | |
| |||
128 | 134 | | |
129 | 135 | | |
130 | 136 | | |
| 137 | + | |
131 | 138 | | |
132 | 139 | | |
| 140 | + | |
| 141 | + | |
133 | 142 | | |
134 | | - | |
| 143 | + | |
135 | 144 | | |
136 | 145 | | |
137 | 146 | | |
| |||
144 | 153 | | |
145 | 154 | | |
146 | 155 | | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
147 | 159 | | |
148 | 160 | | |
149 | 161 | | |
| |||
181 | 193 | | |
182 | 194 | | |
183 | 195 | | |
184 | | - | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
185 | 201 | | |
186 | 202 | | |
187 | 203 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
328 | 328 | | |
329 | 329 | | |
330 | 330 | | |
331 | | - | |
| 331 | + | |
332 | 332 | | |
333 | 333 | | |
334 | 334 | | |
| |||
393 | 393 | | |
394 | 394 | | |
395 | 395 | | |
396 | | - | |
| 396 | + | |
397 | 397 | | |
398 | 398 | | |
399 | | - | |
| 399 | + | |
400 | 400 | | |
401 | 401 | | |
402 | 402 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3006 | 3006 | | |
3007 | 3007 | | |
3008 | 3008 | | |
| 3009 | + | |
| 3010 | + | |
| 3011 | + | |
| 3012 | + | |
| 3013 | + | |
| 3014 | + | |
| 3015 | + | |
| 3016 | + | |
3009 | 3017 | | |
3010 | 3018 | | |
3011 | 3019 | | |
| |||
3035 | 3043 | | |
3036 | 3044 | | |
3037 | 3045 | | |
| 3046 | + | |
| 3047 | + | |
| 3048 | + | |
| 3049 | + | |
3038 | 3050 | | |
3039 | 3051 | | |
3040 | 3052 | | |
| |||
0 commit comments