From da13905b75160a031e23c5a11355e957c3bc65ae Mon Sep 17 00:00:00 2001 From: Simon Pinfold Date: Fri, 23 Oct 2026 18:12:26 -0700 Subject: [PATCH 1/6] feat(agent): open the local agent panel for two launches like Cloud Local Desktop opened the agent panel on every launch until the user agreed to the consent card, even after Skip. Use the same two-visit startup window as Cloud instead: the panel opens on the first two launches, then stays closed unless the user opens it. Skip was already remembered locally per account and workspace, so the card still returns only when the user sends a message, and a local Skip still writes no account-wide refusal. With no policy left using the locked startup, remove it. --- .../tests/agent/desktopAgentConsent.spec.ts | 19 ++++- src/extensions/core/agentPanel.test.ts | 82 +++++++++++-------- src/extensions/core/agentPanel.ts | 41 +--------- .../extensions/agent/AgentPanelRoot.test.ts | 26 ++++++ .../agent/stores/agent/agentPanelStore.ts | 3 - 5 files changed, 93 insertions(+), 78 deletions(-) diff --git a/browser_tests/tests/agent/desktopAgentConsent.spec.ts b/browser_tests/tests/agent/desktopAgentConsent.spec.ts index feed45a8c80..a504ee02b59 100644 --- a/browser_tests/tests/agent/desktopAgentConsent.spec.ts +++ b/browser_tests/tests/agent/desktopAgentConsent.spec.ts @@ -16,7 +16,7 @@ test.describe('Desktop Agent consent', { tag: ['@desktop', '@ui'] }, () => { initialLocalStorage: { [AGENT_COACH_SEEN_KEY]: 'true' } }) - test('keeps the panel locked after Skip and asks again only on Send', async ({ + test('remembers Skip, opens the panel for two launches, and asks again only on Send', async ({ comfyPage, agentPanel, agentConsentWrites, @@ -49,7 +49,7 @@ test.describe('Desktop Agent consent', { tag: ['@desktop', '@ui'] }, () => { await expect(agentPanel.consentDialog).toHaveCount(0) }) - await test.step('The next launch keeps the locked panel without repeating the introduction', async () => { + await test.step('The second launch opens the panel again without repeating the introduction', async () => { await agentPanel.openButton.click() await expect(agentPanel.root).toHaveCount(0) await expect(agentPanel.openButton).toHaveAttribute( @@ -62,6 +62,21 @@ test.describe('Desktop Agent consent', { tag: ['@desktop', '@ui'] }, () => { expect(agentConsentWrites).toEqual([]) }) + await test.step('The third launch leaves the closed panel and the card closed', async () => { + await agentPanel.openButton.click() + await expect(agentPanel.root).toHaveCount(0) + await comfyPage.workflow.reloadAndWaitForApp() + await expect(agentPanel.openButton).toHaveAttribute( + 'aria-pressed', + 'false' + ) + await expect(agentPanel.root).toHaveCount(0) + await expect(agentPanel.consentDialog).toHaveCount(0) + await agentPanel.openButton.click() + await expect(agentPanel.root).toBeVisible() + expect(agentConsentWrites).toEqual([]) + }) + await test.step('Send requests consent while preserving the original draft', async () => { await agentPanel.composer.fill('Keep this Desktop draft until consent') await agentPanel.sendButton.click() diff --git a/src/extensions/core/agentPanel.test.ts b/src/extensions/core/agentPanel.test.ts index 2c3a667c733..e337064e40c 100644 --- a/src/extensions/core/agentPanel.test.ts +++ b/src/extensions/core/agentPanel.test.ts @@ -280,10 +280,9 @@ describe('AgentPanel extension flag gate', () => { ) }) - it('keeps Local introduction and its locked panel independent of Cloud refusal', async () => { + it('keeps Local introduction and its startup panel independent of Cloud refusal', async () => { useSettingStore().settingValues[AGENT_CONSENT_OFFER_DECLINED_SETTING_ID] = true - localStorage.setItem(ACTIVATION_VISITS_STORAGE_KEY, '2') await loadEntryAndSetup() await flush() @@ -299,11 +298,10 @@ describe('AgentPanel extension flag gate', () => { visits: '0' }, { - session: 'signed in after discovery', + session: 'signed in on second visit', user: { id: 'account-a' }, - visits: '2' - }, - { session: 'signed out after discovery', user: null, visits: '2' } + visits: '1' + } ])('offers consent on startup when $session', async ({ user, visits }) => { currentUser.value = user localStorage.setItem(ACTIVATION_VISITS_STORAGE_KEY, visits) @@ -322,6 +320,23 @@ describe('AgentPanel extension flag gate', () => { ) }) + it.for([ + { session: 'signed out', user: null }, + { session: 'signed in', user: { id: 'account-a' } } + ])( + 'leaves the panel and card closed when $session after the two activation visits', + async ({ user }) => { + currentUser.value = user + localStorage.setItem(ACTIVATION_VISITS_STORAGE_KEY, '2') + + await loadEntryAndSetup() + await flush() + + expect(agentStore.isVisible).toBe(false) + expect(useAgentConsent().withConsent).not.toHaveBeenCalled() + } + ) + it.for([ { surface: 'dialog', hold: openDialog, release: closeDialog }, { @@ -391,7 +406,7 @@ describe('AgentPanel extension flag gate', () => { workspaceId: null } ])( - 'keeps only the locked panel when initial $restore arrives late after an earlier Skip', + 'opens only the startup panel when initial $restore arrives late after an earlier Skip', async ({ user, initialized, workspaceId }) => { currentUser.value = user isAuthInitialized.value = initialized @@ -401,7 +416,7 @@ describe('AgentPanel extension flag gate', () => { 'Comfy.AgentConsent.IntroductionResponded.account-a.workspace-a', 'true' ) - localStorage.setItem(ACTIVATION_VISITS_STORAGE_KEY, '2') + localStorage.setItem(ACTIVATION_VISITS_STORAGE_KEY, '1') await loadEntryAndSetup() await flush() @@ -438,43 +453,39 @@ describe('AgentPanel extension flag gate', () => { }) it.for([ - { session: 'signed out', user: null, scope: 'signed-out' }, - { - session: 'signed in', - user: { id: 'account-a' }, - scope: 'account-a.workspace-a' - } + { session: 'signed out', user: null }, + { session: 'signed in', user: { id: 'account-a' } } ])( - 'opens the locked panel on every $session launch after Skip', - async ({ user, scope }) => { + 'remembers a $session Skip across launches and opens the panel only for the two activation visits', + async ({ user }) => { currentUser.value = user - localStorage.setItem( - `Comfy.AgentConsent.IntroductionResponded.${scope}`, - 'true' + vi.mocked(useAgentConsent().withConsent).mockImplementationOnce( + async (_trigger, _onAccept, hooks) => { + if (hooks?.canShow?.() === false) return + hooks?.onShown?.() + useAgentConsentIntroductionStore().markResponded() + } ) - localStorage.setItem(ACTIVATION_VISITS_STORAGE_KEY, '2') - openDialog() + const relaunch = async (): Promise => { + agentStore.close('close_button') + setupScope.stop() + setupScope = effectScope() + await loadEntryAndSetup() + await flush() + } await loadEntryAndSetup() await flush() - expect(agentStore.isVisible).toBe(false) - - closeDialog() - await flush() + expect(useAgentConsent().withConsent).toHaveBeenCalledOnce() expect(agentStore.isVisible).toBe(true) - expect(useAgentConsent().withConsent).not.toHaveBeenCalled() - agentStore.close('close_button') - setAgentReady(true) - await flush() - expect(agentStore.isVisible).toBe(false) - setupScope.stop() - setupScope = effectScope() - - await loadEntryAndSetup() - await flush() + await relaunch() expect(agentStore.isVisible).toBe(true) expect(localStorage.getItem(ACTIVATION_VISITS_STORAGE_KEY)).toBe('2') + + await relaunch() + expect(agentStore.isVisible).toBe(false) + expect(useAgentConsent().withConsent).toHaveBeenCalledOnce() } ) @@ -487,7 +498,6 @@ describe('AgentPanel extension flag gate', () => { async ({ agent }) => { currentUser.value = null Object.assign(agentStore, { comfyAgent: agent, flagsSettled: true }) - localStorage.setItem(ACTIVATION_VISITS_STORAGE_KEY, '2') await loadEntryAndSetup() await flush() diff --git a/src/extensions/core/agentPanel.ts b/src/extensions/core/agentPanel.ts index f95f0bc95f3..e84fe8dd143 100644 --- a/src/extensions/core/agentPanel.ts +++ b/src/extensions/core/agentPanel.ts @@ -237,7 +237,6 @@ export function registerAgentPanelExtension(): void { } const consentCardSeenIn = new Set() - let lockedStartupOpened = false let activationOpenedPanel = false whenever( () => dialogStore.isDialogOpen(CONSENT_DIALOG_KEY), @@ -288,10 +287,6 @@ export function registerAgentPanelExtension(): void { holdOffer(held, candidateUserId, offeredWorkspaceId ?? undefined) return false } - if (agentPanelStore.onboarding.startup !== 'lockedUntilConsent') - return true - if (!agentPanelStore.enabled) return false - if (!agentPanelStore.isOpen) agentPanelStore.open('automatic_consent') return true } @@ -357,7 +352,7 @@ export function registerAgentPanelExtension(): void { const candidateUserId = resolvedUserInfo.value?.id const offeredWorkspaceId = workspaceStore.activeWorkspaceId - const { offerMemory, startup } = agentPanelStore.onboarding + const { offerMemory } = agentPanelStore.onboarding const key = offerMemory === 'shown' ? claimOneShotOffer(candidateUserId, offeredWorkspaceId) @@ -367,15 +362,13 @@ export function registerAgentPanelExtension(): void { const offeredIdentity = consentStore.identity autoShowInFlight = true dropHold() - if (startup === 'activationVisits') - agentPanelStore.suppressRestoredOpen() + agentPanelStore.suppressRestoredOpen() void withConsent( 'first_load', () => { if ( !agentPanelStore.enabled || - (startup === 'activationVisits' && - automaticActivationVisitsComplete()) || + automaticActivationVisitsComplete() || agentPanelStore.isOpen ) return @@ -391,28 +384,7 @@ export function registerAgentPanelExtension(): void { ).finally(() => finishAutomaticOffer(offeredIdentity)) } - function prepareLockedStartup(): boolean { - if ( - !agentPanelStore.enabled || - !isAuthInitialized.value || - consentStore.isChecking || - consentStore.accepted - ) - return false - const held = screenHolder() - if (held) { - holdOffer(held) - return false - } - if (lockedStartupOpened) return true - lockedStartupOpened = true - if (!agentPanelStore.isOpen) agentPanelStore.open('activation') - return true - } - function prepareStartupPanel(): boolean { - if (agentPanelStore.onboarding.startup === 'lockedUntilConsent') - return prepareLockedStartup() if (!automaticActivationVisitsComplete() || agentPanelStore.isOpen) return true reportOfferExit('activation_window_complete', 'startup') @@ -454,12 +426,7 @@ export function registerAgentPanelExtension(): void { let activationPending = false let activationOffered = false const openWhenStartupDecided = (): void => { - if ( - agentPanelStore.onboarding.startup !== 'activationVisits' || - !agentPanelStore.enabled || - activationPending || - activationOffered - ) + if (!agentPanelStore.enabled || activationPending || activationOffered) return activationPending = true whenStartupDecided() diff --git a/src/workbench/extensions/agent/AgentPanelRoot.test.ts b/src/workbench/extensions/agent/AgentPanelRoot.test.ts index d8839dfc111..5a9d944a5a7 100644 --- a/src/workbench/extensions/agent/AgentPanelRoot.test.ts +++ b/src/workbench/extensions/agent/AgentPanelRoot.test.ts @@ -35,6 +35,7 @@ import { i18n } from '@/i18n' import GlobalDialog from '@/components/dialog/GlobalDialog.vue' import { useCurrentUser } from '@/composables/auth/useCurrentUser' import { useAgentConsentStore } from '@/workbench/extensions/agent/stores/agent/agentConsentStore' +import { useAgentConsentIntroductionStore } from '@/workbench/extensions/agent/stores/agent/agentConsentIntroductionStore' import { setupInlinePromptEditorDom } from './components/agent/composer/inlinePromptEditorTestSetup' import { useAgentConsent } from './composables/agent/useAgentConsent' import { useFreeUsePlacement } from './experiments/freeUsePlacement' @@ -6720,6 +6721,31 @@ describe('AgentPanelRoot workflow binding', () => { expect(useAgentComposerStore().draft).toBe('build me a workflow') }) + it('asks a signed-in Desktop user who skipped the startup card for consent on send', async () => { + distribution.isCloud = false + distribution.isDesktop = true + makeTab('wf-42') + Object.assign(useTeamWorkspaceStore(), { + activeWorkspaceId: 'workspace-a' + }) + expect(useAgentConsentIntroductionStore().markResponded()).toBe(true) + Object.assign(useAgentConsentStore(), { accepted: false }) + withConsent.mockResolvedValueOnce() + const bodies = mockMessagesEndpoint('wf-42') + renderWithSelectedTarget() + + await userEvent.click(screen.getByRole('textbox')) + await userEvent.paste('build me a workflow') + await userEvent.click(screen.getByRole('button', { name: 'Send' })) + await waitFor(() => expect(useAgentComposerStore().submission).toBeNull()) + + expect(withConsent).toHaveBeenCalledExactlyOnceWith( + 'first_message', + expect.any(Function) + ) + expect(bodies).toHaveLength(0) + }) + it.for([ { scenario: 'the pending submission is canceled', diff --git a/src/workbench/extensions/agent/stores/agent/agentPanelStore.ts b/src/workbench/extensions/agent/stores/agent/agentPanelStore.ts index 529242b8658..3196e080b94 100644 --- a/src/workbench/extensions/agent/stores/agent/agentPanelStore.ts +++ b/src/workbench/extensions/agent/stores/agent/agentPanelStore.ts @@ -42,7 +42,6 @@ const OPEN_STORAGE_KEY = 'Comfy.AgentPanel.open' const DISCOVERED_STORAGE_KEY = 'Comfy.AgentPanel.discovered' interface AgentOnboardingPolicy { - startup: 'activationVisits' | 'lockedUntilConsent' offerMemory: 'shown' | 'answered' agentButton: 'requestConsent' | 'togglePanel' persistSkipAsRefusal: boolean @@ -50,7 +49,6 @@ interface AgentOnboardingPolicy { } const DEFAULT_ONBOARDING: AgentOnboardingPolicy = { - startup: 'activationVisits', offerMemory: 'shown', agentButton: 'requestConsent', persistSkipAsRefusal: true, @@ -58,7 +56,6 @@ const DEFAULT_ONBOARDING: AgentOnboardingPolicy = { } const DESKTOP_ONBOARDING: AgentOnboardingPolicy = { - startup: 'lockedUntilConsent', offerMemory: 'answered', agentButton: 'togglePanel', persistSkipAsRefusal: false, From cdeb475eb37ad367aa9ee1d4a0cecfaabdf16484 Mon Sep 17 00:00:00 2001 From: Simon Pinfold Date: Fri, 23 Oct 2026 18:26:23 -0700 Subject: [PATCH 2/6] docs(agent): describe the Desktop startup panel's activation visits Update the Desktop introduction ADR for the two-visit startup panel, and check that the second launch shows no card. --- ...esktop-introduction-response-is-not-consent.md | 15 ++++++++------- src/extensions/core/agentPanel.test.ts | 1 + 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/docs/adr/AGENT-CONSENT-0045-desktop-introduction-response-is-not-consent.md b/docs/adr/AGENT-CONSENT-0045-desktop-introduction-response-is-not-consent.md index dfc40e810f2..eb3ba22dc74 100644 --- a/docs/adr/AGENT-CONSENT-0045-desktop-introduction-response-is-not-consent.md +++ b/docs/adr/AGENT-CONSENT-0045-desktop-introduction-response-is-not-consent.md @@ -23,16 +23,17 @@ key: `signed-out`, or the account and workspace. Signed-out users can respond, the response survives restarts, and a scope that has not answered still gets one card. -For eligible, ready Desktop installations, unfinished consent opens the locked -panel on each startup after authentication and onboarding settle, independently -of Cloud's activation visit limit. The response marker suppresses only the -startup introduction for its scope, so signing in or switching to an -unanswered account or workspace queues a card after the screen clears. The Local entry button only -toggles the panel; Send owns the consent request. +For eligible, ready Desktop installations, the panel opens automatically on +startup for Cloud's activation visits, whether or not the user skipped consent or +closed the panel, and then stops. The response marker suppresses only the +startup introduction for its scope. While visits remain, or while the panel is +open, signing in or switching to an unanswered account or workspace queues a +card after the screen clears. The Local entry button only toggles the panel; +Send owns the consent request. Cloud's account-wide explicit-refusal preference remains separate. Desktop Skip does not write that preference, and an existing Cloud refusal does not suppress -the Desktop introduction or recurring locked panel. Neither preference records +the Desktop introduction or the startup panel. Neither preference records audited server consent. `agentPanelStore` selects one onboarding policy for the whole frontend, and no diff --git a/src/extensions/core/agentPanel.test.ts b/src/extensions/core/agentPanel.test.ts index e337064e40c..6dd0fd1e9fa 100644 --- a/src/extensions/core/agentPanel.test.ts +++ b/src/extensions/core/agentPanel.test.ts @@ -482,6 +482,7 @@ describe('AgentPanel extension flag gate', () => { await relaunch() expect(agentStore.isVisible).toBe(true) expect(localStorage.getItem(ACTIVATION_VISITS_STORAGE_KEY)).toBe('2') + expect(useAgentConsent().withConsent).toHaveBeenCalledOnce() await relaunch() expect(agentStore.isVisible).toBe(false) From 7e6f27811f214d31154154ba3363af991ebaa7e7 Mon Sep 17 00:00:00 2001 From: Simon Pinfold Date: Sat, 24 Oct 2026 13:18:13 -0700 Subject: [PATCH 3/6] test(agent): a queued Desktop consent card leaves a closed panel closed The locked startup used to reopen the panel whenever it showed the card. Like Cloud, the card now opens the panel only when the user agrees. --- src/extensions/core/agentPanel.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/extensions/core/agentPanel.test.ts b/src/extensions/core/agentPanel.test.ts index 6dd0fd1e9fa..f65cbf072f1 100644 --- a/src/extensions/core/agentPanel.test.ts +++ b/src/extensions/core/agentPanel.test.ts @@ -384,7 +384,7 @@ describe('AgentPanel extension flag gate', () => { await flush() expect(useAgentConsent().withConsent).toHaveBeenCalledOnce() - expect(agentStore.isVisible).toBe(true) + expect(agentStore.isVisible).toBe(false) expect( localStorage.getItem( 'Comfy.AgentConsent.IntroductionResponded.signed-out' From 19935932a60889baa12a4c1336fe159daff3fd12 Mon Sep 17 00:00:00 2001 From: Simon Pinfold Date: Sat, 24 Oct 2026 13:58:11 -0700 Subject: [PATCH 4/6] refactor(agent): inline the startup consent card's screen check With the locked startup gone, the helper only re-checked whether something holds the screen, so it moves into its single caller. --- src/extensions/core/agentPanel.ts | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/extensions/core/agentPanel.ts b/src/extensions/core/agentPanel.ts index e84fe8dd143..9c8afe5ceb0 100644 --- a/src/extensions/core/agentPanel.ts +++ b/src/extensions/core/agentPanel.ts @@ -278,18 +278,6 @@ export function registerAgentPanelExtension(): void { ? 'account_unresolved' : 'workspace_unresolved' - function prepareConsentCard( - candidateUserId: string | undefined, - offeredWorkspaceId: string | null - ): boolean { - const held = screenHolder() - if (held) { - holdOffer(held, candidateUserId, offeredWorkspaceId ?? undefined) - return false - } - return true - } - function claimOneShotOffer( candidateUserId: string | undefined, offeredWorkspaceId: string | null @@ -378,8 +366,16 @@ export function registerAgentPanelExtension(): void { onShown: () => { if (key) writeAutoShown(key, true) }, - canShow: () => - prepareConsentCard(candidateUserId, offeredWorkspaceId) + canShow: () => { + const held = screenHolder() + if (held) + holdOffer( + held, + candidateUserId, + offeredWorkspaceId ?? undefined + ) + return held === null + } } ).finally(() => finishAutomaticOffer(offeredIdentity)) } From 7b6b7ad073bb06ee870035874dc8698ec49bda99 Mon Sep 17 00:00:00 2001 From: Simon Pinfold Date: Sat, 24 Oct 2026 14:17:12 -0700 Subject: [PATCH 5/6] test(agent): drop the duplicate Desktop send-consent case The signed-out Desktop send test and the Desktop e2e Send step already cover consent on send after Skip. --- .../extensions/agent/AgentPanelRoot.test.ts | 26 ------------------- 1 file changed, 26 deletions(-) diff --git a/src/workbench/extensions/agent/AgentPanelRoot.test.ts b/src/workbench/extensions/agent/AgentPanelRoot.test.ts index 5a9d944a5a7..d8839dfc111 100644 --- a/src/workbench/extensions/agent/AgentPanelRoot.test.ts +++ b/src/workbench/extensions/agent/AgentPanelRoot.test.ts @@ -35,7 +35,6 @@ import { i18n } from '@/i18n' import GlobalDialog from '@/components/dialog/GlobalDialog.vue' import { useCurrentUser } from '@/composables/auth/useCurrentUser' import { useAgentConsentStore } from '@/workbench/extensions/agent/stores/agent/agentConsentStore' -import { useAgentConsentIntroductionStore } from '@/workbench/extensions/agent/stores/agent/agentConsentIntroductionStore' import { setupInlinePromptEditorDom } from './components/agent/composer/inlinePromptEditorTestSetup' import { useAgentConsent } from './composables/agent/useAgentConsent' import { useFreeUsePlacement } from './experiments/freeUsePlacement' @@ -6721,31 +6720,6 @@ describe('AgentPanelRoot workflow binding', () => { expect(useAgentComposerStore().draft).toBe('build me a workflow') }) - it('asks a signed-in Desktop user who skipped the startup card for consent on send', async () => { - distribution.isCloud = false - distribution.isDesktop = true - makeTab('wf-42') - Object.assign(useTeamWorkspaceStore(), { - activeWorkspaceId: 'workspace-a' - }) - expect(useAgentConsentIntroductionStore().markResponded()).toBe(true) - Object.assign(useAgentConsentStore(), { accepted: false }) - withConsent.mockResolvedValueOnce() - const bodies = mockMessagesEndpoint('wf-42') - renderWithSelectedTarget() - - await userEvent.click(screen.getByRole('textbox')) - await userEvent.paste('build me a workflow') - await userEvent.click(screen.getByRole('button', { name: 'Send' })) - await waitFor(() => expect(useAgentComposerStore().submission).toBeNull()) - - expect(withConsent).toHaveBeenCalledExactlyOnceWith( - 'first_message', - expect.any(Function) - ) - expect(bodies).toHaveLength(0) - }) - it.for([ { scenario: 'the pending submission is canceled', From b6659f6f2970ec34397b228b2dbb0fba5343adc0 Mon Sep 17 00:00:00 2001 From: Simon Pinfold Date: Sat, 24 Oct 2026 14:30:38 -0700 Subject: [PATCH 6/6] fix(agent): skip the startup consent card if the agent stops being ready The removed Desktop path checked that the agent was still enabled before showing the card; keep that check now that both hosts share one path. Also qualify the ADR's one-card sentence by the startup rules. --- ...top-introduction-response-is-not-consent.md | 4 ++-- src/extensions/core/agentPanel.test.ts | 18 ++++++++++++++++++ src/extensions/core/agentPanel.ts | 2 +- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/docs/adr/AGENT-CONSENT-0045-desktop-introduction-response-is-not-consent.md b/docs/adr/AGENT-CONSENT-0045-desktop-introduction-response-is-not-consent.md index eb3ba22dc74..6b0114cb782 100644 --- a/docs/adr/AGENT-CONSENT-0045-desktop-introduction-response-is-not-consent.md +++ b/docs/adr/AGENT-CONSENT-0045-desktop-introduction-response-is-not-consent.md @@ -20,8 +20,8 @@ account/workspace consent setting. Only Agree or Skip sets this marker; display and dismissal do not. The marker controls automatic startup offers, never Agent access. It lives in renderer storage, keyed by scope like Cloud's one-shot offer key: `signed-out`, or the account and workspace. Signed-out users can respond, -the response survives restarts, and a scope that has not answered still gets -one card. +the response survives restarts, and a scope that has not answered can still +get a card under the startup rules below. For eligible, ready Desktop installations, the panel opens automatically on startup for Cloud's activation visits, whether or not the user skipped consent or diff --git a/src/extensions/core/agentPanel.test.ts b/src/extensions/core/agentPanel.test.ts index f65cbf072f1..8f6183b36d1 100644 --- a/src/extensions/core/agentPanel.test.ts +++ b/src/extensions/core/agentPanel.test.ts @@ -280,6 +280,24 @@ describe('AgentPanel extension flag gate', () => { ) }) + it('does not show the startup card once the agent stops being ready before it mounts', async () => { + currentUser.value = null + let canShow: boolean | undefined + vi.mocked(useAgentConsent().withConsent).mockImplementationOnce( + async (_trigger, _onAccept, hooks) => { + setAgentReady(false) + await nextTick() + canShow = hooks?.canShow?.() + } + ) + + await loadEntryAndSetup() + await flush() + + expect(useAgentConsent().withConsent).toHaveBeenCalledOnce() + expect(canShow).toBe(false) + }) + it('keeps Local introduction and its startup panel independent of Cloud refusal', async () => { useSettingStore().settingValues[AGENT_CONSENT_OFFER_DECLINED_SETTING_ID] = true diff --git a/src/extensions/core/agentPanel.ts b/src/extensions/core/agentPanel.ts index 9c8afe5ceb0..7286bfb6b76 100644 --- a/src/extensions/core/agentPanel.ts +++ b/src/extensions/core/agentPanel.ts @@ -374,7 +374,7 @@ export function registerAgentPanelExtension(): void { candidateUserId, offeredWorkspaceId ?? undefined ) - return held === null + return held === null && agentPanelStore.enabled } } ).finally(() => finishAutomaticOffer(offeredIdentity))