chore: stabilize Zhinian pilot delivery
This commit is contained in:
@@ -165,4 +165,31 @@ describe('gateway store event wiring', () => {
|
||||
expect(chatStateMock.state.activeRunId).toBeNull();
|
||||
expect(chatStateMock.state.pendingFinal).toBe(false);
|
||||
});
|
||||
|
||||
it('does not clear sending state for terminal notifications from a different active run', async () => {
|
||||
hostApiFetchMock.mockResolvedValueOnce({ state: 'running', port: 18789 });
|
||||
|
||||
const handlers = new Map<string, (payload: unknown) => void>();
|
||||
subscribeHostEventMock.mockImplementation((eventName: string, handler: (payload: unknown) => void) => {
|
||||
handlers.set(eventName, handler);
|
||||
return () => {};
|
||||
});
|
||||
|
||||
const { useGatewayStore } = await import('@/stores/gateway');
|
||||
await useGatewayStore.getState().init();
|
||||
|
||||
handlers.get('gateway:notification')?.({
|
||||
method: 'agent',
|
||||
params: {
|
||||
phase: 'completed',
|
||||
runId: 'stale-run',
|
||||
sessionKey: 'session-1',
|
||||
},
|
||||
});
|
||||
|
||||
await new Promise((resolve) => setTimeout(resolve, 0));
|
||||
expect(chatStateMock.state.sending).toBe(true);
|
||||
expect(chatStateMock.state.activeRunId).toBe('run-1');
|
||||
expect(chatStateMock.state.pendingFinal).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user