The best way to control Claude Code, Codex and more from any computer or phone
fix(shared): choose duration unit after rounding seconds (#20299)
Kevin Rajan committed
Oct 18, 2026 at 14:33 UTC
bd93830550d57e38fa9f2cf7a486c76058818359
2 files changed
+5
-1
packages/shared/src/orchestrationTiming.test.ts
+3
@@ -13,6 +13,9 @@ describe("formatDuration", () => {
13
[1_500, "1.5s"],
14
[9_950, "10s"],
15
[22_000, "22s"],
16
+ [59_499, "59s"],
17
+ [59_500, "1m"],
18
+ [59_999, "1m"],
19
[60_000, "1m"],
20
[65_000, "1m 5s"],
21
[119_500, "2m"],
packages/shared/src/orchestrationTiming.ts
+2
-1
@@ -38,8 +38,9 @@ export function formatDuration(durationMs: number): string {
38
const tenths = Math.round(durationMs / 100) / 10;
39
return tenths >= 10 ? "10s" : `${tenths.toFixed(1)}s`;
40
}
41
- if (durationMs < 60_000) return `${Math.round(durationMs / 1_000)}s`;
41
const totalSeconds = Math.round(durationMs / 1_000);
42
+ // Choose the unit after rounding so 59.5 seconds never renders as "60s".
43
+ if (totalSeconds < 60) return `${totalSeconds}s`;
44
const hours = Math.floor(totalSeconds / 3_600);
45
const minutes = Math.floor((totalSeconds % 3_600) / 60);
46
const seconds = totalSeconds % 60;