@devries-cameron20 / t3code Mirror · read-only / commits / 7a03a74189
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 22, 05:45 UTC

fix(server): messages cut by a restart no longer stay marked as streaming (#28646)

Abhishek B R committed Nov 4, 2026 at 04:35 UTC 7a03a74189158ec8468b21d5e744f75b0507d24a
2 files changed +30 -1
apps/server/src/orchestration-v2/ProviderRuntimeRecoveryService.test.ts
+23
@@ -674,6 +674,14 @@ it.effect(
674 nodeId: rootNodeId,
675 status: "running",
676 },
677 + ...(["assistant_message", "reasoning", "proposed_plan"] as const).map((type) => ({
678 + id: TurnItemId.make(`turn_item_recovery_cancel_${type}`),
679 + runId,
680 + nodeId: rootNodeId,
681 + type,
682 + status: "running",
683 + streaming: true,
684 + })),
685 ],
686 } as unknown as OrchestrationV2ThreadProjection;
687 const layer = ProviderRuntimeRecovery.layer.pipe(
@@ -727,12 +735,27 @@ it.effect(
735 ["provider-turn.updated", "cancelled"],
736 ["message.updated", null],
737 ["turn-item.updated", "cancelled"],
738 + ["turn-item.updated", "cancelled"],
739 + ["turn-item.updated", "cancelled"],
740 + ["turn-item.updated", "cancelled"],
741 ["provider-thread.updated", "idle"],
742 ["provider-session.updated", "stopped"],
743 ],
744 );
745 const messageEvent = events.find((event) => event.type === "message.updated");
746 assert.isFalse(messageEvent?.type === "message.updated" && messageEvent.payload.streaming);
747 + assert.deepEqual(
748 + events.flatMap((event) =>
749 + event.type === "turn-item.updated" && "streaming" in event.payload
750 + ? [[event.payload.type, event.payload.streaming]]
751 + : [],
752 + ),
753 + [
754 + ["assistant_message", false],
755 + ["reasoning", false],
756 + ["proposed_plan", false],
757 + ],
758 + );
759 }).pipe(Effect.provide(layer));
760 },
761 );
apps/server/src/orchestration-v2/ProviderRuntimeRecoveryService.ts
+7 -1
@@ -154,7 +154,13 @@ const cancelledItem = (
154 ): OrchestrationV2ThreadProjection["turnItems"][number] =>
155 item.type === "secret_request" && item.secretStatus === "pending"
156 ? { ...item, status: "cancelled", secretStatus: "cancelled", completedAt: now, updatedAt: now }
157 - : { ...item, status: "cancelled", completedAt: now, updatedAt: now };
157 + : {
158 + ...item,
159 + ...("streaming" in item ? { streaming: false } : {}),
160 + status: "cancelled",
161 + completedAt: now,
162 + updatedAt: now,
163 + };
164
165 function latestStartedRun(
166 projection: ProjectionStore.ProjectionRuntimeRecoveryState,