Skip to content

Commit 7983ce0

Browse files
committed
test(desktop): a throwing notifier still claims, and sign-out reaches a closed tab's tmux run
1 parent 237a921 commit 7983ce0

2 files changed

Lines changed: 29 additions & 2 deletions

File tree

‎apps/desktop/src/main/desktop-executor/executor.test.ts‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -671,12 +671,14 @@ describe('registration', () => {
671671
expect(journal.entries.size).toBe(0)
672672
})
673673

674-
it('settles an inbox read whose notifier throws instead of rejecting', async () => {
674+
it('still claims the calls of an inbox read whose notifier throws', async () => {
675675
const sim = new FakeSim()
676+
const runner = new FakeRunner()
677+
runner.immediate = DONE
676678
const executor = new DesktopExecutor({
677679
client: sim.client,
678680
journal: new MemoryJournal(),
679-
runner: new FakeRunner(),
681+
runner,
680682
leaseRenewMs: 60_000,
681683
retryBaseMs: 5,
682684
onUnregistered: () => {},
@@ -685,7 +687,10 @@ describe('registration', () => {
685687
},
686688
})
687689

690+
sim.inbox = [callItem('call-1', 'chat-a')]
691+
688692
await expect(executor.reconcile()).resolves.toBeUndefined()
693+
await vi.waitFor(() => expect(runner.started).toEqual(['call-1']))
689694
})
690695

691696
it('raises no approval from an inbox read that Sim answers after sign-out', async () => {

‎apps/desktop/src/main/terminal/service.test.ts‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -638,4 +638,26 @@ describe('agent commands in tmux', () => {
638638
tmuxFake.gone.clear()
639639
}
640640
})
641+
642+
it('still stops at sign-out a run whose Sim terminal was closed', async () => {
643+
tmuxFake.on = true
644+
tmuxFake.statusPaths.clear()
645+
tmuxFake.stopped.length = 0
646+
try {
647+
const terminal = new TerminalService({ loadCwd: () => '/tmp' })
648+
const { activeTerminalId } = terminal.start({ cols: 80, rows: 24 })
649+
const first = await terminal.executeTool('call-orphan', 'run', {
650+
command: 'sleep 600',
651+
waitSeconds: 1,
652+
})
653+
expect(first).toMatchObject({ ok: true, result: { status: 'running' } })
654+
terminal.closeTerminal(activeTerminalId as string)
655+
656+
await terminal.stopAgentCommands()
657+
658+
expect(tmuxFake.stopped).toEqual([[...tmuxFake.statusPaths.keys()][0]])
659+
} finally {
660+
tmuxFake.on = false
661+
}
662+
})
641663
})

0 commit comments

Comments
 (0)