diff --git a/src/renderer/src/components/contextual-tours/workspace-creation-tour-handoff.test.ts b/src/renderer/src/components/contextual-tours/workspace-creation-tour-handoff.test.ts index 4a863157ae9..386ab6a4ead 100644 --- a/src/renderer/src/components/contextual-tours/workspace-creation-tour-handoff.test.ts +++ b/src/renderer/src/components/contextual-tours/workspace-creation-tour-handoff.test.ts @@ -42,6 +42,7 @@ describe('openWorkspaceCreationComposerWithTourHandoff', () => { it('hands off from the agent sessions create-worktree step to the workspace-creation tour', () => { const openModal = vi.fn() const detachContextualTourSource = vi.fn() + const completeContextualTour = vi.fn() let activeModal: ReturnType['activeModal'] = 'none' vi.spyOn(useAppStore, 'getState').mockImplementation( () => @@ -53,6 +54,7 @@ describe('openWorkspaceCreationComposerWithTourHandoff', () => { contextualToursSeenIds: [], repos: [{ id: 'repo-1' }], detachContextualTourSource, + completeContextualTour, openModal }) as unknown as ReturnType ) @@ -63,6 +65,7 @@ describe('openWorkspaceCreationComposerWithTourHandoff', () => { 'workspace-agent-sessions', 'setup_guide_parallel_work' ) + expect(completeContextualTour).toHaveBeenCalledWith('workspace-agent-sessions') expect(openModal).toHaveBeenCalledWith('new-workspace-composer', { telemetrySource: 'sidebar', contextualTourSource: 'workspace_creation_modal' @@ -85,6 +88,7 @@ describe('openWorkspaceCreationComposerWithTourHandoff', () => { it('opens the composer without re-showing workspace creation when that tour was already seen', () => { const openModal = vi.fn() const detachContextualTourSource = vi.fn() + const completeContextualTour = vi.fn() vi.spyOn(useAppStore, 'getState').mockImplementation( () => ({ @@ -95,6 +99,7 @@ describe('openWorkspaceCreationComposerWithTourHandoff', () => { contextualToursSeenIds: ['workspace-creation'], repos: [{ id: 'repo-1' }], detachContextualTourSource, + completeContextualTour, openModal }) as unknown as ReturnType ) @@ -105,6 +110,7 @@ describe('openWorkspaceCreationComposerWithTourHandoff', () => { 'workspace-agent-sessions', 'setup_guide_parallel_work' ) + expect(completeContextualTour).toHaveBeenCalledWith('workspace-agent-sessions') expect(openModal).toHaveBeenCalledWith('new-workspace-composer', { telemetrySource: 'sidebar', contextualTourSource: 'workspace_creation_modal' diff --git a/src/renderer/src/components/contextual-tours/workspace-creation-tour-handoff.ts b/src/renderer/src/components/contextual-tours/workspace-creation-tour-handoff.ts index 8174108f34b..1c4e88c1f82 100644 --- a/src/renderer/src/components/contextual-tours/workspace-creation-tour-handoff.ts +++ b/src/renderer/src/components/contextual-tours/workspace-creation-tour-handoff.ts @@ -12,9 +12,11 @@ export function openWorkspaceCreationComposerWithTourHandoff(): void { state.activeContextualTourStepIndex === 1 if (shouldHandoffFromAgentSessionsTour && state.activeContextualTourSource) { - // Why: the composer modal cancels the terminal-owned tour; detaching first - // prevents the source cleanup from treating this intentional handoff as suppression. + // Why: clicking the highlighted create button is the final tour action. + // Clear it synchronously so the composer tour request is not blocked by + // a modal-cancellation effect that may run after the handoff retry window. state.detachContextualTourSource('workspace-agent-sessions', state.activeContextualTourSource) + state.completeContextualTour('workspace-agent-sessions') } state.openModal('new-workspace-composer', {