Skip to content

feat(core): make rate-limit retry ceiling configurable - #281

Merged
jacob-bd merged 1 commit into
jacob-bd:mainfrom
Sanity-Cloud:upstream/rate-limit-retry-policy-20260805
Aug 5, 2026
Merged

feat(core): make rate-limit retry ceiling configurable#281
jacob-bd merged 1 commit into
jacob-bd:mainfrom
Sanity-Cloud:upstream/rate-limit-retry-policy-20260805

Conversation

@insane66613

Copy link
Copy Markdown
Contributor

Summary

Add NOTEBOOKLM_RATE_LIMIT_MAX_RETRIES so callers that own queueing or backoff can choose how many automatic rate-limit retries the client performs.

Behavior

  • unset or empty: preserve the existing DEFAULT_MAX_RETRIES behavior
  • 0: surface HTTP 429 and RPC RESOURCE_EXHAUSTED immediately
  • positive integer: retry rate limits up to that ceiling
  • invalid or negative values: fall back to the existing default

The setting applies only to rate limits. HTTP 5xx recovery, connection retries, and authentication recovery retain their existing behavior. Direct HTTP and CDP transports use the same policy.

Motivation

External orchestrators often need to own retry timing globally. Without a rate-limit-specific ceiling, the client and the outer queue can both back off, increasing latency and making scheduling nondeterministic.

Compatibility

Default behavior is unchanged and no dependencies are added.

Validation

  • uv run ruff check .
  • uv run ruff format --check .
  • focused RPC/retry suite — 16 passed
  • full upstream-first integration stack on Windows — 1,318 passed, 39 skipped

Rate-limit branches were exercised with deterministic HTTP/RPC responses, including separation from 5xx and connection retry paths. A real account was not intentionally driven into a quota failure.

NOTEBOOKLM_MCP_DEBUG Debug logging (default: false)
NOTEBOOKLM_HL Interface language and default artifact language (default: en)
NOTEBOOKLM_QUERY_TIMEOUT Query timeout in seconds (default: 120.0)
NOTEBOOKLM_RATE_LIMIT_MAX_RETRIES Retry count for HTTP 429/RPC resource limits (default: 3; 0 disables)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nitpick: messes the indentation of variable descriptions

@jacob-bd
jacob-bd merged commit 49df903 into jacob-bd:main Aug 5, 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.

3 participants