Repository navigation
fix(engine): replace dead xAI grok-3-mini slug for AfD agent - #179
Merged
Merged
Conversation
The AfD agent (the only party routed to xAI) failed every day with a 400 "Bad Request" and silently fell back to abstain-all, because grok-3-mini is no longer a valid xAI model slug. Point it at grok-4.3 (xAI's current model) and update the pricing entry accordingly. grok-4.3 has built-in reasoning, so cap reasoningEffort to "low" on the xAI path — otherwise reasoning tokens consume the small completion budget and starve the JSON answer, producing PARSE_FAIL. Also surface the real HTTP status + response body when an xAI call fails, instead of the bare "Bad Request" that hid this for weeks. https://claude.ai/code/session_014BepJGEYYFAY4nLhiedZDT
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The AfD party agent — the only party routed to xAI — has been failing every single day for weeks with
[Batch] xAI call failed for agent-afd-dayN: Bad Request, silently falling back toabstain-all. In practice AfD became a no-op: abstaining on every vote and never proposing.Root cause:
grok-3-miniis no longer a valid xAI model slug. The current xAI catalog (May 2026) isgrok-4.3,grok-4.20-*,grok-build-0.1.grok-3-miniis not among the 8 slugs that auto-redirect togrok-4.3after the May 15 2026 retirement, so requests hard-400 ("model does not exist") rather than redirecting — which matches the failure predating the retirement.Why it stayed hidden: the xAI failure handler logged only
err.message("Bad Request"), discarding the AI SDKAPICallError'sstatusCode/responseBody, anddetectLimitErroronly acts on 401/403/402/429 — so a permanent 400 looked like a generic one-off.Changes
models.ts— AfD now usesgrok-4.3(xAI's current model, the target every legacy slug redirects to); pricing entry updated to grok-4.3 rates ($1.25 / $2.50 per 1M in/out).client.ts— pinreasoningEffort: "low"on the xAI path. grok-4.3 has built-in reasoning; without a cap, reasoning tokens consume the small completion budget (party calls usemaxTokens: 1024) and starve the JSON answer →PARSE_FAIL. (grok-3-miniwas also a reasoning model, so this likely compounded the original problem.) The schema only allows"low"/"high".batch-client.ts— surface the realHTTP <status> <responseBody>on xAI failures so this can't rot invisibly again.grok-3-minireferences in.env.example,TECHNICAL.md, and test mocks.Kept AfD on xAI intentionally — Anthropic models tend to refuse the AfD role-play.
Test plan
npm run typecheck— cleannpm test— 596 passednpm run build— cleanpm2 restart ki-simulate, confirm daily log showsagent:afd | xai/grok-4.3 | OKagent:afdstillPARSE_FAILafter restart, the new error logging will show why — likely fix is a small bump to the AfD call'smaxTokens(couldn't validate live here: noXAI_API_KEYin the build sandbox)https://claude.ai/code/session_014BepJGEYYFAY4nLhiedZDT
Generated by Claude Code