From 83a031c08121d663af84012a9bbd74718114e2fb Mon Sep 17 00:00:00 2001 From: Brennan Benson <79079362+brennanb2025@users.noreply.github.com> Date: Mon, 21 Sep 2026 14:21:06 -0400 Subject: [PATCH] refactor(agent-status): delete two launch-config accessors left with no callers (#22032) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #21844 removed the Codex launch-argument attention suppressor, which was the last production caller of two launch-config lookups. Both were left in place for a follow-up; this is it. `getAgentLaunchConfigForStatusMetadata` (renderer store) looked a launch config up from a loose metadata bag. Its sibling `getAgentLaunchConfigForStatusEntry` takes a real status entry and still serves the one live consumer, cold restore resume startup. Deleting the metadata accessor also orphaned its `getLaunchConfigForStatusMetadata` helper and the `AgentLaunchConfigStatusMetadata` parameter type, so those go too. `getAgentStatusLaunchConfigForPaneKey` (main runtime) returned a pane's launch config behind a launch-token fence. Its two remaining references were assertions in the launch-authority retirement test. They were a second view of a state bit the test already pins: retirement nulls `pty.launchToken`, and the surviving `verifyOrchestrationCompatibilityCaller` assertion fails when it does not. Verified by ablation — disabling only the `launchToken` nulling fails that assertion with the accessor already gone, so no coverage is lost. Retirement never cleared `launchConfig` itself, so there was no second property hiding in those assertions. Test mocks that existed only to satisfy the removed store method are stripped; the tests themselves are about other behaviour and stay. No behaviour change. --- ...e-prune-mobile-session-tab-group-layout.ts | 16 ------------- .../terminal-creation-and-readiness.spec.ts | 10 -------- ...-color-scheme-child-stdin.node-pty.test.ts | 1 - ...ty-connection-agent-session-resume.test.ts | 1 - .../pty-connection-test-store-fixtures.ts | 7 ------ .../pty-connection-test-store-state.ts | 1 - ...ote-hidden-output-restore-outcomes.test.ts | 1 - ...t-restore-unavailable-banner.repro.test.ts | 1 - ...tion-background-turn-notifications.test.ts | 4 +--- ...gent-hook-completion-fresh-working.test.ts | 4 +--- ...hook-completion-grok-notifications.test.ts | 4 +--- ...gent-hook-completion-notifications.test.ts | 12 +--------- ...events-agent-status-store-test-fixtures.ts | 1 - .../src/store/slices/agent-status-contract.ts | 11 --------- .../slices/agent-status-launch-actions.ts | 9 +------- .../slices/agent-status-launch-config.ts | 23 +------------------ .../slices/agent-status-slice-contract.ts | 4 ---- src/renderer/src/store/slices/agent-status.ts | 1 - ...untime-rejected-input-remount.unit.test.ts | 1 - 19 files changed, 6 insertions(+), 106 deletions(-) diff --git a/src/main/runtime/orca-runtime-prune-mobile-session-tab-group-layout.ts b/src/main/runtime/orca-runtime-prune-mobile-session-tab-group-layout.ts index 4a910f02451..50b1f52d238 100644 --- a/src/main/runtime/orca-runtime-prune-mobile-session-tab-group-layout.ts +++ b/src/main/runtime/orca-runtime-prune-mobile-session-tab-group-layout.ts @@ -23,8 +23,6 @@ import type { import { buildRuntimeMobileAgentStatus } from './runtime-mobile-agent-status-builder' import { FIRST_PANE_ID } from '../../shared/pane-key' import { isTerminalLeafId, makePaneKey, parsePaneKey } from '../../shared/stable-pane-id' -import type { SleepingAgentLaunchConfig } from '../../shared/agent-session-resume' -import { copySleepingAgentLaunchConfig } from './runtime-agent-launch-resolution' import { getStructuredAgentSessionHost } from '../native-chat/agent-session-wire/structured-agent-session-registry' import { replaceConversationInSnapshot } from './structured-conversation-tab-replacement' import { resolveStructuredWorkerAuthority } from './structured-worker-authority' @@ -247,20 +245,6 @@ export class OrcaRuntimeWithPruneMobileSessionTabGroupLayout extends OrcaRuntime return this.getTerminalHandleForPaneKey(paneKey) ?? undefined } - getAgentStatusLaunchConfigForPaneKey( - paneKey: string, - args?: { launchToken?: string } - ): SleepingAgentLaunchConfig | undefined { - const pty = this.getPtyRecordForPaneKey(paneKey) - if (!pty?.launchConfig) { - return undefined - } - if (pty.launchToken === null || pty.launchToken !== args?.launchToken) { - return undefined - } - return copySleepingAgentLaunchConfig(pty.launchConfig) - } - getTerminalHandleForPaneKey(paneKey: string): string | null { const parsed = parsePaneKey(paneKey) const leaf = parsed ? this.leaves.get(this.getLeafKey(parsed.tabId, parsed.leafId)) : undefined diff --git a/src/main/runtime/orca-runtime-tests/terminal-creation-and-readiness.spec.ts b/src/main/runtime/orca-runtime-tests/terminal-creation-and-readiness.spec.ts index 3a30c48e4b8..3d4dadc0837 100644 --- a/src/main/runtime/orca-runtime-tests/terminal-creation-and-readiness.spec.ts +++ b/src/main/runtime/orca-runtime-tests/terminal-creation-and-readiness.spec.ts @@ -263,11 +263,6 @@ describe('OrcaRuntimeService', () => { } expect(runtime.verifyOrchestrationCompatibilityCaller(evidence)).not.toBeNull() - expect( - runtime.getAgentStatusLaunchConfigForPaneKey(spawnEnv.ORCA_PANE_KEY, { - launchToken: spawnEnv.ORCA_AGENT_LAUNCH_TOKEN - }) - ).toBeDefined() expect((await runtime.listTerminals()).terminals).toEqual([ expect.objectContaining({ handle: terminal.handle, agentIdentity: 'codex' }) ]) @@ -276,11 +271,6 @@ describe('OrcaRuntimeService', () => { expect(retireAuthority).toHaveBeenCalledWith(spawnEnv.ORCA_PANE_KEY) expect(runtime.verifyOrchestrationCompatibilityCaller(evidence)).toBeNull() - expect( - runtime.getAgentStatusLaunchConfigForPaneKey(spawnEnv.ORCA_PANE_KEY, { - launchToken: spawnEnv.ORCA_AGENT_LAUNCH_TOKEN - }) - ).toBeUndefined() expect((await runtime.listTerminals()).terminals).toEqual([ expect.not.objectContaining({ agentIdentity: expect.anything() }) ]) diff --git a/src/renderer/src/components/terminal-pane/fish-color-scheme-child-stdin.node-pty.test.ts b/src/renderer/src/components/terminal-pane/fish-color-scheme-child-stdin.node-pty.test.ts index b3b949addbe..36768745bd6 100644 --- a/src/renderer/src/components/terminal-pane/fish-color-scheme-child-stdin.node-pty.test.ts +++ b/src/renderer/src/components/terminal-pane/fish-color-scheme-child-stdin.node-pty.test.ts @@ -393,7 +393,6 @@ describe('fish never receives a color-scheme report it did not query (#9993)', ( suppressedPtyExitIds: {}, agentLaunchConfigByPaneKey: {}, getAgentLaunchConfigForStatusEntry: vi.fn(), - getAgentLaunchConfigForStatusMetadata: vi.fn(), clearSleepingAgentSession: vi.fn(), registerAgentLaunchConfig: vi.fn(), clearAgentLaunchConfig: vi.fn(), diff --git a/src/renderer/src/components/terminal-pane/pty-connection-agent-session-resume.test.ts b/src/renderer/src/components/terminal-pane/pty-connection-agent-session-resume.test.ts index 9fec98aa409..2abbb138e43 100644 --- a/src/renderer/src/components/terminal-pane/pty-connection-agent-session-resume.test.ts +++ b/src/renderer/src/components/terminal-pane/pty-connection-agent-session-resume.test.ts @@ -524,7 +524,6 @@ describe('connectPanePty', () => { } }, getAgentLaunchConfigForStatusEntry: vi.fn(() => undefined), - getAgentLaunchConfigForStatusMetadata: vi.fn(() => undefined), sleepingAgentSessionsByPaneKey: { [paneKey]: { paneKey, diff --git a/src/renderer/src/components/terminal-pane/pty-connection-test-store-fixtures.ts b/src/renderer/src/components/terminal-pane/pty-connection-test-store-fixtures.ts index 8ad0335179c..99e0a868e5a 100644 --- a/src/renderer/src/components/terminal-pane/pty-connection-test-store-fixtures.ts +++ b/src/renderer/src/components/terminal-pane/pty-connection-test-store-fixtures.ts @@ -54,13 +54,6 @@ export function createInitialStoreState(getState: () => StoreState): StoreState getAgentLaunchConfigForStatusEntry: vi.fn((entry: { paneKey: string }) => { return getState().agentLaunchConfigByPaneKey[entry.paneKey]?.launchConfig }), - getAgentLaunchConfigForStatusMetadata: vi.fn( - (metadata: { paneKey: string; launchToken?: string }) => { - return metadata.launchToken - ? getState().agentLaunchConfigByPaneKey[metadata.paneKey]?.launchConfig - : undefined - } - ), clearSleepingAgentSession: vi.fn((paneKey: string) => { delete getState().sleepingAgentSessionsByPaneKey[paneKey] }), diff --git a/src/renderer/src/components/terminal-pane/pty-connection-test-store-state.ts b/src/renderer/src/components/terminal-pane/pty-connection-test-store-state.ts index 5ba2747d8ff..76686c1120a 100644 --- a/src/renderer/src/components/terminal-pane/pty-connection-test-store-state.ts +++ b/src/renderer/src/components/terminal-pane/pty-connection-test-store-state.ts @@ -107,7 +107,6 @@ export type StoreState = { { launchConfig: unknown; identity?: { agentType?: string } } > getAgentLaunchConfigForStatusEntry: ReturnType - getAgentLaunchConfigForStatusMetadata: ReturnType clearSleepingAgentSession: ReturnType registerAgentLaunchConfig: ReturnType clearAgentLaunchConfig: ReturnType diff --git a/src/renderer/src/components/terminal-pane/remote-hidden-output-restore-outcomes.test.ts b/src/renderer/src/components/terminal-pane/remote-hidden-output-restore-outcomes.test.ts index 0e98202aab3..4bdd0bcdc64 100644 --- a/src/renderer/src/components/terminal-pane/remote-hidden-output-restore-outcomes.test.ts +++ b/src/renderer/src/components/terminal-pane/remote-hidden-output-restore-outcomes.test.ts @@ -516,7 +516,6 @@ describe('remote hidden-output restore outcomes', () => { > return byPaneKey[entry.paneKey]?.launchConfig }), - getAgentLaunchConfigForStatusMetadata: vi.fn(() => undefined), clearSleepingAgentSession: vi.fn((paneKey: string) => { delete (mockStoreState.sleepingAgentSessionsByPaneKey as Record)[paneKey] }), diff --git a/src/renderer/src/components/terminal-pane/remote-hidden-output-restore-unavailable-banner.repro.test.ts b/src/renderer/src/components/terminal-pane/remote-hidden-output-restore-unavailable-banner.repro.test.ts index ea6f69c1ab7..cb49a5e3509 100644 --- a/src/renderer/src/components/terminal-pane/remote-hidden-output-restore-unavailable-banner.repro.test.ts +++ b/src/renderer/src/components/terminal-pane/remote-hidden-output-restore-unavailable-banner.repro.test.ts @@ -545,7 +545,6 @@ describe('remote hidden-output restore abandonment (issue2-hidden-output-skip)', > return byPaneKey[entry.paneKey]?.launchConfig }), - getAgentLaunchConfigForStatusMetadata: vi.fn(() => undefined), clearSleepingAgentSession: vi.fn((paneKey: string) => { delete (mockStoreState.sleepingAgentSessionsByPaneKey as Record)[paneKey] }), diff --git a/src/renderer/src/hooks/agent-hook-completion-background-turn-notifications.test.ts b/src/renderer/src/hooks/agent-hook-completion-background-turn-notifications.test.ts index 3898479808a..256ae62d058 100644 --- a/src/renderer/src/hooks/agent-hook-completion-background-turn-notifications.test.ts +++ b/src/renderer/src/hooks/agent-hook-completion-background-turn-notifications.test.ts @@ -27,7 +27,6 @@ type MockStoreState = { agentLaunchConfigByPaneKey: Record agentStatusByPaneKey: Record getAgentLaunchConfigForStatusEntry: () => undefined - getAgentLaunchConfigForStatusMetadata: () => undefined } let mockStoreState: MockStoreState @@ -84,8 +83,7 @@ describe('Claude background-turn completion notifications', () => { terminalLayoutsByTabId: {}, agentLaunchConfigByPaneKey: {}, agentStatusByPaneKey: {}, - getAgentLaunchConfigForStatusEntry: () => undefined, - getAgentLaunchConfigForStatusMetadata: () => undefined + getAgentLaunchConfigForStatusEntry: () => undefined } }) diff --git a/src/renderer/src/hooks/agent-hook-completion-fresh-working.test.ts b/src/renderer/src/hooks/agent-hook-completion-fresh-working.test.ts index fef0a2c95fc..2fbb2a2fada 100644 --- a/src/renderer/src/hooks/agent-hook-completion-fresh-working.test.ts +++ b/src/renderer/src/hooks/agent-hook-completion-fresh-working.test.ts @@ -20,7 +20,6 @@ type MockStoreState = { agentLaunchConfigByPaneKey: Record agentStatusByPaneKey: Record getAgentLaunchConfigForStatusEntry: () => undefined - getAgentLaunchConfigForStatusMetadata: () => undefined } let mockStoreState: MockStoreState @@ -64,8 +63,7 @@ describe('agent hook completion fresh-working gate', () => { terminalLayoutsByTabId: {}, agentLaunchConfigByPaneKey: {}, agentStatusByPaneKey: {}, - getAgentLaunchConfigForStatusEntry: () => undefined, - getAgentLaunchConfigForStatusMetadata: () => undefined + getAgentLaunchConfigForStatusEntry: () => undefined } }) diff --git a/src/renderer/src/hooks/agent-hook-completion-grok-notifications.test.ts b/src/renderer/src/hooks/agent-hook-completion-grok-notifications.test.ts index d9f86e16d74..24daf539178 100644 --- a/src/renderer/src/hooks/agent-hook-completion-grok-notifications.test.ts +++ b/src/renderer/src/hooks/agent-hook-completion-grok-notifications.test.ts @@ -43,7 +43,6 @@ type MockStoreState = { agentLaunchConfigByPaneKey: Record agentStatusByPaneKey: Record getAgentLaunchConfigForStatusEntry: () => undefined - getAgentLaunchConfigForStatusMetadata: () => undefined } let mockStoreState: MockStoreState @@ -78,8 +77,7 @@ describe('Grok hook completion notifications', () => { terminalLayoutsByTabId: {}, agentLaunchConfigByPaneKey: {}, agentStatusByPaneKey: {}, - getAgentLaunchConfigForStatusEntry: () => undefined, - getAgentLaunchConfigForStatusMetadata: () => undefined + getAgentLaunchConfigForStatusEntry: () => undefined } }) diff --git a/src/renderer/src/hooks/agent-hook-completion-notifications.test.ts b/src/renderer/src/hooks/agent-hook-completion-notifications.test.ts index c60a95ea43f..0f2d6948f0b 100644 --- a/src/renderer/src/hooks/agent-hook-completion-notifications.test.ts +++ b/src/renderer/src/hooks/agent-hook-completion-notifications.test.ts @@ -48,10 +48,6 @@ type MockStoreState = { getAgentLaunchConfigForStatusEntry: (entry: { paneKey: string }) => { agentArgs: string; agentEnv: Record } | undefined - getAgentLaunchConfigForStatusMetadata: (metadata: { - paneKey: string - launchToken?: string - }) => { agentArgs: string; agentEnv: Record } | undefined } let mockStoreState: MockStoreState @@ -148,13 +144,7 @@ describe('agent hook completion notifications', () => { agentLaunchConfigByPaneKey: {}, agentStatusByPaneKey: {}, getAgentLaunchConfigForStatusEntry: (entry) => - mockStoreState.agentLaunchConfigByPaneKey[entry.paneKey]?.launchConfig, - getAgentLaunchConfigForStatusMetadata: (metadata) => - metadata.launchToken && - metadata.launchToken === - mockStoreState.agentLaunchConfigByPaneKey[metadata.paneKey]?.launchToken - ? mockStoreState.agentLaunchConfigByPaneKey[metadata.paneKey]?.launchConfig - : undefined + mockStoreState.agentLaunchConfigByPaneKey[entry.paneKey]?.launchConfig } }) diff --git a/src/renderer/src/hooks/ipc-events-agent-status-store-test-fixtures.ts b/src/renderer/src/hooks/ipc-events-agent-status-store-test-fixtures.ts index 96bca500d21..7cabf081db9 100644 --- a/src/renderer/src/hooks/ipc-events-agent-status-store-test-fixtures.ts +++ b/src/renderer/src/hooks/ipc-events-agent-status-store-test-fixtures.ts @@ -175,7 +175,6 @@ export function buildStoreState(overrides: StoreLike): StoreLike { setAgentStatuses: vi.fn(() => []), recordAgentProviderSession: vi.fn(), clearTransientAgentStatuses: vi.fn(), - getAgentLaunchConfigForStatusMetadata: vi.fn(() => undefined), recentlyClosedAgentStatusTabIds: {}, repos: [], worktreesByRepo: {}, diff --git a/src/renderer/src/store/slices/agent-status-contract.ts b/src/renderer/src/store/slices/agent-status-contract.ts index 1aa19863e25..afff64d3303 100644 --- a/src/renderer/src/store/slices/agent-status-contract.ts +++ b/src/renderer/src/store/slices/agent-status-contract.ts @@ -65,17 +65,6 @@ export type AgentLaunchConfigRegistrationMetadata = { providerSession?: AgentProviderSessionMetadata } -export type AgentLaunchConfigStatusMetadata = { - paneKey: string - agentType?: AgentType - tabId?: string - terminalHandle?: string - launchToken?: string - providerSession?: AgentProviderSessionMetadata - existingProviderSession?: AgentProviderSessionMetadata - providerSessionChanged?: boolean -} - export type AgentLaunchConfigRegistryEntry = { launchConfig: SleepingAgentLaunchConfig registeredAt: number diff --git a/src/renderer/src/store/slices/agent-status-launch-actions.ts b/src/renderer/src/store/slices/agent-status-launch-actions.ts index 254ae37f4d1..4d13ea57d67 100644 --- a/src/renderer/src/store/slices/agent-status-launch-actions.ts +++ b/src/renderer/src/store/slices/agent-status-launch-actions.ts @@ -4,7 +4,6 @@ import type { AgentLaunchConfigRegistryEntry } from './agent-status-contract' import { copyLaunchConfig, sleepingRecordFromEntry } from './agent-status-sleeping-records' import { getLaunchConfigForEntry, - getLaunchConfigForStatusMetadata, launchConfigRegistryEntriesEqual, normalizeLaunchConfigRegistrationMetadata, registryEntryMatchesStatus @@ -15,10 +14,7 @@ export function createAgentStatusLaunchActions( runtime: AgentStatusRuntime ): Pick< AgentStatusSlice, - | 'registerAgentLaunchConfig' - | 'getAgentLaunchConfigForStatusEntry' - | 'getAgentLaunchConfigForStatusMetadata' - | 'clearAgentLaunchConfig' + 'registerAgentLaunchConfig' | 'getAgentLaunchConfigForStatusEntry' | 'clearAgentLaunchConfig' > { const { get, set } = runtime return { @@ -93,9 +89,6 @@ export function createAgentStatusLaunchActions( }) }, getAgentLaunchConfigForStatusEntry: (entry) => getLaunchConfigForEntry(get(), entry), - getAgentLaunchConfigForStatusMetadata: (metadata) => - getLaunchConfigForStatusMetadata(get(), metadata), - clearAgentLaunchConfig: (paneKey) => { set((s) => { if (!(paneKey in s.agentLaunchConfigByPaneKey)) { diff --git a/src/renderer/src/store/slices/agent-status-launch-config.ts b/src/renderer/src/store/slices/agent-status-launch-config.ts index 89c544de87b..bbb5e614747 100644 --- a/src/renderer/src/store/slices/agent-status-launch-config.ts +++ b/src/renderer/src/store/slices/agent-status-launch-config.ts @@ -7,8 +7,7 @@ import { } from '../../../../shared/agent-session-resume' import type { AgentLaunchConfigRegistryEntry, - AgentLaunchConfigRegistrationMetadata, - AgentLaunchConfigStatusMetadata + AgentLaunchConfigRegistrationMetadata } from './agent-status-contract' import { getLeafIdFromPaneKey, getTabIdFromPaneKey } from './agent-status-pane-key-tab-binding' import { launchConfigsEqual } from './agent-status-recovery-equivalence' @@ -141,23 +140,3 @@ export function getLaunchConfigForEntry( ? sleepingRecord.launchConfig : undefined } - -export function getLaunchConfigForStatusMetadata( - state: AppState, - metadata: AgentLaunchConfigStatusMetadata -): SleepingAgentLaunchConfig | undefined { - const registryEntry = state.agentLaunchConfigByPaneKey[metadata.paneKey] - return registryEntryMatchesStatus({ - entry: registryEntry, - paneKey: metadata.paneKey, - agentType: metadata.agentType, - tabId: metadata.tabId ?? getTabIdFromPaneKey(metadata.paneKey) ?? undefined, - terminalHandle: metadata.terminalHandle, - launchToken: metadata.launchToken, - providerSession: metadata.providerSession, - existingProviderSession: metadata.existingProviderSession, - providerSessionChanged: metadata.providerSessionChanged ?? false - }) - ? registryEntry?.launchConfig - : undefined -} diff --git a/src/renderer/src/store/slices/agent-status-slice-contract.ts b/src/renderer/src/store/slices/agent-status-slice-contract.ts index 7e2f9876d3c..0cf46a22288 100644 --- a/src/renderer/src/store/slices/agent-status-slice-contract.ts +++ b/src/renderer/src/store/slices/agent-status-slice-contract.ts @@ -1,7 +1,6 @@ import type { AgentLaunchConfigRegistryEntry, AgentLaunchConfigRegistrationMetadata, - AgentLaunchConfigStatusMetadata, AgentProviderSessionRecordMetadata, AgentProviderSessionRouting, AgentProviderSessionTiming, @@ -112,9 +111,6 @@ export type AgentStatusSlice = { getAgentLaunchConfigForStatusEntry: ( entry: AgentStatusEntry ) => SleepingAgentLaunchConfig | undefined - getAgentLaunchConfigForStatusMetadata: ( - metadata: AgentLaunchConfigStatusMetadata - ) => SleepingAgentLaunchConfig | undefined clearAgentLaunchConfig: (paneKey: string) => void setRuntimeAgentOrchestrationByPaneKey: ( diff --git a/src/renderer/src/store/slices/agent-status.ts b/src/renderer/src/store/slices/agent-status.ts index 6a1ed10025c..54b1ad04b87 100644 --- a/src/renderer/src/store/slices/agent-status.ts +++ b/src/renderer/src/store/slices/agent-status.ts @@ -17,7 +17,6 @@ import { createAgentStatusRetentionActions } from './agent-status-retention-acti export type { AgentLaunchConfigRegistryEntry, AgentLaunchConfigRegistrationMetadata, - AgentLaunchConfigStatusMetadata, AgentProviderSessionRecordMetadata, AgentProviderSessionRouting, AgentProviderSessionTiming, diff --git a/tests/e2e/paired-runtime-rejected-input-remount.unit.test.ts b/tests/e2e/paired-runtime-rejected-input-remount.unit.test.ts index 3967f7934eb..5c8506d3568 100644 --- a/tests/e2e/paired-runtime-rejected-input-remount.unit.test.ts +++ b/tests/e2e/paired-runtime-rejected-input-remount.unit.test.ts @@ -323,7 +323,6 @@ describe('host-rejected paired-runtime input reaches a pane remount', () => { suppressedPtyExitIds: {}, agentLaunchConfigByPaneKey: {}, getAgentLaunchConfigForStatusEntry: vi.fn(), - getAgentLaunchConfigForStatusMetadata: vi.fn(), clearSleepingAgentSession: vi.fn(), registerAgentLaunchConfig: vi.fn(), clearAgentLaunchConfig: vi.fn(),