diff --git a/src/renderer/src/hooks/useIpcEvents-agent-status-pane-teardown.test.ts b/src/renderer/src/hooks/useIpcEvents-agent-status-pane-teardown.test.ts index f54ac9ade4b..b043abb4042 100644 --- a/src/renderer/src/hooks/useIpcEvents-agent-status-pane-teardown.test.ts +++ b/src/renderer/src/hooks/useIpcEvents-agent-status-pane-teardown.test.ts @@ -567,87 +567,4 @@ describe('useIpcEvents agent status snapshot integration', () => { expect(removeAgentStatus).not.toHaveBeenCalled() }) - - it('does not retain a Cursor spinner terminal title when the hook reports done', async () => { - const setAgentStatus = vi.fn() - const onSetListenerRef: { current: ((data: AgentStatusSetData) => void) | null } = { - current: null - } - - const storeState: StoreLike = buildStoreState({ - setAgentStatus, - workspaceSessionReady: true, - settings: { terminalFontSize: 13, notifications: { enabled: false } }, - tabsByWorktree: { - 'wt-1': [ - { - id: 'tab-future', - ptyId: 'pty-1', - worktreeId: 'wt-1', - title: '\u2839 Cursor Agent' - } - ] - }, - terminalLayoutsByTabId: { - 'tab-future': { - root: { type: 'leaf', leafId: FUTURE_LEAF_ID }, - activeLeafId: FUTURE_LEAF_ID, - expandedLeafId: null, - titlesByLeafId: { [FUTURE_LEAF_ID]: '\u2839 Cursor Agent' } - } - } - }) - - stubReactSyncEffect() - vi.doMock('../store', () => ({ - useAppStore: { - subscribe: vi.fn(() => () => {}), - getState: () => storeState - } - })) - stubAuxiliaryModules() - vi.stubGlobal( - 'window', - buildWindowApi({ - onSet: (cb) => { - onSetListenerRef.current = cb - return () => {} - } - }) - ) - - const { useIpcEvents } = await import('./useIpcEvents') - - useIpcEvents() - await Promise.resolve() - - if (typeof onSetListenerRef.current !== 'function') { - throw new Error('Expected agentStatus.onSet listener to be registered') - } - - onSetListenerRef.current({ - paneKey: FUTURE_PANE_KEY, - state: 'done', - prompt: 'cursor prompt', - agentType: 'cursor', - lastAssistantMessage: 'cursor completion', - receivedAt: 1_700_000_000_200, - stateStartedAt: 1_699_999_999_100 - }) - - expect(setAgentStatus).toHaveBeenCalledTimes(1) - expect(setAgentStatus).toHaveBeenCalledWith( - FUTURE_PANE_KEY, - expect.objectContaining({ - state: 'done', - prompt: 'cursor prompt', - agentType: 'cursor', - lastAssistantMessage: 'cursor completion' - }), - 'Cursor ready', - { updatedAt: 1_700_000_000_200, stateStartedAt: 1_699_999_999_100 }, - expectWorktreeRouting('wt-1'), - undefined - ) - }) }) diff --git a/src/renderer/src/hooks/useIpcEvents-agent-status-queue-ordering.test.ts b/src/renderer/src/hooks/useIpcEvents-agent-status-queue-ordering.test.ts index 536a8d88fc2..88f199bb3a4 100644 --- a/src/renderer/src/hooks/useIpcEvents-agent-status-queue-ordering.test.ts +++ b/src/renderer/src/hooks/useIpcEvents-agent-status-queue-ordering.test.ts @@ -350,75 +350,6 @@ describe('useIpcEvents agent status snapshot integration', () => { expect(replayedAfterThrow).toContain('buffered') }) - it('applies ready push events for an unmounted inactive terminal tab', async () => { - const setAgentStatus = vi.fn() - const onSetListenerRef: { current: ((data: AgentStatusSetData) => void) | null } = { - current: null - } - - const storeState: StoreLike = buildStoreState({ - setAgentStatus, - workspaceSessionReady: true, - settings: { terminalFontSize: 13, notifications: { enabled: false } }, - tabsByWorktree: { - 'wt-1': [{ id: 'tab-future', ptyId: 'pty-1', worktreeId: 'wt-1', title: 'Inactive Tab' }] - }, - terminalLayoutsByTabId: {} - }) - - stubReactSyncEffect() - vi.doMock('../store', () => ({ - useAppStore: { - subscribe: vi.fn(() => () => {}), - getState: () => storeState - } - })) - stubAuxiliaryModules() - vi.stubGlobal( - 'window', - buildWindowApi({ - onSet: (cb) => { - onSetListenerRef.current = cb - return () => {} - } - }) - ) - - const { useIpcEvents } = await import('./useIpcEvents') - - useIpcEvents() - await Promise.resolve() - - if (typeof onSetListenerRef.current !== 'function') { - throw new Error('Expected agentStatus.onSet listener to be registered') - } - - onSetListenerRef.current({ - paneKey: FUTURE_PANE_KEY, - state: 'done', - prompt: 'inactive prompt', - agentType: 'codex', - lastAssistantMessage: 'inactive completion', - receivedAt: 1_700_000_000_200, - stateStartedAt: 1_699_999_999_100 - }) - - expect(setAgentStatus).toHaveBeenCalledTimes(1) - expect(setAgentStatus).toHaveBeenCalledWith( - FUTURE_PANE_KEY, - expect.objectContaining({ - state: 'done', - prompt: 'inactive prompt', - agentType: 'codex', - lastAssistantMessage: 'inactive completion' - }), - 'Inactive Tab', - { updatedAt: 1_700_000_000_200, stateStartedAt: 1_699_999_999_100 }, - expectWorktreeRouting('wt-1'), - undefined - ) - }) - it('keeps a Codex permission attention row actionable', async () => { const setAgentStatus = vi.fn() const updateTabTitle = vi.fn() diff --git a/src/renderer/src/runtime/paired-reconnect-sidebar-agent-count.test.ts b/src/renderer/src/runtime/paired-reconnect-sidebar-agent-count.test.ts index a5f77f49b98..d6cf310c536 100644 --- a/src/renderer/src/runtime/paired-reconnect-sidebar-agent-count.test.ts +++ b/src/renderer/src/runtime/paired-reconnect-sidebar-agent-count.test.ts @@ -311,18 +311,6 @@ describe('STA-3107: sidebar agent rows survive a paired-client sleep/wake reconn expect(reconnected.rowPaneKeys.sort(), evidence).toEqual(PANES.map(mirrorPaneKey).sort()) }) - it('the erased rows are exactly the panes whose status only the client wrote', () => { - const store = seedPairedClientStore() - const reconnected = runSleepWakeReconnect(store, LONG_SLEEP_MS) - const missing = PANES.map(mirrorPaneKey).filter( - (paneKey) => !reconnected.rowPaneKeys.includes(paneKey) - ) - - // Pins the causal boundary: host-authoritative panes are republished with a - // fresh host timestamp and are never at risk; only client-owned panes are. - expect(missing).toEqual([]) - }) - it('still cedes a pane this renderer never wrote status for', () => { const store = seedPairedClientStore() applyHostSnapshot(store, makeHostSnapshot({ snapshotVersion: 1, hostNow: T0 - 1_000 }), T0) diff --git a/src/renderer/src/runtime/runtime-terminal-inspection.test.ts b/src/renderer/src/runtime/runtime-terminal-inspection.test.ts index ded589e26b1..d1d4dcc9fed 100644 --- a/src/renderer/src/runtime/runtime-terminal-inspection.test.ts +++ b/src/renderer/src/runtime/runtime-terminal-inspection.test.ts @@ -688,24 +688,6 @@ describe('runtime terminal owner routing', () => { expect(useAppStore.getState().lastTerminalInputAtByPaneKey[PANE_KEY]).toBeUndefined() }) - it('can record a runtime input marker from a PTY id mapping', () => { - useAppStore.setState({ - settings: { experimentalAgentHibernation: true } as never, - terminalLayoutsByTabId: { - 'tab-1': { - root: { type: 'leaf', leafId: LEAF_ID }, - activeLeafId: LEAF_ID, - expandedLeafId: null, - ptyIdsByLeafId: { [LEAF_ID]: 'local-pty' } - } - } - }) - - recordRuntimeTerminalInputForPtyId('local-pty', 123) - - expect(useAppStore.getState().lastTerminalInputAtByPaneKey[PANE_KEY]).toBe(123) - }) - it('indexes a stable layout identity once across repeated terminal input', () => { const layoutCount = 500 let layoutEnumerations = 0 diff --git a/src/renderer/src/runtime/web-session-tabs-sync-agent-handoff.test.ts b/src/renderer/src/runtime/web-session-tabs-sync-agent-handoff.test.ts index 054aa4bc60e..769e10ade52 100644 --- a/src/renderer/src/runtime/web-session-tabs-sync-agent-handoff.test.ts +++ b/src/renderer/src/runtime/web-session-tabs-sync-agent-handoff.test.ts @@ -303,45 +303,6 @@ describe('applyWebSessionTabsSnapshot', () => { }) }) - it('keeps stale local agent tabs when the host mirror is for a different agent', () => { - const staleLocalClaudeTab: TerminalTab = { - id: 'local-claude-tab', - ptyId: null, - worktreeId: WT, - title: 'Claude', - defaultTitle: 'Claude', - customTitle: null, - color: null, - sortOrder: 0, - createdAt: NOW, - launchAgent: 'claude' - } - - const patch = applyWebSessionTabsSnapshot( - makeState({ - tabsByWorktree: { [WT]: [staleLocalClaudeTab] } - }), - makeSnapshot([ - { - type: 'terminal', - id: HOST_SURFACE_ID, - title: 'Codex', - parentTabId: 'host-tab-1', - leafId: LEAF_ID, - isActive: true, - launchAgent: 'codex', - status: 'ready', - terminal: 'terminal-1' - } - ]), - ENV, - NOW - ) as Partial - - expect(patch.tabsByWorktree?.[WT]).toHaveLength(2) - expect(patch.tabsByWorktree?.[WT]?.some((tab) => tab.id === 'local-claude-tab')).toBe(true) - }) - it('resolves a canonical agent tab before its confirming snapshot arrives', () => { recordWebAgentSessionHandoff({ environmentId: ENV, diff --git a/src/renderer/src/runtime/web-session-tabs-sync-client-owned-page-content.test.ts b/src/renderer/src/runtime/web-session-tabs-sync-client-owned-page-content.test.ts index 0afebc83522..cb867b7430b 100644 --- a/src/renderer/src/runtime/web-session-tabs-sync-client-owned-page-content.test.ts +++ b/src/renderer/src/runtime/web-session-tabs-sync-client-owned-page-content.test.ts @@ -258,24 +258,6 @@ describe('browser rows this client hosts own their page content', () => { expect(syncedPage(applyStaleSnapshot(state), state)?.url).toBe(GUEST_URL) }) - it('keeps the local loading flag instead of the host create-time value', () => { - const state = stateWithLocalRow() - - expect(syncedPage(applyStaleSnapshot(state), state)?.loading).toBe(false) - }) - - it('keeps local canGoBack instead of the host default', () => { - const state = stateWithLocalRow() - - expect(syncedPage(applyStaleSnapshot(state), state)?.canGoBack).toBe(true) - }) - - it('keeps local canGoForward instead of the host default', () => { - const state = stateWithLocalRow() - - expect(syncedPage(applyStaleSnapshot(state), state)?.canGoForward).toBe(true) - }) - // Why a real title is covered separately: a host that has learned the title publishes a // non-fallback string, which the staged-title hold would have accepted. Ownership, not staleness. it('keeps the local title even when the host publishes a real but older title', () => {