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, 14:45 UTC
fix(clients): a one-hour snooze no longer reads "2h left" (#36785)
Co-authored-by: Alex Southwell <4596216+saphid@users.noreply.github.com> Co-authored-by: maria-rcks <maria@kuuro.net> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Julius Marminge committed
Nov 14, 2026 at 07:22 UTC
04572419e4add427333d482aa560cc6419bd3d51
2 files changed
+19
-6
packages/client-runtime/src/state/threadSettled.ts
+6
-6
@@ -37,7 +37,6 @@ interface QueuedThreadShell {
37
* Bound the pending window so those threads can eventually settle.
38
*/
39
export const QUEUED_TURN_START_GRACE_MS = 2 * 60 * 1_000;
40
-const DAY_MS = 24 * 60 * 60 * 1_000;
40
41
export function hasQueuedTurnStart(
42
shell: QueuedThreadShell,
@@ -352,11 +351,12 @@ export function snoozeWakeLabel(snoozedUntil: string, options: { readonly now: s
351
const wakeMs = Date.parse(snoozedUntil);
352
const nowMs = Date.parse(options.now);
353
if (Number.isNaN(wakeMs) || Number.isNaN(nowMs)) return "now";
355
- const remainingMs = wakeMs - nowMs;
356
- if (remainingMs <= 0) return "now";
357
- if (remainingMs < HOUR_MS) return `${Math.max(1, Math.ceil(remainingMs / 60_000))}m`;
358
- if (remainingMs < DAY_MS) return `${Math.ceil(remainingMs / HOUR_MS)}h`;
359
- return `${Math.ceil(remainingMs / DAY_MS)}d`;
354
+ if (wakeMs <= nowMs) return "now";
355
+ // Count clock minutes: callers pass a minute-floored or live `now`, and durations keep seconds.
356
+ const minutes = Math.max(1, Math.floor(wakeMs / 60_000) - Math.floor(nowMs / 60_000));
357
+ if (minutes < 60) return `${minutes}m`;
358
+ if (minutes < 24 * 60) return `${Math.ceil(minutes / 60)}h`;
359
+ return `${Math.ceil(minutes / (24 * 60))}d`;
360
}
361
362
export type CustomSnoozeInput =
packages/client-runtime/src/state/threadSnoozed.test.ts
+13
@@ -13,6 +13,7 @@ import {
13
hasUnseenRunFailure,
14
pickSnoozePreset,
15
resolveSnoozePresets,
16
+ snoozeWakeLabel,
17
threadRaisedHandWhileSnoozed,
18
threadWokeAt,
19
isThreadWokeUnseen,
@@ -504,6 +505,18 @@ describe("pickSnoozePreset", () => {
505
});
506
});
507
508
+describe("snoozeWakeLabel", () => {
509
+ it("reads a one-hour snooze as 1h on minute and live clocks", () => {
510
+ const wake = "2026-04-10T13:00:30.000Z";
511
+ expect(snoozeWakeLabel(wake, { now: NOW })).toBe("1h");
512
+ expect(snoozeWakeLabel(wake, { now: "2026-04-10T12:00:40.000Z" })).toBe("1h");
513
+ expect(snoozeWakeLabel("2026-04-10T15:00:30.000Z", { now: NOW })).toBe("3h");
514
+ expect(snoozeWakeLabel(wake, { now: "2026-04-10T12:01:00.000Z" })).toBe("59m");
515
+ expect(snoozeWakeLabel(wake, { now: "2026-04-10T13:00:10.000Z" })).toBe("1m");
516
+ expect(snoozeWakeLabel(wake, { now: "2026-04-10T13:00:30.000Z" })).toBe("now");
517
+ });
518
+});
519
+
520
it("dismisses a wake at its timestamp without hiding a later wake", () => {
521
const firstWake = "2026-04-10T10:00:00.000Z";
522
const state = {