You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PR #2875 preserves stored tokens on HTTP 429, but deliberately leaves retry timing unchanged. A refresh retry can therefore immediately hit the same rate limit.
This is the separate follow-up agreed in #2875 (comment) . It does not replace or block #2875.
Scope
Wait before an allowed HTTP 429 retry, without increasing the existing attempt budget.
Parse Retry-After delta-seconds or HTTP-date.
Bound the delay and use a fallback for missing or invalid values; avoid immediate retries for zero/past values.
Observe refresh-context cancellation during waiting and prevent the next request after cancellation.
Preserve existing token-safety semantics, including uncertainty from an earlier refresh outcome.
The prepared implementation uses a one-second fallback and a 30-second cap. These are explicit policy choices for review. Existing transaction cancellation shielding and the 60-second refresh timeout remain unchanged.
Regression coverage
Use placeholder tokens, an isolated store and scripted HTTP transports:
Wait-before-retry ordering and repeated 429 exhaustion.
429 followed by success stores the rotated token.
Cancellation stops waiting and prevents another request.
A later 429 does not erase an earlier uncertain outcome.
Non-goals
No changes to HTTP 5xx, unrelated OAuth behavior, or ambiguous-outcome replay policy (#2840). A transport failure does not establish that a refresh token is safe to replay.
A local implementation and deterministic regression tests are prepared. The follow-up PR will remain draft while #2875 is unmerged. No changes are being made to #2875.
Data point for the fallback path in #2881: on accounts.larksuite.com the token endpoint's 429 carries neither Retry-After nor x-ogw-ratelimit-reset (the header documented in Lark's frequency-control guide). The body is plain text "ratelimit triggered", so the 1-second fallback is the only path that ever runs.
Observed on 2026-11-11 (UTC+8): two refresh attempts 130 ms apart at 16:17:04 both got 429, and device-flow polling between 16:20 and 16:26 kept getting 429 (e.g. logids 2026111116203820E9124BFB3AFBA40C00, 20261111162051CB10AAC0A3131F9817C9). The limit lasted tens of seconds to minutes, so a single retry after 1 s is very likely to hit 429 again.
Suggestions: also parse x-ogw-ratelimit-reset, and use a longer default (or exponential) delay when no header is present. Raw response and more logids are in #2869 (comment 6793407071).
Activity
bruce-sihua commentedon Nov 11, 2026
Data point for the fallback path in #2881: on accounts.larksuite.com the token endpoint's 429 carries neither Retry-After nor x-ogw-ratelimit-reset (the header documented in Lark's frequency-control guide). The body is plain text "ratelimit triggered", so the 1-second fallback is the only path that ever runs.
Observed on 2026-11-11 (UTC+8): two refresh attempts 130 ms apart at 16:17:04 both got 429, and device-flow polling between 16:20 and 16:26 kept getting 429 (e.g. logids 2026111116203820E9124BFB3AFBA40C00, 20261111162051CB10AAC0A3131F9817C9). The limit lasted tens of seconds to minutes, so a single retry after 1 s is very likely to hit 429 again.
Suggestions: also parse x-ogw-ratelimit-reset, and use a longer default (or exponential) delay when no header is present. Raw response and more logids are in #2869 (comment 6793407071).