fix(quick-pane): preserve lifecycle and answer history

This commit is contained in:
2026-08-25 23:08:45 +02:00
parent 1b0b34fad8
commit 4fc9c60ade
8 changed files with 506 additions and 65 deletions
+30 -2
View File
@@ -162,7 +162,7 @@ test("sends abort without waiting behind a blocked prompt", async () => {
await registry.stop();
});
test("keeps a runtime healthy after a non-terminal adapter diagnostic", async () => {
test("keeps a runtime healthy after an unknown non-terminal Pi notification", async () => {
const worktrees = await createWorktrees();
const fixture = createAdapterFactory();
const registry = createAgentRegistry({
@@ -173,7 +173,10 @@ test("keeps a runtime healthy after a non-terminal adapter diagnostic", async ()
await registry.start();
fixture.calls[0].options.onError(
{ code: "frame_too_large", message: "Pi RPC frame exceeds 32 bytes" },
{
code: "unsupported_event",
message: "Pi RPC emitted unsupported event: future_pi_notification",
},
{ terminal: false },
);
@@ -184,6 +187,31 @@ test("keeps a runtime healthy after a non-terminal adapter diagnostic", async ()
await registry.stop();
});
test("keeps explicit transport failures terminal", async () => {
const worktrees = await createWorktrees();
const fixture = createAdapterFactory();
const registry = createAgentRegistry({
homeWorktree: worktrees.home,
sessionRoot: worktrees.sessionRoot,
startAdapter: fixture.startAdapter,
});
await registry.start();
fixture.calls[0].options.onError({
code: "invalid_json",
message: "Pi RPC emitted invalid JSON",
});
const runtime = registry.getWorkspace().directories[0].runtimes[0];
assert.equal(runtime.state, "error");
assert.equal(runtime.attention, true);
assert.deepEqual(runtime.error, {
code: "invalid_json",
message: "Pi RPC emitted invalid JSON",
});
await registry.stop();
});
test("stops agents created during shutdown and rejects new selections", async () => {
const worktrees = await createWorktrees();
const fixture = createAdapterFactory();