retry transient xai search failures - #989
Merged
aaronjmars merged 2 commits intoAug 30, 2026
Merged
Conversation
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>
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.
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
secretcurlitself, so every skill that calls x_search through it benefits without individual changes.why here, not per-skill
11 skills declare
XAI_API_KEYand share this exact fragile single-shot pattern. fixing it once insecretcurl(the shared call path) avoids 11 near-identical retry loops.verification
scripts/tests/test_secretcurl.shsuite: unchanged, passesscripts/tests/test_secretcurl_xai_retry.sh: passesmax_attempts=1, confirmed the test fails for the predicted reason ("expected two attempts"), restored, confirmed green again