mirror of
https://github.com/stablyai/orca.git
synced 2026-10-16 16:03:26 +00:00
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:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user