fix(collab-web): make host state authoritative for guest liveness

This commit is contained in:
robomp-bot
2026-07-29 17:33:52 +09:00
parent cc00ab161b
commit 12d0363b75
4 changed files with 42 additions and 2 deletions
+28
View File
@@ -192,6 +192,34 @@ describe("GuestClient frame apply", () => {
client.applyFrameForTest({ t: "state", state: { ...STATE, isStreaming: false } });
expect(client.getSnapshot().working).toBe(false);
});
it("a state frame recovers a stuck-idle guest when agent_start was dropped", () => {
// The host begins streaming mid-turn, but the matching `agent_start`
// never arrived (e.g. dropped on a reconnect). Before the fix nothing
// set `working` true except `agent_start`, so the guest stayed idle.
const client = liveClient();
expect(client.getSnapshot().working).toBe(false);
client.applyFrameForTest({ t: "state", state: { ...STATE, isStreaming: true } });
expect(client.getSnapshot().working).toBe(true);
});
it("an idle state frame clears a pinned tool card when tool_execution_end was dropped", () => {
// Host reports idle, but the matching `tool_execution_end` was dropped,
// leaving a stuck tool card. The authoritative idle signal must clear it.
const client = liveClient();
client.applyFrameForTest({
t: "event",
event: {
type: "tool_execution_start",
toolCallId: "tc1",
toolName: "bash",
args: { command: "ls" },
intent: "Listing",
},
});
expect(client.getSnapshot().activeTools.size).toBe(1);
client.applyFrameForTest({ t: "state", state: { ...STATE, isStreaming: false } });
expect(client.getSnapshot().activeTools.size).toBe(0);
});
it("bus progress frames update the progress map", () => {
const client = liveClient();