diff --git a/desktop/src/features/agents/useGlobalAgentConfig.ts b/desktop/src/features/agents/useGlobalAgentConfig.ts index 7b5e09191..b2d1f8383 100644 --- a/desktop/src/features/agents/useGlobalAgentConfig.ts +++ b/desktop/src/features/agents/useGlobalAgentConfig.ts @@ -33,7 +33,7 @@ export function useGlobalAgentConfig(): { globalConfig: GlobalAgentConfig; isLoading: boolean; } { - const { data, isPending } = useQuery({ + const { data, isPending, isPlaceholderData } = useQuery({ queryKey: globalAgentConfigQueryKey, queryFn: getGlobalAgentConfig, // Config is only mutated via setGlobalAgentConfig — treat as stable until @@ -45,7 +45,7 @@ export function useGlobalAgentConfig(): { return { globalConfig: data ?? EMPTY_CONFIG, - isLoading: isPending, + isLoading: isPending || isPlaceholderData, }; } diff --git a/desktop/src/testing/e2eBridge.ts b/desktop/src/testing/e2eBridge.ts index 7f1210066..87af0cd64 100644 --- a/desktop/src/testing/e2eBridge.ts +++ b/desktop/src/testing/e2eBridge.ts @@ -383,6 +383,8 @@ type E2eConfig = { model: string | null; preferred_runtime?: string | null; }; + /** Delay (ms) applied to `get_global_agent_config`. */ + globalAgentConfigDelayMs?: number; /** File-layer config returned by runtime id. */ runtimeFileConfigs?: Record; /** Baked build env returned by the display and key-name Tauri commands. */ @@ -10524,6 +10526,13 @@ export function maybeInstallE2eTauriMocks() { return config.mock?.runtimeFileConfigs?.[runtimeId] ?? null; } case "get_global_agent_config": { + const globalAgentConfigDelayMs = + config?.mock?.globalAgentConfigDelayMs ?? 0; + if (globalAgentConfigDelayMs > 0) { + await new Promise((resolve) => + window.setTimeout(resolve, globalAgentConfigDelayMs), + ); + } // Return the mutable persisted mock value, seeded from the test config. return ( mockGlobalAgentConfig ?? { diff --git a/desktop/tests/e2e/onboarding.spec.ts b/desktop/tests/e2e/onboarding.spec.ts index 3a940160b..26e9faac9 100644 --- a/desktop/tests/e2e/onboarding.spec.ts +++ b/desktop/tests/e2e/onboarding.spec.ts @@ -2710,7 +2710,15 @@ test("first-run onboarding lands before Welcome team bootstrap completes", async await seedActiveIdentity(page, BLANK_TYLER_IDENTITY); await installMockBridge( page, - { createManagedAgentDelayMs: 1_000 }, + { + createManagedAgentDelayMs: 1_000, + globalAgentConfigDelayMs: 250, + globalAgentConfig: { + env_vars: { OPENAI_COMPAT_API_KEY: "e2e-placeholder" }, + provider: "openai", + model: "gpt-5.5", + }, + }, { skipOnboardingSeed: true }, ); await page.goto("/");