mirror of
https://github.com/stablyai/orca.git
synced 2026-10-09 08:02:35 +00:00
fix(pi): preserve non-terminal continuation guards
Keep the base Pi and Prime willContinue guard while settling terminal OMP events directly. Add regression coverage so sibling runtimes cannot publish a false completion after conflict resolution.
This commit is contained in:
@@ -86,4 +86,22 @@ describe('OMP agent_end contract', () => {
|
||||
vi.useRealTimers()
|
||||
}
|
||||
})
|
||||
|
||||
it('preserves non-terminal agent_end handling for Pi and Prime', async () => {
|
||||
vi.useFakeTimers()
|
||||
try {
|
||||
for (const kind of ['pi', 'prime-agent'] as const) {
|
||||
const harness = createAgentStatusExtensionHarness({ kind })
|
||||
const context = { isIdle: vi.fn(() => true) }
|
||||
|
||||
await harness.callHook('agent_end', { willContinue: true }, context)
|
||||
await vi.advanceTimersByTimeAsync(1_000)
|
||||
|
||||
expect(postedHookNames(harness.fetchMock)).toEqual([])
|
||||
expect(context.isIdle).not.toHaveBeenCalled()
|
||||
}
|
||||
} finally {
|
||||
vi.useRealTimers()
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
@@ -171,8 +171,11 @@ export function getPiAgentStatusHandlerSourceLines(kind: PiAgentKind): string[]
|
||||
'',
|
||||
" pi.on('agent_end', (event, ctx) => {",
|
||||
...captureSessionMetadata,
|
||||
' if (event?.willContinue === true) {',
|
||||
' clearPendingAgentEndCheck()',
|
||||
' return',
|
||||
' }',
|
||||
' if (isOmpRuntime()) {',
|
||||
' if (event?.willContinue === true) return',
|
||||
' postAgentEndOnce()',
|
||||
' return',
|
||||
' }',
|
||||
|
||||
Reference in New Issue
Block a user