-
-
Notifications
You must be signed in to change notification settings - Fork 80.7k
[Bug]: duration formatters render 999.5–999.99ms as "1000ms" instead of "1s" #99978
Copy link
Copy link
Closed
Closed
Copy link
Labels
P3Low-priority cleanup, docs, polish, ergonomics, or speculative work.Low-priority cleanup, docs, polish, ergonomics, or speculative work.clawsweeper:current-main-reproClawSweeper found a high-confidence current-main issue reproduction.ClawSweeper found a high-confidence current-main issue reproduction.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.ClawSweeper marked this issue as an existing queue_fix_pr work candidate.impact:ux-frictionUser-facing flow adds avoidable confusion or support burden without fully blocking progress.User-facing flow adds avoidable confusion or support burden without fully blocking progress.issue-rating: 🦀 challenger crabExceptional issue quality: high-confidence current-main reproduction and actionable evidence.Exceptional issue quality: high-confidence current-main reproduction and actionable evidence.maturity:stableIssue affects a taxonomy feature currently scored M4/M5.Issue affects a taxonomy feature currently scored M4/M5.no-staleExclude from stale automationExclude from stale automation
Description
Metadata
Metadata
Assignees
Labels
P3Low-priority cleanup, docs, polish, ergonomics, or speculative work.Low-priority cleanup, docs, polish, ergonomics, or speculative work.clawsweeper:current-main-reproClawSweeper found a high-confidence current-main issue reproduction.ClawSweeper found a high-confidence current-main issue reproduction.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.ClawSweeper marked this issue as an existing queue_fix_pr work candidate.impact:ux-frictionUser-facing flow adds avoidable confusion or support burden without fully blocking progress.User-facing flow adds avoidable confusion or support burden without fully blocking progress.issue-rating: 🦀 challenger crabExceptional issue quality: high-confidence current-main reproduction and actionable evidence.Exceptional issue quality: high-confidence current-main reproduction and actionable evidence.maturity:stableIssue affects a taxonomy feature currently scored M4/M5.Issue affects a taxonomy feature currently scored M4/M5.no-staleExclude from stale automationExclude from stale automation
Type
Fields
Priority
None yet
What happened
All three duration formatters check
ms < 1000before rounding, so inputs in[999.5, 1000)fall into the milliseconds branch and render as the out-of-scheme string"1000ms"instead of"1s".Code:
formatDurationPrecise:openclaw/src/infra/format-time/format-duration.ts
Lines 36 to 38 in 4287d26
formatDurationCompact:openclaw/src/infra/format-time/format-duration.ts
Lines 58 to 60 in 4287d26
formatDurationHuman:openclaw/src/infra/format-time/format-duration.ts
Lines 88 to 90 in 4287d26
Repro
Note the same file already guards the analogous rollover for token counts in
formatTokenShort("Rounding can reach 1000 … fall through to the million branch"), seesrc/shared/subagents-format.ts#L17-L24— the duration helpers miss the same edge.Expected
"1s"for any input that rounds to 1000ms (round first, or branch on the rounded value).Impact
Cosmetic but user-visible: fractional millisecond timings (provider latency, tool timing) can display as
1000ms.Environment
Current
main(4287d26).Found via source review (AI-assisted).