test(codex): assert the thrown sweep excluded the parked pane

The strand test set up its scenario purely through timer arithmetic, so a later
change to when sweeps fire could leave it green while no longer reproducing the
stranding at all. Pin that the throw landed on a sweep of pty-2 alone and that
pty-1 later got its own sweep.
This commit is contained in:
Brennan Benson
2026-07-26 17:28:33 -07:00
parent 43ba8a1fca
commit 2e47669680
@@ -223,10 +223,15 @@ describe('notifyCodexPaneBoundForStaleSweep', () => {
notifyCodexPaneBoundForStaleSweep('pty-2')
// t = 600: pty-2's sweep is the one that throws; pty-1 is not due and untouched.
await vi.advanceTimersByTimeAsync(300)
// Why: assert the throw really landed on a sweep pty-1 was absent from, or a
// later change to the flush sequence could leave this passing while the
// stranding it exists to catch is no longer being set up at all.
expect(window.api.codexAccounts.listStalePanes).toHaveBeenCalledWith({ ptyIds: ['pty-2'] })
expect(useAppStore.getState().codexRestartNoticeByPtyId).toEqual({})
await vi.advanceTimersByTimeAsync(1200)
expect(window.api.codexAccounts.listStalePanes).toHaveBeenCalledWith({ ptyIds: ['pty-1'] })
expect(useAppStore.getState().codexRestartNoticeByPtyId['pty-1']).toEqual({
previousAccountLabel: ACCOUNT_A,
nextAccountLabel: ACCOUNT_B