Skip to content

fix(x-search): wait for rate-limit reset and retry instead of aborting - #281

Merged
virattt merged 1 commit into
virattt:mainfrom
DogInfantry:fix/x-search-rate-limit-retry
Jun 28, 2026
Merged

virattt merged 1 commit into
virattt:mainfrom
DogInfantry:fix/x-search-rate-limit-retry

Conversation

@DogInfantry

@DogInfantry DogInfantry commented Jun 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #246. xApiGet in x-search.ts parsed the X-Rate-Limit-Reset header on a 429 but threw immediately, terminating multi-page searches mid-run. It now waits for the reset window and retries (up to 3×), bounded by a 60s cap so an unusually long reset window can't hang the agent.

Changes

  • Wait-and-retry on HTTP 429 instead of aborting; throw only after retries are exhausted or when the reset window exceeds the cap.
  • Add unit tests covering retry-success, retry-exhaustion, and the over-cap fast-fail path.

Testing

  • bun test — 74 pass / 0 fail
  • tsc --noEmit — clean

X search threw immediately on HTTP 429, terminating multi-page searches
mid-run even though the X-Rate-Limit-Reset header was already parsed and
a wait time computed. Now wait for the reset window and retry, bounding
both the wait duration and retry count so an unusually long reset window
can't hang the agent indefinitely.

Fixes virattt#246
@DogInfantry
DogInfantry force-pushed the fix/x-search-rate-limit-retry branch from 0734d4a to 48207e9 Compare June 21, 2026 02:26
@virattt

virattt commented Jun 28, 2026

Copy link
Copy Markdown
Owner

Thanks!

@virattt
virattt merged commit a11408a into virattt:main Jun 28, 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.

x-search.ts aborts on HTTP 429 instead of waiting for X-Rate-Limit-Reset

2 participants