mirror of
https://github.com/stablyai/orca.git
synced 2026-11-16 02:47:34 +00:00
fix(orchestration): leave a hook row a newer terminal in the pane owns
This commit is contained in:
@@ -72,6 +72,7 @@ describe('worker terminal recovery after a crash', () => {
|
||||
hasPty: () => false,
|
||||
listProcesses: async () => []
|
||||
})
|
||||
// oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: recovery calls only this notifier method.
|
||||
runtime.setNotifier({ resolveLegacyWorkerTerminalRecovery: vi.fn() } as never)
|
||||
|
||||
await expect(runtime.reconcileLegacyWorkerTerminals()).resolves.toMatchObject({
|
||||
|
||||
+11
-2
@@ -78,8 +78,17 @@ export abstract class LegacyWorkerTerminalSurface extends OrcaRuntimeWithRestore
|
||||
if (pty && this.paneOfPty(pty).tabId === candidate.tabId) {
|
||||
forgetPtySurface(this.terminalIdentity, pty)
|
||||
}
|
||||
// Why: an exit this run never saw leaves the pane's restored hook row holding the conversation.
|
||||
this.reconcileAgentStatusForEndedProcessFn?.([candidate.paneKey])
|
||||
// Why: an exit this run never saw leaves the pane's restored hook row holding the conversation;
|
||||
// a newer terminal already in the pane owns that row.
|
||||
const paneTakenOver =
|
||||
(leaf?.ptyId && leaf.ptyId !== candidate.ptyId) ||
|
||||
[...this.ptysById.values()].some(
|
||||
(other) =>
|
||||
other.ptyId !== candidate.ptyId && this.paneOfPty(other).paneKey === candidate.paneKey
|
||||
)
|
||||
if (!paneTakenOver) {
|
||||
this.reconcileAgentStatusForEndedProcessFn?.([candidate.paneKey])
|
||||
}
|
||||
this.notifier?.resolveLegacyWorkerTerminalRecovery?.(
|
||||
candidate.paneKey,
|
||||
'rolled_back',
|
||||
|
||||
Reference in New Issue
Block a user