mirror of
https://github.com/stablyai/orca.git
synced 2026-10-24 00:04:01 +00:00
test(native-chat): restore settled-error session-switch regression
a6e2379bd1 replaced this test with the in-flight settlement race test,
leaving the render-time error reset unpinned: deleting the reset block
still passed the whole native-chat suite. Keep both scenarios pinned;
they are distinct (settled error clears on switch vs stale settlement
invalidated in the commit-to-passive window).
This commit is contained in:
@@ -379,6 +379,32 @@ describe('useStructuredAgentSessionOutbox', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('drops a session error on switch and does not resurrect it on return', async () => {
|
||||
const redispatch = deferred<ReturnType<typeof acceptedResult>>()
|
||||
mocks.call
|
||||
.mockResolvedValueOnce(refusedResult('agent_session_checkpoint_stale'))
|
||||
.mockReturnValueOnce(redispatch.promise)
|
||||
const { result, rerender } = renderHook(
|
||||
({ sessionId }: { sessionId: string }) =>
|
||||
useStructuredAgentSessionOutbox({
|
||||
sessionId,
|
||||
target: LOCAL_TARGET,
|
||||
fence: 1,
|
||||
submissions: []
|
||||
}),
|
||||
{ initialProps: { sessionId: 'session-1' } }
|
||||
)
|
||||
|
||||
act(() => expect(result.current.send('hello')).toBe(true))
|
||||
await waitFor(() => expect(result.current.error).toBe('agent_session_checkpoint_stale'))
|
||||
|
||||
rerender({ sessionId: 'session-2' })
|
||||
expect(result.current.error).toBeNull()
|
||||
|
||||
rerender({ sessionId: 'session-1' })
|
||||
expect(result.current.error).toBeNull()
|
||||
})
|
||||
|
||||
it('invalidates an old dispatch before it settles during a session switch', async () => {
|
||||
const oldDispatch = deferred<ReturnType<typeof refusedResult>>()
|
||||
const sessionTwoCommitted = deferred<void>()
|
||||
|
||||
Reference in New Issue
Block a user