diff --git a/src/main/runtime/orca-runtime.test.ts b/src/main/runtime/orca-runtime.test.ts index 3688fec9c39..79a0a30d654 100644 --- a/src/main/runtime/orca-runtime.test.ts +++ b/src/main/runtime/orca-runtime.test.ts @@ -1282,6 +1282,13 @@ function setInMemoryOrchestrationMessages( runtime.setOrchestrationDb(db as unknown as OrchestrationDb) } +function pendingMailPointerRepoints(runtime: OrcaRuntimeService): number { + const internals = runtime as unknown as { + mailPointerRepointScheduler: { pendingCount: number } + } + return internals.mailPointerRepointScheduler.pendingCount +} + function bindSinglePtyRun(db: InMemoryOrchestrationMessages, terminalHandle: string): string { db.setRun({ id: 'run_test', @@ -35712,7 +35719,7 @@ describe('OrcaRuntimeService', () => { await vi.advanceTimersByTimeAsync(20_000) expect(pendingReads).not.toHaveBeenCalled() - expect(vi.getTimerCount()).toBe(0) + expect(pendingMailPointerRepoints(runtime)).toBe(0) runtime.onPtyData('pty-1', '\x1b]0;Codex done\x07', 101) expect(pendingReads).toHaveBeenCalledTimes(1) @@ -35799,7 +35806,7 @@ describe('OrcaRuntimeService', () => { typeof payload === 'string' && payload.includes('orca orchestration check') ) ).toHaveLength(1) - expect(vi.getTimerCount()).toBe(0) + expect(pendingMailPointerRepoints(runtime)).toBe(0) db.close() } finally { vi.useRealTimers() diff --git a/src/main/runtime/orchestration/mail-pointer-repoint-scheduler.ts b/src/main/runtime/orchestration/mail-pointer-repoint-scheduler.ts index 5d495d920c4..cf2af89d240 100644 --- a/src/main/runtime/orchestration/mail-pointer-repoint-scheduler.ts +++ b/src/main/runtime/orchestration/mail-pointer-repoint-scheduler.ts @@ -20,6 +20,11 @@ export class MailPointerRepointScheduler { this.timersByHandle.set(handle, timer) } + /** Handles still awaiting a repoint; a quiet scheduler holds none. */ + get pendingCount(): number { + return this.timersByHandle.size + } + clear(): void { for (const timer of this.timersByHandle.values()) { clearTimeout(timer)