You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(quota): detect unsupported Codex model from detail shape (#501) (#502)
* fix(quota): detect unsupported Codex model from detail error shape
The Codex quota endpoint now returns model-not-supported errors as a flat
{"detail": "..."} body instead of the nested {"error": {"message": "..."}}
envelope. getUnsupportedCodexModelInfo only inspected errorBody.error, so
detection failed: the model-fallback loop in fetchCodexQuotaSnapshot stopped
continuing and the raw JSON leaked into "live check failed: {...}" output.
- fetch-helpers: fall back to the top-level detail string when error is
absent or not a record, reusing the existing unsupported-model patterns
- quota-probe: track whether every probe model failed solely because the
account lacks Codex entitlement; when so, throw a typed CodexUnavailableError
- errors: add CodexUnavailableError plus isCodexUnavailableError guard
- codex-manager: surface "(Codex not available for this account)" instead of
leaking the raw probe error in the check command, still counted as a warning
Adds regression tests for the detail shape, the all-unsupported vs mixed-failure
paths, and the new error type and guard.
Fixes#501
* fix(quota): surface Codex-unavailable note across all live-probe surfaces
The first pass only fixed the check command. best, forecast, report, fix
(repair), and the runtime deep-check reused fetchCodexQuotaSnapshot through
their own catch blocks that rendered the raw error message, so they still
leaked 'model is not supported when using Codex with a ChatGPT account' (and
the Best Account / Auto-Fix screenshots in issue #501).
- quota-probe: add CODEX_UNAVAILABLE_PROBE_NOTE and describeCodexProbeFailure(),
centralizing the 'Codex not available for this account' wording and the
CodexUnavailableError check so every surface renders it identically
- best/forecast/report/forecast-report: route live-probe catch blocks through
describeCodexProbeFailure (persist-patch catches left untouched)
- repair-commands: emit 'refresh succeeded (Codex not available for this
account)' instead of 'live probe failed: ...' for the unavailable case
- runtime/account-check: same note for the deep-check probe path
- codex-manager: reuse the shared constant in the two check-command branches
Tests: describeCodexProbeFailure unit cases; partial quota-probe mocks in
codex-manager-cli and repair-commands now spread importOriginal so the new
exports resolve.
Refs #501
* fix(quota): treat codex-unavailable as warning + add probe-path tests
Addresses CodeRabbit/Greptile review on PR #502.
Behavior fixes:
- codex-manager: styleAccountDetailText now renders the codex-unavailable
health detail in the warning tone (matches 'unavailable'/'not available')
instead of the muted-success tone, so the dashboard no longer hides it
- runtime/account-check: a CodexUnavailableError quota probe is counted as a
warning (state.warnings) with the friendly note and no 'ERROR' prefix,
instead of incrementing state.errors and misclassifying a working account;
the results summary surfaces the warning bucket. Adds state.warnings field.
Regression tests for every live-probe surface:
- best/forecast/report: CodexUnavailableError yields the friendly note in
probeErrors (and a non-unavailable failure stays normalized, no token leak)
- repair-commands: refresh-then-probe-unavailable maps to warning-soft-failure
carrying the note, account left enabled
- runtime/account-check: warning (not error) accounting + note, no raw leak
- codex-manager-cli: best --live shows the friendly note, never raw JSON
- quota-probe: an instruction-fetch failure on a later model still rejects
with the instruction error rather than masking it as CodexUnavailableError
Refs #501
0 commit comments