Skip to content

Comments

fix: make Retry-After use relative delay and improve 429 UX#409

Open
lc0rp wants to merge 3 commits intoopenclaw:mainfrom
lc0rp-contrib:main
Open

fix: make Retry-After use relative delay and improve 429 UX#409
lc0rp wants to merge 3 commits intoopenclaw:mainfrom
lc0rp-contrib:main

Conversation

@lc0rp
Copy link

@lc0rp lc0rp commented Feb 18, 2026

Impelements

  • RFC-compliant Retry-After behavior on 429 (delay-seconds, not UNIX epoch).
  • Added standardized RateLimit-* headers while keeping legacy X-RateLimit-*.
  • Display retry/budget/reset info and honors Retry-After with jittered backoff in UI
  • Docs updates for 429 behavior, examples, and proxy/IP caveats.

Rationale

Work done

  • Updated limiter headers in convex/lib/httpRateLimit.ts.
  • Added regression tests in convex/lib/httpRateLimit.test.ts.
  • Updated CLI HTTP handling/retry logic in packages/clawdhub/src/http.ts.
  • Added/updated CLI tests in packages/clawdhub/src/http.test.ts and packages/clawdhub/src/http.bun.test.ts.
  • Updated docs:
    • docs/http-api.md
    • docs/api.md
    • docs/troubleshooting.md
    • docs/deploy.md

Testing

  • bun run lint
  • bunx vitest run convex/lib/httpRateLimit.test.ts packages/clawdhub/src/http.test.ts packages/clawdhub/src/http.bun.test.ts
  • bun run test

Checklist

  • Added test coverage and tested
  • bun run lint
  • Tested and working locally

Worked w/ codex on this.

Fixes #407

Greptile Summary

Standardizes Retry-After header semantics to use RFC-compliant delay-seconds instead of Unix epoch timestamps, and adds standardized RateLimit-* headers alongside legacy X-RateLimit-* headers. The CLI is updated to parse these headers, display actionable retry/budget/reset info in error messages, and honor Retry-After with jittered backoff.

  • Server-side (convex/lib/httpRateLimit.ts): now emits both X-RateLimit-Reset (epoch) and RateLimit-Reset (delay), and Retry-After as delay-seconds on 429
  • CLI (packages/clawdhub/src/http.ts): replaces inline p-retry with runWithRetries that reads Retry-After, enriches error messages with retry/budget info, and supports legacy epoch-based Retry-After via a >1-year heuristic
  • Curl path: updated --write-out format to extract rate-limit headers via a structured metadata marker (__CLAWHUB_CURL_META__)
  • Docs: updated api.md, http-api.md, deploy.md, and troubleshooting.md with new header semantics, example 429 responses, client handling guidance, and proxy/IP caveats
  • Test coverage added for both server-side header generation and CLI-side header parsing/retry behavior

Confidence Score: 4/5

  • This PR is safe to merge with low risk — changes are well-tested and backwards compatible.
  • The implementation is solid with good test coverage across both Node and Bun paths. The server-side change is minimal and correct. The CLI-side refactor is larger but well-structured with backward compatibility for old-format curl output and legacy epoch-based Retry-After. One minor style issue (duplicate parseRateLimitInfo calls) has no functional impact.
  • packages/clawdhub/src/http.ts has a minor redundancy in error path (double parseRateLimitInfo call) worth cleaning up.

Last reviewed commit: d04c1e2

Context used:

  • Context from dashboard - AGENTS.md (source)

@vercel
Copy link
Contributor

vercel bot commented Feb 18, 2026

@lc0rp is attempting to deploy a commit to the Amantus Machina Team on Vercel.

A member of the Team first needs to authorize it.

@lc0rp lc0rp marked this pull request as ready for review February 18, 2026 10:01
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

9 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@lc0rp lc0rp changed the title fix: standardize Retry-After semantics and improve 429 UX fix: make Retry-After use relative delay and improve 429 UX Feb 19, 2026
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.

Bug: Retry-After uses absolute Unix epoch on 429, instead of retry delay seconds

1 participant