mirror of
https://github.com/stablyai/orca.git
synced 2026-09-22 00:02:31 +00:00
refactor(agent-status): delete two launch-config accessors left with no callers (#22032)
#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.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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() })
|
||||
])
|
||||
|
||||
-1
@@ -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(),
|
||||
|
||||
@@ -524,7 +524,6 @@ describe('connectPanePty', () => {
|
||||
}
|
||||
},
|
||||
getAgentLaunchConfigForStatusEntry: vi.fn(() => undefined),
|
||||
getAgentLaunchConfigForStatusMetadata: vi.fn(() => undefined),
|
||||
sleepingAgentSessionsByPaneKey: {
|
||||
[paneKey]: {
|
||||
paneKey,
|
||||
|
||||
@@ -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]
|
||||
}),
|
||||
|
||||
@@ -107,7 +107,6 @@ export type StoreState = {
|
||||
{ launchConfig: unknown; identity?: { agentType?: string } }
|
||||
>
|
||||
getAgentLaunchConfigForStatusEntry: ReturnType<typeof vi.fn>
|
||||
getAgentLaunchConfigForStatusMetadata: ReturnType<typeof vi.fn>
|
||||
clearSleepingAgentSession: ReturnType<typeof vi.fn>
|
||||
registerAgentLaunchConfig: ReturnType<typeof vi.fn>
|
||||
clearAgentLaunchConfig: ReturnType<typeof vi.fn>
|
||||
|
||||
-1
@@ -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<string, unknown>)[paneKey]
|
||||
}),
|
||||
|
||||
-1
@@ -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<string, unknown>)[paneKey]
|
||||
}),
|
||||
|
||||
@@ -27,7 +27,6 @@ type MockStoreState = {
|
||||
agentLaunchConfigByPaneKey: Record<string, unknown>
|
||||
agentStatusByPaneKey: Record<string, unknown>
|
||||
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
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@ type MockStoreState = {
|
||||
agentLaunchConfigByPaneKey: Record<string, unknown>
|
||||
agentStatusByPaneKey: Record<string, unknown>
|
||||
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
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -43,7 +43,6 @@ type MockStoreState = {
|
||||
agentLaunchConfigByPaneKey: Record<string, unknown>
|
||||
agentStatusByPaneKey: Record<string, unknown>
|
||||
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
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -48,10 +48,6 @@ type MockStoreState = {
|
||||
getAgentLaunchConfigForStatusEntry: (entry: {
|
||||
paneKey: string
|
||||
}) => { agentArgs: string; agentEnv: Record<string, string> } | undefined
|
||||
getAgentLaunchConfigForStatusMetadata: (metadata: {
|
||||
paneKey: string
|
||||
launchToken?: string
|
||||
}) => { agentArgs: string; agentEnv: Record<string, string> } | 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
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -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: {},
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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: (
|
||||
|
||||
@@ -17,7 +17,6 @@ import { createAgentStatusRetentionActions } from './agent-status-retention-acti
|
||||
export type {
|
||||
AgentLaunchConfigRegistryEntry,
|
||||
AgentLaunchConfigRegistrationMetadata,
|
||||
AgentLaunchConfigStatusMetadata,
|
||||
AgentProviderSessionRecordMetadata,
|
||||
AgentProviderSessionRouting,
|
||||
AgentProviderSessionTiming,
|
||||
|
||||
@@ -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(),
|
||||
|
||||
Reference in New Issue
Block a user