Provide settled writes for recovery mailbox regression

This commit is contained in:
Brennan Benson
2026-11-13 04:33:33 -08:00
parent a383557a5d
commit 03878aed8b
2 changed files with 8 additions and 1 deletions
@@ -6,6 +6,7 @@ import type { TerminalProcessInspection as PtyProcessInspection } from '../../..
import type { RuntimeStore } from '../construction/runtime-store-contract'
import { ORCA_LAYOUT_OWNER_IS_MAIN } from '../../../shared/layout-owner-switch'
import { committingSpawn, registerBoundPty } from './bind-first-pane.test-fixture'
import type { RuntimePtyController } from '../terminal/lifecycle/runtime-pty-controller-contract'
const TRANSCRIPT_PANE_LEAF_ID = '11111111-1111-4111-8111-111111111111'
const TRANSCRIPT_PANE_TAB_ID = 'tab-1'
@@ -33,6 +34,7 @@ export type TranscriptPaneOptions = {
paneRootPid?: number
onShellForegroundProof?: () => void
onWrite?: (data: string) => void
writeWithSettlement?: RuntimePtyController['writeWithSettlement']
}
function transcriptLayoutStore(): RuntimeStore {
@@ -93,6 +95,7 @@ export async function createTranscriptPane(
options.onWrite?.(data)
return true
},
...(options.writeWithSettlement ? { writeWithSettlement: options.writeWithSettlement } : {}),
kill: () => true,
getSize: () => options.size ?? null,
getForegroundProcess: (): Promise<string | null> => {
@@ -18,6 +18,7 @@ import type { AgentStatusIpcPayload } from '../../../../shared/agent-status/cont
import { makePaneKey } from '../../../../shared/workspace-layout/stable-pane-id'
import type { TuiAgent } from '../../../../shared/agent-launch/catalog/tui-agent'
import type { OrcaRuntimeService } from '../../orca-runtime'
import { settledWriteStub } from '../../../providers/testing/settled-pty-write-stub'
vi.mock('electron', () => ({
BrowserWindow: { fromId: vi.fn(() => null) },
@@ -63,7 +64,10 @@ describe('Hermes captured hook readiness', () => {
launchAgent: 'hermes',
size,
data: captured,
onWrite: (data) => writes.push(data)
onWrite: (data) => writes.push(data),
writeWithSettlement: settledWriteStub((_id, data) => {
writes.push(data)
})
})
await runtime.serializeMainTerminalBuffer(TRANSCRIPT_PANE_PTY_ID)
writes.length = 0