Commit 75d4eee
feat(zoo-gateway): auth callback and multi-profile token sync (#347)
* feat(zoo-gateway): auth callback, profile token sync, and sign-out
Co-authored-by: Cursor <cursoragent@cursor.com>
* test(zoo-gateway): cover auth callback profile sync and sign-out
Add ClineProvider tests for handleZooCodeCallback, ensureZooGatewayProfileSeeded, and webviewMessageHandler zooCodeSignOut to satisfy codecov patch on PR #347.
Co-authored-by: Cursor <cursoragent@cursor.com>
* fix(zoo-gateway): surface 401/402/403 errors with actionable toasts
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>
* i18n(zoo-gateway): backfill zooAuth translations for 17 non-English locales
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>
* test(zoo-gateway): cover surfaceGatewayApiError UX branches for codecov 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>
* fix(zoo-gateway): address PR review feedback on auth, seeding, and errors
Co-authored-by: Cursor <cursoragent@cursor.com>
* test(zoo-gateway): cover stale baseUrl seeding path
Co-authored-by: Cursor <cursoragent@cursor.com>
* fix(zoo-gateway): sign-out clears stale profile tokens, simplify model fetch
Co-authored-by: Cursor <cursoragent@cursor.com>
* test(zoo-gateway): drop stale profile-scan test for requestRouterModels
Co-authored-by: Cursor <cursoragent@cursor.com>
* fix(zoo-gateway): treat verify 5xx as transient, do not clear token
The website's /api/extension/auth/verify route now returns 503 when the
backend can't reach the database, instead of crashing. The extension
previously treated any non-OK response from this endpoint as a
definitively invalid token, which meant a transient backend hiccup
would silently clear the user's session and force a fresh sign-in.
verifyZooCodeToken now returns "unreachable" for 5xx responses (same
classification as a network error), so initZooCodeAuth keeps the cached
token in place and reports subscription status as "unknown" until the
backend recovers. handleAuthCallback shows the could-not-verify message
on 5xx so users see this is a temporary issue rather than a bad token.
Co-authored-by: Cursor <cursoragent@cursor.com>
* refactor(zoo-gateway): split error classification from UX, extract callback fan-out
Address review feedback on PR #347:
- zoo-gateway.ts: split surfaceGatewayApiError into a pure
classifyGatewayApiError (error -> action) plus a thin UX layer that
switches on the action. The classifier is exported and covered by
focused unit tests, so the status/code -> action mapping no longer
needs the VS Code notification mocks to verify.
- handleUri.ts: extract the per-instance token propagation loop into a
propagateZooGatewayCallback helper, keeping the /auth-callback case
focused on routing. Behaviour (sequential read-modify-write, per
instance error isolation) is unchanged.
Co-authored-by: Cursor <cursoragent@cursor.com>
* fix: isolate per-profile token cleanup on sign-out and assert state refresh
Wrap per-profile work in the zoo-gateway sign-out cleanup loop in its own
try/catch so one corrupted profile or failed write no longer aborts cleanup
of the remaining profiles. Also assert postStateToWebview runs on the
handleZooCodeCallback persistence-failure path.
Co-authored-by: Cursor <cursoragent@cursor.com>
---------
Co-authored-by: James Mtendamema <jmtendamema@geologicai.com>
Co-authored-by: Cursor <cursoragent@cursor.com>1 parent 019d857 commit 75d4eee
31 files changed
Lines changed: 1247 additions & 104 deletions
File tree
- src
- activate
- __tests__
- api/providers
- __tests__
- fetchers
- __tests__
- core/webview
- __tests__
- i18n/locales
- ca
- de
- en
- es
- fr
- hi
- id
- it
- ja
- ko
- nl
- pl
- pt-BR
- ru
- tr
- vi
- zh-CN
- zh-TW
- services
- __tests__
- webview-ui/src/components/welcome
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
24 | 30 | | |
25 | 31 | | |
26 | 32 | | |
27 | 33 | | |
| 34 | + | |
28 | 35 | | |
29 | 36 | | |
30 | 37 | | |
| |||
39 | 46 | | |
40 | 47 | | |
41 | 48 | | |
| 49 | + | |
42 | 50 | | |
43 | 51 | | |
44 | 52 | | |
| |||
54 | 62 | | |
55 | 63 | | |
56 | 64 | | |
57 | | - | |
| 65 | + | |
58 | 66 | | |
| 67 | + | |
59 | 68 | | |
60 | 69 | | |
61 | 70 | | |
| |||
69 | 78 | | |
70 | 79 | | |
71 | 80 | | |
| 81 | + | |
72 | 82 | | |
73 | 83 | | |
74 | 84 | | |
| |||
116 | 126 | | |
117 | 127 | | |
118 | 128 | | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
119 | 200 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
7 | 35 | | |
8 | 36 | | |
9 | 37 | | |
| |||
50 | 78 | | |
51 | 79 | | |
52 | 80 | | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
| 81 | + | |
57 | 82 | | |
58 | 83 | | |
59 | 84 | | |
| |||
0 commit comments