@devries-cameron20 / t3code-1 / commits / 7aad7911f6
Fork 0

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

fix(server): let stopped threads settle immediately (#5553)

Theo Browne committed Aug 6, 2026 at 21:43 UTC 7aad7911f66c2fecba1cfd6601ea783a3fe2bf31
2 files changed +9 -1
apps/server/src/orchestration/Layers/ProjectionPipeline.test.ts
+7
@@ -1430,6 +1430,13 @@ it.layer(BaseTestLayer)("OrchestrationProjectionPipeline", (it) => {
1430 assert.deepEqual(settledRows, [
1431 { state: "completed", completedAt: "2026-01-01T00:01:00.000Z" },
1432 ]);
1433 +
1434 + const threadRows = yield* sql<{ readonly latestTurnId: string | null }>`
1435 + SELECT latest_turn_id AS "latestTurnId"
1436 + FROM projection_threads
1437 + WHERE thread_id = ${threadId}
1438 + `;
1439 + assert.deepEqual(threadRows, [{ latestTurnId: turnId }]);
1440 }),
1441 );
1442
apps/server/src/orchestration/Layers/ProjectionPipeline.ts
+2 -1
@@ -850,7 +850,8 @@ const makeOrchestrationProjectionPipeline = Effect.fn("makeOrchestrationProjecti
850 }
851 yield* projectionThreadRepository.upsert({
852 ...existingRow.value,
853 - latestTurnId: event.payload.session.activeTurnId,
853 + // activeTurnId describes current work; a terminal session must not erase history.
854 + latestTurnId: event.payload.session.activeTurnId ?? existingRow.value.latestTurnId,
855 updatedAt: event.occurredAt,
856 });
857 yield* refreshThreadShellSummary(event.payload.threadId);