test(ui): add regression test for session.message guard during active chat run

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
scotthuang
2026-04-15 13:45:09 +08:00
committed by Vincent Koc
parent 9eb497c4f5
commit 28871e7dd9

View File

@@ -142,6 +142,22 @@ describe("handleGatewayEvent session.message", () => {
expect(loadChatHistoryMock).toHaveBeenCalledWith(host);
});
it("skips history reload while a chat run is active", () => {
loadChatHistoryMock.mockReset();
const host = createHost();
host.sessionKey = "agent:qa:main";
host.chatRunId = "run-123";
handleGatewayEvent(host, {
type: "event",
event: "session.message",
payload: { sessionKey: "agent:qa:main" },
seq: 1,
});
expect(loadChatHistoryMock).not.toHaveBeenCalled();
});
it("ignores transcript updates for other sessions", () => {
loadChatHistoryMock.mockReset();
const host = createHost();