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 21, 23:30 UTC
fix(server): scheduled task updates keep the saved workspace unless the binding changes (#32494)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Julius Marminge committed
Nov 11, 2026 at 00:55 UTC
46afd69a8b6dd4149747fd04d86576af009f7eec
2 files changed
+24
-4
apps/server/src/mcp/OrchestratorMcpService.test.ts
+21
-1
@@ -2911,7 +2911,13 @@ describe("OrchestratorMcpService provider resolution", () => {
2911
Effect.gen(function* () {
2912
const saved = yield* Ref.make<ReadonlyArray<ScheduledTask["workspaceStrategy"]>>([]);
2913
const mcp = yield* OrchestratorMcpService.OrchestratorMcpService.pipe(
2914
- Effect.provide(service(masterRepository, saved)),
2914
+ Effect.provide(
2915
+ service(masterRepository, saved, {
2916
+ ...existing,
2917
+ threadId: ThreadId.make("thread:scheduled-base"),
2918
+ threadMode: "continue",
2919
+ }),
2920
+ ),
2921
);
2922
yield* mcp.updateScheduledTask(client, {
2923
scheduledTaskId: existing.id,
@@ -2923,6 +2929,20 @@ describe("OrchestratorMcpService provider resolution", () => {
2929
}),
2930
);
2931
2932
+ it.effect("keeps the saved workspace when an unbound task stays unbound", () =>
2933
+ Effect.gen(function* () {
2934
+ const saved = yield* Ref.make<ReadonlyArray<ScheduledTask["workspaceStrategy"]>>([]);
2935
+ const mcp = yield* OrchestratorMcpService.OrchestratorMcpService.pipe(
2936
+ Effect.provide(service(masterRepository, saved)),
2937
+ );
2938
+ yield* mcp.updateScheduledTask(client, {
2939
+ scheduledTaskId: existing.id,
2940
+ bindToCurrentThread: false,
2941
+ });
2942
+ assert.deepEqual(yield* Ref.get(saved), [{ type: "root" }]);
2943
+ }),
2944
+ );
2945
+
2946
it.effect.each([
2947
{
2948
name: "no remote, only master",
apps/server/src/mcp/OrchestratorMcpService.ts
+3
-3
@@ -2070,11 +2070,11 @@ const make = Effect.gen(function* () {
2070
: input.bindToCurrentThread && parent !== undefined
2071
? parent.thread.id
2072
: null;
2073
- // Update workspace strategy on rebinding so unbound root tasks cannot run in the shared checkout.
2073
+ // Reset the workspace only when the binding flips, so unbinding cannot leave runs in the shared checkout.
2074
const workspaceStrategy =
2075
- input.bindToCurrentThread === undefined
2075
+ (threadId === null) === (existing.threadId === null)
2076
? existing.workspaceStrategy
2077
- : yield* scheduledTaskWorkspaceStrategy(input.bindToCurrentThread, existing.projectId);
2077
+ : yield* scheduledTaskWorkspaceStrategy(threadId !== null, existing.projectId);
2078
const upsertInput: ScheduledTaskUpsertInput = {
2079
id: existing.id,
2080
title: input.title ?? existing.title,