diff --git a/src/workbench/extensions/agent/AgentPanelRoot.test.ts b/src/workbench/extensions/agent/AgentPanelRoot.test.ts index fe7c0aba59c..3088d55b0b1 100644 --- a/src/workbench/extensions/agent/AgentPanelRoot.test.ts +++ b/src/workbench/extensions/agent/AgentPanelRoot.test.ts @@ -522,6 +522,31 @@ describe('AgentPanelRoot onboarding', () => { localStorage.removeItem(SCOPED_KEY) }) + it('shows the scoped coach after first consent despite a legacy seen flag', async () => { + localStorage.setItem('Comfy.AgentPanel.onboarded', 'true') + const consentStore = useAgentConsentStore() + Object.assign(consentStore, { accepted: false }) + + render(AgentPanelRoot, { global: { plugins: [i18n] } }) + expect(localStorage.getItem(SCOPED_KEY)).toBeNull() + + Object.assign(consentStore, { accepted: true }) + + expect( + await screen.findByRole('dialog', { name: 'Meet your Comfy Agent' }) + ).toBeInTheDocument() + expect(localStorage.getItem(SCOPED_KEY)).not.toBe('true') + }) + + it('still carries the legacy seen flag for an already-consented scope', () => { + localStorage.setItem('Comfy.AgentPanel.onboarded', 'true') + + render(AgentPanelRoot, { global: { plugins: [i18n] } }) + + expect(localStorage.getItem(SCOPED_KEY)).toBe('true') + expect(localStorage.getItem('Comfy.AgentPanel.onboarded')).toBeNull() + }) + it('defers the tour in App Mode without completing it or blocking the composer', async () => { canvasStore.linearMode = true render(AgentPanelRoot, { global: { plugins: [i18n] } }) diff --git a/src/workbench/extensions/agent/AgentPanelRoot.vue b/src/workbench/extensions/agent/AgentPanelRoot.vue index 159e576c541..4af5896475a 100644 --- a/src/workbench/extensions/agent/AgentPanelRoot.vue +++ b/src/workbench/extensions/agent/AgentPanelRoot.vue @@ -279,7 +279,10 @@ const onboardingKey = computed(() => watch( onboardingKey, (key) => { - if (key) adoptSharedOnboardingFlag(key) + // Only carry the pre-consent, device-wide flag into a scope that had + // already accepted consent when it loaded. A newly consenting scope has + // not seen this scoped tour yet and should receive it once. + if (key && consentAccepted.value) adoptSharedOnboardingFlag(key) }, { immediate: true } )