The best way to control Claude Code, Codex and more from any computer or phone
fix(server): settling a thread closes its waiting link cards (#38380)
Julius Marminge committed
Nov 17, 2026 at 16:40 UTC
1c818a80830f6b031c5ffd6d96d78b64d958b0dd
2 files changed
+22
-2
apps/server/src/orchestration-v2/Orchestrator.ts
+4
-2
@@ -5446,6 +5446,8 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functio
5446
now,
5447
cancelQueuedDelivery: false,
5448
});
5449
+ }
5450
+ if (command.type === "thread.archive" || command.type === "thread.settle") {
5451
yield* closePendingLinkRequests({ command, events, threadId: command.threadId, now });
5452
}
5453
@@ -10828,8 +10830,8 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functio
10830
10831
/**
10832
* Closes the link cards still waiting for the user. Their agent stopped
10831
- * waiting long ago, so nobody is woken: stopping or archiving the thread
10832
- * means the user is done with it.
10833
+ * waiting long ago, so nobody is woken: stopping, settling or archiving the
10834
+ * thread means the user is done with it.
10835
*/
10836
const closePendingLinkRequests = Effect.fn("orchestrationV2.closePendingLinkRequests")(
10837
function* (input: {
apps/server/src/peer/PeerLinkRequests.test.ts
+18
@@ -888,6 +888,24 @@ it.live("archiving the thread closes its open card", () =>
888
),
889
);
890
891
+it.live("settling the thread closes its open card, so it no longer reads as asking", () =>
892
+ withBoth((a, b) =>
893
+ Effect.gen(function* () {
894
+ yield* seedThread(a);
895
+ yield* a.call({ url: b.url });
896
+ yield* pendingCard(a);
897
+ yield* endRun(a);
898
+ yield* a.orchestrator.dispatch({
899
+ type: "thread.settle",
900
+ commandId: CommandId.make("command:settle:laptop"),
901
+ threadId,
902
+ });
903
+ expect(yield* cardOf(a)).toMatchObject({ status: "cancelled", linkStatus: "cancelled" });
904
+ expect((yield* a.orchestrator.getThreadShell(threadId))?.pendingRuntimeRequest).toBeNull();
905
+ }),
906
+ ),
907
+);
908
+
909
it.live("a code the box refuses fails the request with its reason, and links nothing", () =>
910
withBoth((a, b) =>
911
Effect.gen(function* () {