Skip to content

retry transient xai search failures - #989

Merged
aaronjmars merged 2 commits into
aeonfun:mainfrom
Svector-anu:fix/xai-search-retries-upstream
Aug 30, 2026
Merged

retry transient xai search failures#989
aaronjmars merged 2 commits into
aeonfun:mainfrom
Svector-anu:fix/xai-search-retries-upstream

Conversation

@Svector-anu

Copy link
Copy Markdown
Contributor

ports Svector-anu#37 upstream — that fix has been running on my fork since 2026-08-27, this brings it to main so every operator using x_search-dependent skills benefits, not just my fork.

what

x_search calls to api.x.ai are live, variable-latency requests. a single transient failure (timeout, 5xx, an empty 200) was previously permanent — no retry, immediate fallback to a lower-quality path. this centralizes a 3-attempt retry/backoff with per-attempt diagnostics inside secretcurl itself, so every skill that calls x_search through it benefits without individual changes.

why here, not per-skill

11 skills declare XAI_API_KEY and share this exact fragile single-shot pattern. fixing it once in secretcurl (the shared call path) avoids 11 near-identical retry loops.

verification

  • existing scripts/tests/test_secretcurl.sh suite: unchanged, passes
  • new scripts/tests/test_secretcurl_xai_retry.sh: passes
  • mutation-tested: forced max_attempts=1, confirmed the test fails for the predicted reason ("expected two attempts"), restored, confirmed green again
  • real-world validation: this exact fix has been live on my fork since 2026-08-27 (retry transient xai search failures Svector-anu/svectors-lab#37), including a live proof-of-concept against the real X.AI API (real x_search content returned on attempt 1)

Svector-anu and others added 2 commits August 30, 2026 18:49
x_search calls to api.x.ai are a live, variable-latency request - a
single transient failure (timeout, 5xx, empty 200) was previously
permanent, silently degrading 11 skills to a lower-quality websearch
fallback with no retry. centralizes 3-attempt retry/backoff with
per-attempt diagnostics (attempt=N/3 http=... reason=...) in
secretcurl itself, so every skill using it benefits without
per-skill changes.

verified: existing secretcurl suite passes unchanged, new retry test
passes, mutation-tested (forced max_attempts=1, confirmed the test
fails for the predicted reason, restored, confirmed green).

already running on a fork (#37, merged
2026-08-27) - porting upstream since every skill using x_search
still has the same single-attempt fragility on main.
401/403/400 are caller errors, not transients. Keep retrying 5xx, 429,
timeout, and empty 200. Wire the retry test into ci-tests.yml.

Co-Authored-By: Grok <noreply@x.ai>
@aaronjmars
aaronjmars merged commit 8fcce1e into aeonfun:main Aug 30, 2026
2 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