mirror of
https://github.com/stablyai/orca.git
synced 2026-10-23 08:03:39 +00:00
fix(runtime): retire stale pane agent identity
This commit is contained in:
@@ -73,4 +73,28 @@ describe('provider reattach launch identity', () => {
|
||||
launchIncarnationId: null
|
||||
})
|
||||
})
|
||||
|
||||
it('retires daemon launch identity when the agent command finishes', () => {
|
||||
const runtime = new OrcaRuntimeService(null)
|
||||
|
||||
runtime.registerPty('pty-finished-reattach', WORKTREE_ID, null, {
|
||||
tabId: TAB_ID,
|
||||
leafId: LEAF_ID,
|
||||
incarnationId: INCARNATION_ID,
|
||||
providerReattachLaunchIdentity: {
|
||||
incarnationId: INCARNATION_ID,
|
||||
launchAgent: 'codex'
|
||||
}
|
||||
})
|
||||
runtime.emitDaemonPtyTransientFact('pty-finished-reattach', {
|
||||
kind: 'command-finished',
|
||||
exitCode: 0
|
||||
})
|
||||
|
||||
expect(getPty(runtime, 'pty-finished-reattach')).toMatchObject({
|
||||
launchAgent: null,
|
||||
launchToken: null,
|
||||
launchIncarnationId: null
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -13330,6 +13330,7 @@ describe('OrcaRuntimeService', () => {
|
||||
|
||||
const terminal = await runtime.createTerminal(`path:${TEST_WORKTREE_PATH}`, {
|
||||
command: 'codex',
|
||||
launchAgent: 'codex',
|
||||
launchConfig: { agentCommand: 'codex', agentArgs: '', agentEnv: {} }
|
||||
})
|
||||
const spawnEnv =
|
||||
@@ -13346,6 +13347,9 @@ describe('OrcaRuntimeService', () => {
|
||||
launchToken: spawnEnv.ORCA_AGENT_LAUNCH_TOKEN
|
||||
})
|
||||
).toBeDefined()
|
||||
expect((await runtime.listTerminals()).terminals).toEqual([
|
||||
expect.objectContaining({ handle: terminal.handle, agentIdentity: 'codex' })
|
||||
])
|
||||
|
||||
runtime.onPtyData('pty-authority', '\x1b]133;D;0\x07', 100)
|
||||
|
||||
@@ -13356,6 +13360,9 @@ describe('OrcaRuntimeService', () => {
|
||||
launchToken: spawnEnv.ORCA_AGENT_LAUNCH_TOKEN
|
||||
})
|
||||
).toBeUndefined()
|
||||
expect((await runtime.listTerminals()).terminals).toEqual([
|
||||
expect.not.objectContaining({ agentIdentity: expect.anything() })
|
||||
])
|
||||
})
|
||||
|
||||
it('retires only receipted restored PTY authority on command completion and exit', () => {
|
||||
|
||||
@@ -14063,13 +14063,14 @@ export class OrcaRuntimeService {
|
||||
return
|
||||
}
|
||||
const receipt = this.restoredOrchestrationAuthorityByPtyId.get(ptyId)
|
||||
if (!pty.launchToken && !receipt) {
|
||||
if (!pty.launchToken && !receipt && !pty.launchAgent) {
|
||||
return
|
||||
}
|
||||
const paneKeys = this.collectPaneKeysForPty(ptyId)
|
||||
this.restoredOrchestrationAuthorityByPtyId.delete(ptyId)
|
||||
pty.launchToken = null
|
||||
pty.launchIncarnationId = null
|
||||
pty.launchAgent = null
|
||||
for (const paneKey of paneKeys) {
|
||||
this.retireAgentHookCompatibilityAuthorityFn?.(paneKey)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user