@devries-cameron20 / t3code-1 / commits / 8670378049
Fork 0

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

fix(server): a fork no longer inherits the source thread's pin, auto-settle and delegation state (#28378)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Victor Vogel committed Nov 1, 2026 at 16:06 UTC 86703780497f0eb727b1879ef19681271f621f61
2 files changed +37 -4
apps/server/src/orchestration-v2/ThreadForkService.test.ts
+29 -3
@@ -134,14 +134,40 @@ const planFork = (
134 });
135 }).pipe(Effect.provide(ThreadForkService.layer));
136
137 -it.effect("keeps a fork awake when its source thread is snoozed", () =>
137 +it.effect("resets a fork's pin, snooze, settle and delegation state but keeps its origin", () =>
138 Effect.gen(function* () {
139 - const sourceThread = makeSourceThread();
139 + const linkOrigin = { sessionId: "mcp-session:fork-source", label: "Linked laptop" };
140 + const sourceThread: OrchestrationV2AppThread = {
141 + ...makeSourceThread(),
142 + lastSnoozeWakeAt: snoozedAt,
143 + pinnedAt: snoozedAt,
144 + pinOrderKey: "a0",
145 + activeOrderKey: "a1",
146 + autoSettleDisabledAt: snoozedAt,
147 + delegatedFrom: {
148 + environmentId: EnvironmentId.make("linked-environment"),
149 + threadId: ThreadId.make("linked-parent"),
150 + title: "Linked parent",
151 + },
152 + historyOrigin: "v1_import",
153 + linkOrigin,
154 + };
155 const sourceRun = makeSourceRun("completed");
141 - const result = yield* planFork(sourceRun);
156 + const result = yield* planFork(sourceRun, {
157 + ...makeSourceProjection(sourceRun),
158 + thread: sourceThread,
159 + });
160
161 assert.isNull(result.targetThread.snoozedUntil);
162 assert.isNull(result.targetThread.snoozedAt);
163 + assert.isNull(result.targetThread.lastSnoozeWakeAt);
164 + assert.isNull(result.targetThread.pinnedAt);
165 + assert.isNull(result.targetThread.pinOrderKey);
166 + assert.isNull(result.targetThread.activeOrderKey);
167 + assert.isNull(result.targetThread.autoSettleDisabledAt);
168 + assert.isUndefined(result.targetThread.delegatedFrom);
169 + assert.equal(result.targetThread.historyOrigin, "v1_import");
170 + assert.deepEqual(result.targetThread.linkOrigin, linkOrigin);
171 assert.equal(result.targetThread.projectId, sourceThread.projectId);
172 assert.equal(result.targetThread.providerInstanceId, sourceThread.providerInstanceId);
173 assert.deepEqual(result.targetThread.modelSelection, sourceThread.modelSelection);
apps/server/src/orchestration-v2/ThreadForkService.ts
+8 -1
@@ -99,8 +99,10 @@ export const layer: Layer.Layer<ThreadForkServiceV2> = Layer.succeed(
99 cause: forkableSourceRunStatusError(sourceRun),
100 });
101 }
102 + // The remote parent delegated the source thread, not its forks.
103 + const { delegatedFrom: _delegatedFrom, ...inherited } = input.sourceProjection.thread;
104 const targetThread: OrchestrationV2AppThread = {
103 - ...input.sourceProjection.thread,
105 + ...inherited,
106 // PR context follows the conversation; watching remains the source thread's responsibility.
107 pullRequests: input.sourceProjection.thread.pullRequests?.map(
108 ({ watch: _watch, ...link }) => link,
@@ -131,6 +133,11 @@ export const layer: Layer.Layer<ThreadForkServiceV2> = Layer.succeed(
133 settledAt: null,
134 snoozedUntil: null,
135 snoozedAt: null,
136 + lastSnoozeWakeAt: null,
137 + pinnedAt: null,
138 + pinOrderKey: null,
139 + activeOrderKey: null,
140 + autoSettleDisabledAt: null,
141 // A guest link belongs to the thread it was made for.
142 guestShare: null,
143 lastVisitedAt: null,