@devries-cameron20 / t3code Mirror · read-only / commits / 293938b91a
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 23, 00:30 UTC

fix(server): an interrupted run no longer starts the settle timer on a snoozed thread (#17789)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Julius Marminge <julius0216@outlook.com>

Evolve Performance committed Oct 20, 2026 at 04:13 UTC 293938b91a6aacf8622cd91001ea324856a240da
2 files changed +10 -11
apps/server/src/orchestration-v2/ThreadSettlementService.test.ts
+8 -1
@@ -177,10 +177,17 @@ describe("isAutoSettlementCandidate", () => {
177 ).toBe(true);
178 expect(
179 ThreadSettlementService.isAutoSettlementCandidate(
180 - shell({ ...snoozed, latestRunCompletedAt: at(-30 * 60 * 1_000) }),
180 + shell({ ...snoozed, status: "completed", latestRunCompletedAt: at(-30 * 60 * 1_000) }),
181 NOW_MS,
182 ),
183 ).toBe(true);
184 + // An interrupted run leaves the thread snoozed, as the sidebar shows it.
185 + expect(
186 + ThreadSettlementService.isAutoSettlementCandidate(
187 + shell({ ...snoozed, status: "interrupted", latestRunCompletedAt: at(-30 * 60 * 1_000) }),
188 + NOW_MS,
189 + ),
190 + ).toBe(false);
191 expect(
192 ThreadSettlementService.isAutoSettlementCandidate(
193 shell({ ...snoozed, status: "failed", latestRunCompletedAt: at(-2 * 60 * 60 * 1_000) }),
apps/server/src/orchestration-v2/ThreadSettlementService.ts
+2 -10
@@ -166,16 +166,8 @@ export function isAutoSettlementCandidate(
166 if (thread.activityRunStatus != null) return false;
167 if (backgroundWorkHoldsCompletion(thread.pendingBackgroundTasks ?? [])) return false;
168 if (threadHasQueuedTurnStart(thread, nowMs)) return false;
169 - const snoozedUntilMs = toMillis(thread.snoozedUntil);
170 - if (snoozedUntilMs === null || snoozedUntilMs <= nowMs) return true;
171 - const snoozedAtMs = toMillis(thread.snoozedAt);
172 - const completedAtMs = toMillis(thread.latestRunCompletedAt);
173 - const wokeOnError =
174 - thread.status === "failed" &&
175 - (snoozedAtMs === null || (completedAtMs !== null && completedAtMs > snoozedAtMs));
176 - const wokeOnCompletion =
177 - snoozedAtMs !== null && completedAtMs !== null && completedAtMs > snoozedAtMs;
178 - return wokeOnError || wokeOnCompletion;
169 + // Interrupted runs must keep the same snooze protection the sidebar shows.
170 + return !isSnoozed(thread, nowMs);
171 }
172
173 /**