fix(session-ingest): add retry with backoff to session-ingest-client calls#1385
Open
jeanduplessis wants to merge 3 commits intomainfrom
Open
fix(session-ingest): add retry with backoff to session-ingest-client calls#1385jeanduplessis wants to merge 3 commits intomainfrom
jeanduplessis wants to merge 3 commits intomainfrom
Conversation
…calls Replace direct fetch() calls in session-ingest-client with fetchWithBackoff() to handle transient failures from the session ingest worker. Consolidate the duplicated share endpoint logic in cli-sessions-v2-router to use the shared shareSessionIngest helper. Drain response bodies on retry to prevent socket/buffer leaks.
Contributor
Code Review SummaryStatus: 1 Issue Found | Recommendation: Address before merge Overview
Issue Details (click to expand)No new issues on current PR diff lines. Other Observations (not in diff)Issues found in merged changes outside the current PR diff that cannot receive inline comments:
Fix these issues in Kilo Cloud Files Reviewed (71 files)
Reviewed by gpt-5.4-20260305 · 635,991 tokens |
… of global.fetch The shareForWebhookTrigger endpoint now delegates to the shared shareSessionIngest client. The router test was mocking global.fetch directly, which broke because fetchWithBackoff retries transient 500s and the mockResolvedValueOnce only covered the first attempt.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
fetch()calls insession-ingest-client.tswithfetchWithBackoff()(10s budget) for the export, share, and delete endpoints, so transient failures from the session-ingest worker are retried automatically instead of immediately surfacing errors to users.cli-sessions-v2-router.ts— the inlinefetch+ response parsing is replaced with a call to the sharedshareSessionIngesthelper, removing ~25 lines of redundant code and the now-unusedSESSION_INGEST_WORKER_URL/generateInternalServiceTokenimports.fetchWithBackoff.ts(response.body?.cancel()) to prevent socket/buffer leaks.Verification
pnpm typecheck— passedpnpm test src/lib/session-ingest-client.test.ts— 25/25 tests passed (including 2 new retry integration tests)pnpm exec oxlint— 0 errorspnpm exec oxfmt --list-different .— no unformatted filesVisual Changes
N/A
Reviewer Notes
jest.requireActualto swap the mockfetchWithBackofffor the real implementation within a singledescribeblock, while all other tests continue to use the passthrough mock. The "retries exhausted" test has a 15s timeout since it waits for the real 10s backoff budget to expire.fetchWithBackoffalready retries on 5xx by default, so no customretryResponseoption is needed.response.body?.cancel()drain is fire-and-forget with a swallowed error — the body may already be consumed or absent in some environments.