Add merge-seam test guarding Codex suppression over attention path

Locks the order where shouldSuppressHookCompletion short-circuits before
the dispatchAttention path introduced on main, so auto-approved Codex
waiting/blocked pauses never resurface as notifications.

Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
brennanb2025
2026-06-28 13:30:16 -07:00
co-authored by Orca
parent 7c40ad7038
commit 8b2377f7b2
@@ -1109,6 +1109,47 @@ describe('agent completion coordinator', () => {
)
})
it('suppresses the attention dispatch when shouldSuppressHookCompletion matches', () => {
// Why: guards the merge seam where the suppressor must short-circuit before
// the attention path, so auto-approved Codex pauses never notify.
const dispatchCompletion = vi.fn()
const dispatchAttention = vi.fn()
const coordinator = createAgentCompletionCoordinator({
paneKey: 'tab-1:leaf-1',
getPtyId: () => 'pty-1',
getSettings: () => null,
inspectProcess: vi.fn(),
dispatchCompletion,
dispatchAttention,
isLive: () => true,
shouldSuppressHookCompletion: (payload) =>
payload.state === 'waiting' || payload.state === 'blocked'
})
const turn = {
prompt: 'implement notifications',
agentType: 'codex' as const
}
coordinator.observeHookStatus({ state: 'working', ...turn })
coordinator.observeHookStatus({
state: 'waiting',
...turn,
toolName: 'exec_command',
toolInput: 'git status'
})
coordinator.observeHookStatus({
state: 'blocked',
...turn,
toolName: 'exec_command',
toolInput: 'rm file'
})
vi.advanceTimersByTime(HOOK_DONE_QUIET_MS)
expect(dispatchAttention).not.toHaveBeenCalled()
expect(dispatchCompletion).not.toHaveBeenCalled()
})
it('does not dispatch completion when a blocked state arrives mid-turn', () => {
const dispatchCompletion = vi.fn()
const dispatchAttention = vi.fn()