From 486e58ac29b806b2bce293aabacc089df6ef79a9 Mon Sep 17 00:00:00 2001 From: brennanb2025 Date: Wed, 8 Jul 2026 13:05:40 -0700 Subject: [PATCH] test: pin hook-only coordinators as push-driven with the done quiet window intact Adversarial review of the pollTrackingStarted gate surfaced the one real behavioral delta: hook-only coordinators (which never start process tracking) previously armed stub cadence polls whose null inspections cleared workingStatusObserved ~2s after each hook, silently bypassing the designed 1.5s done quiet window on panes only the hook coordinator observes. The gate makes them purely push-driven; this pins that as intentional. Co-authored-by: Orca --- ...ent-completion-no-evidence-cadence.test.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/renderer/src/components/terminal-pane/agent-completion-no-evidence-cadence.test.ts b/src/renderer/src/components/terminal-pane/agent-completion-no-evidence-cadence.test.ts index c3ac75d487e..b22cd614db4 100644 --- a/src/renderer/src/components/terminal-pane/agent-completion-no-evidence-cadence.test.ts +++ b/src/renderer/src/components/terminal-pane/agent-completion-no-evidence-cadence.test.ts @@ -138,6 +138,25 @@ describe('agent completion no-evidence inspection cadence', () => { expect(inspectProcess).toHaveBeenCalledTimes(8) }) + it('keeps cadence disarmed and the done quiet window intact when tracking never starts', async () => { + // Why: the hook-notification coordinator (agent-hook-completion-notifications) + // never calls startProcessTracking. Pre-gate, hook evidence armed stub polls + // whose null inspections cleared workingStatusObserved ~2s later, silently + // bypassing the designed done quiet window. The gate makes hook-only + // coordinators purely push-driven: no polls, quiet window preserved. + const inspectProcess = vi.fn(async () => processResult(null, false)) + const { coordinator, dispatchCompletion } = createCoordinator(inspectProcess) + + coordinator.observeHookStatus({ state: 'working', prompt: '', agentType: 'codex' }) + await vi.advanceTimersByTimeAsync(5_000) + expect(inspectProcess).not.toHaveBeenCalled() + + coordinator.observeHookStatus({ state: 'done', prompt: '', agentType: 'codex' }) + expect(dispatchCompletion).not.toHaveBeenCalled() + await vi.advanceTimersByTimeAsync(1_500) + expect(dispatchCompletion).toHaveBeenCalledTimes(1) + }) + it('does not accelerate the relaxed cadence when inspections keep erroring', async () => { const inspectProcess = vi.fn(async () => { throw new Error('scan failed')