Repository navigation
Conversation
Add resilient retry logic with exponential backoff and Retry-After header parsing for idempotent GET requests in GoogleClient. Retries apply up to MAX_READ_RETRIES (2) on HTTP 429, HTTP 503, and transient network errors. Write operations (POST, PATCH, DELETE) remain strictly single-attempt without retrying to guarantee mutation safety.
|
The read/write split here looks good. I think the retryable-read predicate may be a little too narrow, though. Right now idempotent GETs retry only Would it be cleaner to encode that as one explicit read-only retry predicate rather than special-casing For example, an explicit set such as That keeps the important invariant simple: retry eligibility is determined by operation safety first, then transient response classification. AI-use note: I used an AI assistant to help inspect the retry boundary and draft this review; I verified the cited behavior against the current PR diff and existing Google write-safety tests before posting. |
…, 502, 504 Address review feedback by defining an explicit retryable-read status predicate (429, 500, 502, 503, 504). Write operations remain non-retryable and fail fast with OutcomeUnknownError on 5xx.
|
Thanks for the thoughtful review and suggestion, @kvnloo! I've pushed commit \42755f5\ addressing this feedback:
|
|
Needs changes before merge:
Refs: https://developers.google.com/workspace/gmail/api/guides/handle-errors and https://developers.google.com/workspace/calendar/api/guides/errors |
jerelvelarde
left a comment
There was a problem hiding this comment.
Value: bounded retries improve Google read reliability. Template/security: read retries remain bounded and writes retain single-attempt OutcomeUnknownError semantics; 33 Google tests passed, no actionable security defect found. Please integrate current main before approval: packages/integrations/src/google.ts and tests/google.test.ts conflict with the merged charset, filename, calendar-zone and calendar-range fixes. Preserve those behaviors and rerun combined regressions. Also update the description's retry-status list to include the implemented 500/502/504 statuses.
|
Updated in
Verification: |
What changed
Retry-Afterparsing for idempotent Google GET reads.rateLimitExceeded/userRateLimitExceeded, and network failures. Default backoff starts at 1000ms; provider delays are capped at 30 seconds.OutcomeUnknownErrorfor uncertain outcomes.Retry-After, invalid-header backoff, and network retry exhaustion without a final sleep.Verification
node --import tsx/esm --test tests/google.test.ts).node --import tsx/esm --import ./tests/setup.ts --test tests/conversation-calendar.test.ts).pnpm lint,pnpm typecheck,pnpm build:server, web/iOS/Android exports, and worker typecheck passed.git diff --checkpassed.Full-suite limitation: the normal
pnpm testlauncher could not create its Unix IPC socket in this environment. Running the same fixtures directly through Node passed 459 tests but failed five test-file processes. Those five files were rerun sequentially: 78 of 79 tests passed, revealing the stale calendar assertion fixed above; the affected calendar file then passed all 12 tests. A single clean full-suite invocation is still for CI to confirm.Tests use controlled fixtures; live Google credentials and native device behavior were not exercised.