Skip to content

fix(engine): replace dead xAI grok-3-mini slug for AfD agent - #179

Merged
easingthemes merged 1 commit into
mainfrom
claude/inspiring-maxwell-VE1sa
May 27, 2026
Merged

easingthemes merged 1 commit into
mainfrom
claude/inspiring-maxwell-VE1sa

Conversation

@easingthemes

Copy link
Copy Markdown
Owner

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 to abstain-all. In practice AfD became a no-op: abstaining on every vote and never proposing.

Root cause: grok-3-mini is no longer a valid xAI model slug. The current xAI catalog (May 2026) is grok-4.3, grok-4.20-*, grok-build-0.1. grok-3-mini is not among the 8 slugs that auto-redirect to grok-4.3 after 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 SDK APICallError's statusCode/responseBody, and detectLimitError only acts on 401/403/402/429 — so a permanent 400 looked like a generic one-off.

Changes

  • models.ts — AfD now uses grok-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 — pin reasoningEffort: "low" on the xAI path. grok-4.3 has built-in reasoning; without a cap, reasoning tokens consume the small completion budget (party calls use maxTokens: 1024) and starve the JSON answer → PARSE_FAIL. (grok-3-mini was also a reasoning model, so this likely compounded the original problem.) The schema only allows "low"/"high".
  • batch-client.ts — surface the real HTTP <status> <responseBody> on xAI failures so this can't rot invisibly again.
  • Updated stale grok-3-mini references 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 — clean
  • npm test — 596 passed
  • npm run build — clean
  • Deploy: pull branch, pm2 restart ki-simulate, confirm daily log shows agent:afd | xai/grok-4.3 | OK
  • If agent:afd still PARSE_FAIL after restart, the new error logging will show why — likely fix is a small bump to the AfD call's maxTokens (couldn't validate live here: no XAI_API_KEY in the build sandbox)

https://claude.ai/code/session_014BepJGEYYFAY4nLhiedZDT


Generated by Claude Code

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
@easingthemes
easingthemes merged commit a7a1d88 into main May 27, 2026
3 checks passed
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.

2 participants