Skip to content

Retry attributable xAI capacity protocol mismatches - #881

Merged
TheGreatAxios merged 2 commits into
mainfrom
cl-7646-xai-capacity-retry
Sep 11, 2026
Merged

Retry attributable xAI capacity protocol mismatches#881
TheGreatAxios merged 2 commits into
mainfrom
cl-7646-xai-capacity-retry

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Collaborator

Summary

  • Attributable xAI/Grok capacity protocol_mismatch remaps to retryable
  • Quota, unknown, and Go classification paths stay unchanged

Verification

  • Focused gateway/retry tests: 52 pass
  • bun run lint, bun run typecheck, and bun run build pass
  • bun run check blocked by 4 pre-existing failures that reproduce on clean origin/main (unrelated to this branch):
    • createOptimizedContextStore load > the next write heals a torn base tail so reload is stable
    • createOptimizedContextStore unpublished rewrite > git commit failure after rewrite lands keeps load on HEAD
    • assembleChatAgent > omits evidence archive when no holder is provided
    • assembleChatAgent > getWorkdir and getCompactor run at buildAgent time, not assemble time

Fixes CL-7646

@linear-code

linear-code Bot commented Sep 10, 2026

Copy link
Copy Markdown

CL-7646

@TheGreatAxios TheGreatAxios left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review · Request changes

xAI capacity protocol_mismatch remaps to retryable, but the exact “Service temporarily unavailable” path inspects the wrong field for real ProtocolMismatchError shapes.

Findings

  • src/inference-gateway-error.ts:257-263 — exact match uses error.message only. intx puts parser detail on message and the server body on raw. SSE malformed-JSON / schema-fail with raw: "Service temporarily unavailable" still aborts. Substring "high demand" works because it searches combined text.
  • Remapped copy uses GATEWAY_OVERLOAD_USER_MESSAGE (“retrying…”), which also surfaces after abort.
  • Substring path has no quota-marker veto, so mixed capacity+quota copy remaps.

Notes

GitHub blocks request-changes on own PRs, so this is a comment with that verdict.

@TheGreatAxios TheGreatAxios left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Critic · Request changes

Provider-gated remap and 3-attempt 500/1000ms bound are the right layer. Quota / unknown / OpenCode Go stay terminal.

Findings

  • textSuggestsXaiCapacity exact phrase is message-only; tests set the phrase as message, which parseResponse does not produce.
  • Comment at :241-245 claims JSON-raw support; implementation does not search raw for the exact phrase.

@TheGreatAxios
TheGreatAxios force-pushed the cl-7646-xai-capacity-retry branch 3 times, most recently from dd0c718 to 467a083 Compare September 11, 2026 03:14
xAI and Grok sometimes surface capacity or overload as
protocol_mismatch instead of a retryable status. Remap those
attributable phrases to retryable while leaving quota exhaustion,
unknown providers, and OpenCode Go unchanged.
@TheGreatAxios
TheGreatAxios force-pushed the cl-7646-xai-capacity-retry branch from 467a083 to b1c3b7d Compare September 11, 2026 03:16
@TheGreatAxios
TheGreatAxios merged commit 55d1515 into main Sep 11, 2026
9 checks passed
@TheGreatAxios
TheGreatAxios deleted the cl-7646-xai-capacity-retry branch September 11, 2026 03:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant