fix(grok-cli): park a 402 on the empty Grok Build login, not grok-4.6 - #13061
Conversation
5c05a17 to
e64963c
Compare
|
Head is now |
e64963c to
19a1c91
Compare
|
Head is now |
19a1c91 to
bca9d3f
Compare
|
Head |
|
R4 LOCAL on Adjudication (source, not the summary field):
4+5. Claim that isSharedWalletCredits402 returns true for every grok-cli 402 body — DISPROVED. Non-empty unrelated body ("Add credits to continue, or switch to a free model") is tested and stays model-scoped: tests/unit/auth-grok-cli-402-shared-wallet.test.ts "a grok-cli 402 with an unrelated body does not park the connection".
Not reopening LOCAL. |
636cb91 to
d30d3c9
Compare
Grok Build bills Chat/Imagine/Voice/Build/API against one weekly pool, but the registry still sets passthroughModels so a 402 was treated as a per-model billing miss. Combo then locked grok-4.6 and skipped every other login in the same set. Classify that 402 as connection-wide credits exhaustion so the next Grok Build login can still run. Signed-off-by: Minxi Hou <houminxi@gmail.com>
d30d3c9 to
39e388a
Compare
|
CI red on this PR matches current Measured on tip
Unique diff does not touch those files. Contributor-only; not merging. |
f0b83b8
into
diegosouzapw:release/v3.8.51
…diegosouzapw#13061) The live evidence makes this: four Grok Build logins at 32-93% weekly remaining, skipped as "model locked by resilience" because the one login at 1% answered 402 and `passthroughModels: true` made that read as a per-model billing miss. A shared weekly wallet is a connection-wide signal, not a model verdict — `isSharedWalletCredits402` puts the scope where the biller put it. --- Validated in one consolidated worktree cut from `release/v3.8.51`, boarded with the other 19 PRs of this batch. Two in-batch conflicts, both additive and resolved by keeping each side: the `ENVIRONMENT.md` table (diegosouzapw#13035 + diegosouzapw#13011) and the `chatHelpers.ts` import block (diegosouzapw#12975 on the tip + diegosouzapw#13017). - `typecheck:core` clean; `check:dashboard-typecheck` OK (206 pre-existing, within baseline); `check:changelog-integrity` OK; `check:docs-counts` migrations ✓ - complexity 2816 / baseline 3218 and cognitive-complexity 1271 / baseline 1437 — both under baseline - 531 of 532 focused assertions green across the batch's 46 test files - `check-file-size` rebaselined for the batch's real growth (annotation `_rebaseline_2026_09_11_mergebatch_v3851_houminxi`, landed on diegosouzapw#13038), attributed per PR The single red is **not this batch**: `tests/unit/combo/quota-weighted-strategy.test.ts` → "A/B isolation: 7 hard-empty + 2 at 0.5% + 1 at 40%, floor=1" asserts an order between two connections of identical weight and flakes on the pure tip too — 2 failures in 4 runs at `origin/release/v3.8.51` with nothing from this batch applied.⚠️ base-red inherited: diegosouzapw#12732 — `Docs Gates`, `Merge integrity`, `No new ESLint warnings`, `Unit Tests fast-path` and `Fast Quality Gates` reproduce on the pure tip (provider count 356 vs the 358 the modules define, SKILL.md drift, and `open-sse/utils/stream.ts` at 3115 > frozen 3098, untouched here). Thanks @HouMinXi — the live evidence on these (X500 logs, `storage.sqlite` state, real `/v1/models` probes, the 36-minute outage write-up) is what let a 20-PR batch be reviewed as a unit.
…diegosouzapw#13061) The live evidence makes this: four Grok Build logins at 32-93% weekly remaining, skipped as "model locked by resilience" because the one login at 1% answered 402 and `passthroughModels: true` made that read as a per-model billing miss. A shared weekly wallet is a connection-wide signal, not a model verdict — `isSharedWalletCredits402` puts the scope where the biller put it. --- Validated in one consolidated worktree cut from `release/v3.8.51`, boarded with the other 19 PRs of this batch. Two in-batch conflicts, both additive and resolved by keeping each side: the `ENVIRONMENT.md` table (diegosouzapw#13035 + diegosouzapw#13011) and the `chatHelpers.ts` import block (diegosouzapw#12975 on the tip + diegosouzapw#13017). - `typecheck:core` clean; `check:dashboard-typecheck` OK (206 pre-existing, within baseline); `check:changelog-integrity` OK; `check:docs-counts` migrations ✓ - complexity 2816 / baseline 3218 and cognitive-complexity 1271 / baseline 1437 — both under baseline - 531 of 532 focused assertions green across the batch's 46 test files - `check-file-size` rebaselined for the batch's real growth (annotation `_rebaseline_2026_09_11_mergebatch_v3851_houminxi`, landed on diegosouzapw#13038), attributed per PR The single red is **not this batch**: `tests/unit/combo/quota-weighted-strategy.test.ts` → "A/B isolation: 7 hard-empty + 2 at 0.5% + 1 at 40%, floor=1" asserts an order between two connections of identical weight and flakes on the pure tip too — 2 failures in 4 runs at `origin/release/v3.8.51` with nothing from this batch applied.⚠️ base-red inherited: diegosouzapw#12732 — `Docs Gates`, `Merge integrity`, `No new ESLint warnings`, `Unit Tests fast-path` and `Fast Quality Gates` reproduce on the pure tip (provider count 356 vs the 358 the modules define, SKILL.md drift, and `open-sse/utils/stream.ts` at 3115 > frozen 3098, untouched here). Thanks @HouMinXi — the live evidence on these (X500 logs, `storage.sqlite` state, real `/v1/models` probes, the 36-minute outage write-up) is what let a 20-PR batch be reviewed as a unit.
Problem
space-grokis a reset-aware combo of fivegrok-cli/grok-4.6steps, oneconnection each. Grok Build bills Chat/Imagine/Voice/Build/API against a
single weekly percent pool. When one login answers
402 Grok Build usage balance exhausted, the registry still haspassthroughModels: true, soauth treated that 402 as a per-model billing miss (#12242). Combo then
locked
grok-4.6and skipped the remaining live logins as "model lockedby resilience". The client only saw the 402.
Live X500 (
storage.sqlite+podman logs, 13:04-13:05Z): four GrokBuild logins still answering 200 with 32-93% weekly remaining; only
364432949@qq.com(1%) returned 402. Combo ordered that empty loginfirst, then skipped the other four.
Change
isSharedWalletCredits402("grok-cli", 402)is a connection-wide walletsignal.
passthroughModelsstill stands for catalog/404.markAccountUnavailableparks that connection ascredits_exhaustedinstead of a model lock.
disableCoolingdoes not rescue it.provider:connectionIdexhausted for the rest ofthe request. Sibling Grok Build logins stay eligible.
usage balance exhaustedis a credits-exhausted signal.Tests
tests/unit/auth-grok-cli-402-shared-wallet.test.tsplus one case intests/unit/combo/combo-target-exhaustion.test.ts. Injected the oldmodel-lock path: tests failed (
testStatus=active, sibling skip false).After the change: 149 related tests pass, including the existing
passthrough 402 suite (
ollama-cloudstill model-locks) anddisableCoolingsuite.Notes
Contributor only — please do not merge from this account.
Does not overlap PR #13006 (quota-weighted snapshot cache). That PR
stops the next draw; this one unblocks the same request.