From ca58f7940a60ed2daee2c23986df4f57a46dc500 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Tue, 17 Nov 2026 23:56:22 +0000 Subject: [PATCH 1/2] test(server): settling a thread closes its waiting link card (#38375) Fails on main: thread.settle leaves the link_request card waiting, so the thread shell keeps a blocking user_input pendingRuntimeRequest. Co-Authored-By: Claude Opus 5.5 --- apps/server/src/peer/PeerLinkRequests.test.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/apps/server/src/peer/PeerLinkRequests.test.ts b/apps/server/src/peer/PeerLinkRequests.test.ts index 2190e9a50e6a9..2eec22a90bfa0 100644 --- a/apps/server/src/peer/PeerLinkRequests.test.ts +++ b/apps/server/src/peer/PeerLinkRequests.test.ts @@ -888,6 +888,24 @@ it.live("archiving the thread closes its open card", () => ), ); +it.live("settling the thread closes its open card, so it no longer reads as asking", () => + withBoth((a, b) => + Effect.gen(function* () { + yield* seedThread(a); + yield* a.call({ url: b.url }); + yield* pendingCard(a); + yield* endRun(a); + yield* a.orchestrator.dispatch({ + type: "thread.settle", + commandId: CommandId.make("command:settle:laptop"), + threadId, + }); + expect(yield* cardOf(a)).toMatchObject({ status: "cancelled", linkStatus: "cancelled" }); + expect((yield* a.orchestrator.getThreadShell(threadId))?.pendingRuntimeRequest).toBeNull(); + }), + ), +); + it.live("a code the box refuses fails the request with its reason, and links nothing", () => withBoth((a, b) => Effect.gen(function* () { From c00918cdde496eb0620c38b8f57dc108577a7697 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Tue, 17 Nov 2026 23:59:42 +0000 Subject: [PATCH 2/2] fix(server): settling a thread closes its waiting link cards thread.settle cancelled pending runtime requests and automatic queued runs but left link_request cards waiting, so the settled thread kept a blocking user_input pending request and read as Awaiting Input. Close them on settle as stop and archive already do. Fixes pingdotgg/t3code#38375 Co-Authored-By: Claude Opus 5.5 --- apps/server/src/orchestration-v2/Orchestrator.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/server/src/orchestration-v2/Orchestrator.ts b/apps/server/src/orchestration-v2/Orchestrator.ts index 9ca65a32f3cf8..819aa90c03b98 100644 --- a/apps/server/src/orchestration-v2/Orchestrator.ts +++ b/apps/server/src/orchestration-v2/Orchestrator.ts @@ -5446,6 +5446,8 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functio now, cancelQueuedDelivery: false, }); + } + if (command.type === "thread.archive" || command.type === "thread.settle") { yield* closePendingLinkRequests({ command, events, threadId: command.threadId, now }); } @@ -10828,8 +10830,8 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functio /** * Closes the link cards still waiting for the user. Their agent stopped - * waiting long ago, so nobody is woken: stopping or archiving the thread - * means the user is done with it. + * waiting long ago, so nobody is woken: stopping, settling or archiving the + * thread means the user is done with it. */ const closePendingLinkRequests = Effect.fn("orchestrationV2.closePendingLinkRequests")( function* (input: {