omi icon indicating copy to clipboard operation
omi copied to clipboard

Microsoft 365: Graph retries shorten Retry-After and exhaust attempts during server cooldown

Open kaijakagi-sys opened this issue 2 months ago • 1 comments

The Microsoft 365 plugin retries before Microsoft Graph’s requested cooldown expires.

At main 9ff63a63b047ec756b6a4e3d726bac5bf5d6440e, GraphClient._request and get_bytes calculate min(retry_after, 2 ** attempt + 1). A valid 429 Retry-After: 60 therefore requests sleeps of only 2 and 3 seconds before exhausting all three attempts. Both JSON tools and file reads can exhaust their retry budget during a cooldown the server explicitly told them to respect.

I reproduced this offline using the unchanged client with synthetic HTTP responses, token lookup, and a recording sleep function. Both get('/me') and get_bytes('/me') produced requested_sleeps=[2,3], http_calls=3, final_status=429. This demonstrates retry timing, not a live Microsoft tenant incident; no real requests or credentials were used.

Microsoft Graph’s guidance says to wait the number of seconds in Retry-After, with exponential backoff when that header is absent.

Proposed scope: one shared retry-delay policy used by the two existing retry paths, preserving the attempt cap and response behavior. Valid server delays must not be shortened; any configured wait budget should surface a retry-later error instead of retrying early. Keep absent/malformed header fallback deterministic. No OAuth, write-idempotency redesign, deployment, or new API surface.

Validation plan: focused hermetic tests executing both production paths, covering Retry-After 60, absent/malformed headers, successful retry, and exhaustion; run the component’s discovered test runner and required repository preflights. No fix or passing regression suite is claimed yet.

Following the contribution guide’s bounty-suggestion invitation: @josancamon19, is this scope available, and would you consider a US$25 bounty if the fix and tests are accepted and merged? The amount is proposed only; eligibility, funding, and reservation are unconfirmed.

kaijakagi-sys avatar Sep 08 '26 18:09 kaijakagi-sys

Opened PR #13534. Graph backoff honours Retry-After instead of shortening it.

Nukeys avatar Sep 11 '26 20:09 Nukeys