Skip to content

Commit 6e8422a

Browse files
saphidclaude
authored andcommitted
fix(server): pinning a settled thread stamps its return to the active list
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 60aec28 commit 6e8422a

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

‎apps/server/src/orchestration-v2/Orchestrator.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3550,6 +3550,7 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functio
35503550
settledOverride:
35513551
thread.settledOverride === "settled" ? "active" : thread.settledOverride,
35523552
settledAt: thread.settledOverride === "settled" ? null : thread.settledAt,
3553+
...(thread.settledOverride === "settled" ? { unsettledAt: now } : {}),
35533554
snoozedUntil: null,
35543555
snoozedAt: null,
35553556
lastSnoozeWakeAt: thread.snoozedUntil == null ? thread.lastSnoozeWakeAt : now,

‎apps/server/src/orchestration-v2/runtimeLayer.test.ts‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2641,6 +2641,20 @@ it.layer(layerTest)("OrchestrationV2LayerLive lifecycle", (it) => {
26412641
);
26422642
assert.deepEqual(activeShell?.unsettledAt, activeProjection.thread.unsettledAt);
26432643

2644+
yield* orchestrator.dispatch({
2645+
type: "thread.settle",
2646+
commandId: CommandId.make("runtime-layer-lifecycle-resettle"),
2647+
threadId,
2648+
});
2649+
yield* orchestrator.dispatch({
2650+
type: "thread.pin",
2651+
commandId: CommandId.make("runtime-layer-lifecycle-pin-settled"),
2652+
threadId,
2653+
});
2654+
const pinnedProjection = yield* orchestrator.getThreadProjection(threadId);
2655+
assert.equal(pinnedProjection.thread.settledOverride, "active");
2656+
assert.isNotNull(pinnedProjection.thread.unsettledAt);
2657+
26442658
const archive = yield* orchestrator.dispatch({
26452659
type: "thread.archive",
26462660
commandId: CommandId.make("runtime-layer-lifecycle-archive"),

0 commit comments

Comments
 (0)