From 2e4766968072d4995fe0857612c433e2f2e1eb5d Mon Sep 17 00:00:00 2001 From: Brennan Benson <79079362+brennanb2025@users.noreply.github.com> Date: Sun, 26 Jul 2026 17:28:33 -0700 Subject: [PATCH] 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. --- src/renderer/src/lib/codex-stale-pane-sweep.test.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/renderer/src/lib/codex-stale-pane-sweep.test.ts b/src/renderer/src/lib/codex-stale-pane-sweep.test.ts index 05f08bcbccc..6cc6ef354a8 100644 --- a/src/renderer/src/lib/codex-stale-pane-sweep.test.ts +++ b/src/renderer/src/lib/codex-stale-pane-sweep.test.ts @@ -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