Repository navigation
fix(sidecars): rebind the sidecar retry request after OAuth rotation - #5238
Conversation
The web-search and image-bridge loops build each attempt from an iteration-local shallow copy (iterParsed) of the outer parsed request, but rotateSidecarProviderOn429 rebound only the outer parsed. On a Kiro OAuth rotation the retried request kept the failed account's _kiroAuthContext and continuation/replay scope, pairing the new account's bearer with the previous account's routing metadata. The on429 hook now receives the exact iterParsed the retry is built from. The shared hook hands it to applyFailoverSnapshot, which already syncs _kiroAuthContext for a supplied retry request, and rebinds the route reasoning-replay/continuation scope on it — the same pattern the continuation loop uses for nextParsed.
|
✅ Deterministic PR hygiene checks passed. |
✅ READY
Review readiness checklist
✅ 4/4 boxes ticked. This pull request is already Ready for Review. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: lidge-jun/opencodex/.coderabbit.yaml Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (6)
Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughChanges429 retry request propagation
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix Sequence Diagram(s)sequenceDiagram
participant SidecarLoop
participant rotateSidecarProviderOn429
participant applyFailoverSnapshot
participant RotatedAdapter
SidecarLoop->>rotateSidecarProviderOn429: pass iteration-local retryParsed
rotateSidecarProviderOn429->>applyFailoverSnapshot: apply snapshot to retryParsed
rotateSidecarProviderOn429->>RotatedAdapter: rebind routing metadata
RotatedAdapter-->>SidecarLoop: build request from retryParsed
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
리뷰 · 우선순위 64 / 80웹 검색이랑 이미지(영상 포함) 사이드카가 429를 맞고 계정을 바꿀 때, 새 계정 토큰과 옛 계정 길이 서로 안 맞던 구멍을 막습니다. 루프는 매 시도마다 이번 고침은 src/server/responses/sidecar-execution.ts tests/images/loop.test.ts, tests/web-search/web-search.test.ts - 메인테이너의 판단이 필요한 지점 사이드카 429 회전에도 이어가기와 같이 작성자는 너의 추천 구멍의 원인과 고치는 방향은 맞습니다. 이 댓글은 grok-bot이 작성했습니다 |
Summary
runWithWebSearchandrunWithImageBridgebuild each attempt from an iteration-local shallow copy (iterParsed) of the outer parsed request, butrotateSidecarProviderOn429rebound only the outerparsed. On a Kiro OAuth rotation the retried request kept the failed account's_kiroAuthContext(region/profile) and continuation/replay scope — pairing the new account's bearer with the previous account's routing metadata.on429hook now receives the exactiterParsedthe retry is built from. The shared hook hands it toapplyFailoverSnapshot(which already syncs_kiroAuthContextfor a supplied retry request) and rebinds the route reasoning-replay/continuation scope on it — the same pattern the continuation loop already uses fornextParsed.Verification
bun test tests/images/loop.test.ts tests/web-search/web-search.test.ts tests/oauth/generic-oauth-failover.test.ts— 176 pass, 0 failbun test tests/web-search/web-search-sidecar-429.test.ts tests/adapters/anthropic/anthropic-sidecar-account-failover.test.ts tests/web-search/web-search-timeout-contract.test.ts— 11 pass, 0 failbun x tsc --noEmit— cleanbun run test:changed— ran the changed-file suite; the only failures are pre-existing environmental ones on this Windows host (SpendLedgerOwnerErrorintests/codex-integration/bearer-admission-routed-provider.test.ts, plus temp-fileEBUSY/hook timeouts). The same failures reproduce on a cleandevcheckout with these changes stashed.Checklist
Review readiness checklist
This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:
All CI tests are green on my local testing.
I pushed my PR to the latest dev commit.
I resolved all correct Codex and CodeRabbit findings.
My PR is ready for review.
Summary by CodeRabbit
Bug Fixes
Tests