Skip to content

Commit 45968c0

Browse files
fix(webview): dismiss welcome after Zoo Gateway sign-in (#961) (#962)
checkExistKey ignored Zoo Gateway session auth, so Finish saved config but never left the setup screen. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 8c17b41 commit 45968c0

3 files changed

Lines changed: 48 additions & 2 deletions

File tree

src/shared/__tests__/checkExistApiConfig.spec.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,4 +86,36 @@ describe("checkExistKey", () => {
8686
}
8787
expect(checkExistKey(config)).toBe(false)
8888
})
89+
90+
it("should return false for zoo-gateway without session token or auth", () => {
91+
const config: ProviderSettings = {
92+
apiProvider: "zoo-gateway",
93+
zooGatewayModelId: "alibaba/qwen-3.6-max-preview",
94+
}
95+
expect(checkExistKey(config)).toBe(false)
96+
expect(checkExistKey(config, false)).toBe(false)
97+
})
98+
99+
it("should return true for zoo-gateway when profile has zooSessionToken", () => {
100+
const config: ProviderSettings = {
101+
apiProvider: "zoo-gateway",
102+
zooSessionToken: "zoo_ext_test_token",
103+
}
104+
expect(checkExistKey(config)).toBe(true)
105+
})
106+
107+
it("should return true for zoo-gateway when Zoo Code session auth is active", () => {
108+
const config: ProviderSettings = {
109+
apiProvider: "zoo-gateway",
110+
zooGatewayModelId: "alibaba/qwen-3.6-max-preview",
111+
}
112+
expect(checkExistKey(config, true)).toBe(true)
113+
})
114+
115+
it("should ignore zooCodeIsAuthenticated for non-zoo-gateway providers", () => {
116+
const config: ProviderSettings = {
117+
apiProvider: "openrouter",
118+
}
119+
expect(checkExistKey(config, true)).toBe(false)
120+
})
89121
})

src/shared/checkExistApiConfig.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
import { SECRET_STATE_KEYS, GLOBAL_SECRET_KEYS, ProviderSettings } from "@roo-code/types"
22

3-
export function checkExistKey(config: ProviderSettings | undefined) {
3+
/**
4+
* Returns whether a provider profile is sufficiently configured to leave the
5+
* welcome/setup gate.
6+
*
7+
* `zooCodeIsAuthenticated` is needed for Zoo Gateway: auth lives in global
8+
* secret storage (`zoo-code-auth`), and `zooSessionToken` is not part of
9+
* `SECRET_STATE_KEYS`, so session-auth alone would otherwise look unconfigured.
10+
*/
11+
export function checkExistKey(config: ProviderSettings | undefined, zooCodeIsAuthenticated?: boolean) {
412
if (!config) {
513
return false
614
}
@@ -10,6 +18,12 @@ export function checkExistKey(config: ProviderSettings | undefined) {
1018
return true
1119
}
1220

21+
// Zoo Gateway uses session auth (profile token and/or global Zoo Code login),
22+
// not a traditional API key listed in SECRET_STATE_KEYS.
23+
if (config.apiProvider === "zoo-gateway") {
24+
return Boolean(config.zooSessionToken) || Boolean(zooCodeIsAuthenticated)
25+
}
26+
1327
// Check all secret keys from the centralized SECRET_STATE_KEYS array.
1428
// Filter out keys that are not part of ProviderSettings (global secrets are stored separately)
1529
const providerSecretKeys = SECRET_STATE_KEYS.filter((key) => !GLOBAL_SECRET_KEYS.includes(key as any))

webview-ui/src/context/ExtensionStateContext.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ export const ExtensionStateContextProvider: React.FC<{ children: React.ReactNode
317317
case "state": {
318318
const newState = message.state ?? {}
319319
setState((prevState) => mergeExtensionState(prevState, newState))
320-
setShowWelcome(!checkExistKey(newState.apiConfiguration))
320+
setShowWelcome(!checkExistKey(newState.apiConfiguration, newState.zooCodeIsAuthenticated))
321321
setDidHydrateState(true)
322322
// Update alwaysAllowFollowupQuestions if present in state message
323323
if ((newState as any).alwaysAllowFollowupQuestions !== undefined) {

0 commit comments

Comments
 (0)