feat(zoo-gateway): auth callback and multi-profile token sync#347
feat(zoo-gateway): auth callback and multi-profile token sync#347JamesRobert20 wants to merge 5 commits into
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ 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 |
adedf0a to
8634510
Compare
654117d to
1326a97
Compare
8634510 to
7bc8c0c
Compare
f245208 to
078bce0
Compare
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
Add ClineProvider tests for handleZooCodeCallback, ensureZooGatewayProfileSeeded, and webviewMessageHandler zooCodeSignOut to satisfy codecov patch on PR #347. Co-authored-by: Cursor <cursoragent@cursor.com>
proyectoauraorg
left a comment
There was a problem hiding this comment.
Review: Auth Callback + Multi-Profile Token Sync
Verdict: ✅ Approved (with security notes for future hardening)
Verified
- ✅
handleUri.spec.ts— 8 tests pass (multi-instance fan-out, sequential serialization) - ✅
ClineProvider.spec.ts— 82 tests pass (6 new auth profile sync tests) - ✅
webviewMessageHandler.spec.ts— 44 tests pass (2 new sign-out tests) - ✅ Sequential execution of callbacks avoids profile-store race conditions
- ✅ Sign-out clears tokens from ALL zoo-gateway profiles (correct symmetry)
- ✅ Model list fetch recovers credentials from non-active profiles
Security Notes (future hardening, not blockers)
- Token storage:
zooSessionTokenis stored in JSON-serializedProviderSettingson disk. VS Code's globalStorage is OS-protected, but migrating toSecretStoragewould add an extra layer of defense. - Base URL validation:
zooGatewayBaseUrlis derived fromgetZooCodeBaseUrl(). In production this is fine, but a misconfiguredZOO_CODE_BASE_URLenv var could route tokens to an unintended host. Consider adding domain validation.
Both are hardening improvements for a future iteration, not blockers for this PR.
Dependency
Depends on #345. After #345 merges, this should rebase cleanly.
Add ClineProvider tests for handleZooCodeCallback, ensureZooGatewayProfileSeeded, and webviewMessageHandler zooCodeSignOut to satisfy codecov patch on PR #347. Co-authored-by: Cursor <cursoragent@cursor.com>
65885a8 to
13c98d0
Compare
Add ClineProvider tests for handleZooCodeCallback, ensureZooGatewayProfileSeeded, and webviewMessageHandler zooCodeSignOut to satisfy codecov patch on PR #347. Co-authored-by: Cursor <cursoragent@cursor.com>
13c98d0 to
d4050f8
Compare
a40f6e9 to
983c133
Compare
Co-authored-by: Cursor <cursoragent@cursor.com>
Add ClineProvider tests for handleZooCodeCallback, ensureZooGatewayProfileSeeded, and webviewMessageHandler zooCodeSignOut to satisfy codecov patch on PR #347. Co-authored-by: Cursor <cursoragent@cursor.com>
Clear the cached token on 401 and offer sign-in. On insufficient credits or budget limits, open the credits page. On account frozen/banned, open support. Errors still propagate to the task layer after the toast. Co-authored-by: Cursor <cursoragent@cursor.com>
…ocales Adds session_expired, out_of_credits, account_unavailable, budget_exceeded under zooAuth.errors and a new zooAuth.buttons block (sign_in, add_credits, contact_support) introduced by the gateway 401/402/403 UX so check-translations passes. Co-authored-by: Cursor <cursoragent@cursor.com>
…ov patch Adds vscode + i18n mocks and asserts the 401/402/403/429 paths in surfaceGatewayApiError: token clear + sign-in URL on 401, add-credits URL on 402 and budget-coded 429, support URL on 403, no-op on 429 without a budget code or on errors without a status. Also verifies the helper still runs before completePrompt rewraps the upstream error. Co-authored-by: Cursor <cursoragent@cursor.com>
d3165a0 to
7e54cf1
Compare
Summary
Part 3 of the Zoo Gateway stack. Depends on PR2 (stacked on #344).
Test plan