fix(bridge): forward Pi agent_end so the spinner stops at workflow completion
The FE derived 'working' purely as activeSession && !pendingWidget, so the
final workflow turn — the only one that ends without a follow-up gate —
left the spinner on forever (observed live: 21592s after F8 approve).
- SessionBridge maps Pi's agent_end -> SSE system_event {event: agent_end}
- PiProcessManager notifies the client (info error + synthetic agent_end)
when the child dies unexpectedly; expected teardowns stay silent
- sessionStore tracks agentActive (on: user entry/text_delta/ui_request,
off: agent_end); AppShell working now requires it; resume sets it
optimistically
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -54,6 +54,17 @@ test("respond correla sull'id RPC di Pi (non sull'id del descriptor) e azzera il
|
||||
expect(b.pendingWidget()).toBeNull();
|
||||
});
|
||||
|
||||
test("agent_end di Pi diventa un system_event agent_end per il FE", () => {
|
||||
const { rpc, fire } = fakeRpc();
|
||||
const b = new SessionBridge(rpc);
|
||||
const seen: any[] = [];
|
||||
b.onClientEvent((e) => seen.push(e));
|
||||
// Pi emette agent_end alla fine di ogni prompt (pi-agent-core agent-loop); e' il solo
|
||||
// segnale di fine turno: senza mapparlo il FE non puo' mai uscire dallo stato "working".
|
||||
fire({ type: "agent_end", messages: [] });
|
||||
expect(seen).toEqual([{ type: "system_event", event: "agent_end" }]);
|
||||
});
|
||||
|
||||
test("steer invia un comando steer", () => {
|
||||
const { rpc, sent } = fakeRpc();
|
||||
new SessionBridge(rpc).steer("considera solo il 2024");
|
||||
|
||||
Reference in New Issue
Block a user