Skip to content

fix: roll rounded durations into seconds#100006

Merged
clawsweeper[bot] merged 1 commit into
openclaw:mainfrom
qingminglong:codex/issue-99978-duration-rollover
Jul 4, 2026
Merged

fix: roll rounded durations into seconds#100006
clawsweeper[bot] merged 1 commit into
openclaw:mainfrom
qingminglong:codex/issue-99978-duration-rollover

Conversation

@qingminglong

@qingminglong qingminglong commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Closes #99978

What Problem This Solves

Fixes an issue where users reading duration output could see 1000ms when a sub-second value such as 999.6ms rounded up to the next unit boundary.

Why This Change Was Made

The duration helpers now decide whether to stay in milliseconds after calculating the rounded millisecond value, so values that round to 1000ms flow through the existing seconds formatting path. This keeps the fix limited to the shared formatter behavior and adds regression coverage for all three affected duration displays.

User Impact

Timing text now stays in the expected unit scheme: rounded sub-second durations display as 1s instead of the confusing 1000ms edge case.

Evidence

  • Claim proved: formatDurationPrecise, formatDurationCompact, and formatDurationHuman return 1s for 999.6ms.
  • Commands / artifacts:
    • git diff --check passed.
    • node scripts/run-vitest.mjs src/infra/format-time/format-time.test.ts --reporter=verbose passed: 1 file, 60 tests.
    • node --import tsx -e "const m=await import('./src/infra/format-time/format-duration.ts'); console.log(JSON.stringify({precise:m.formatDurationPrecise(999.6),compact:m.formatDurationCompact(999.6),human:m.formatDurationHuman(999.6)}))" printed {"precise":"1s","compact":"1s","human":"1s"}.
    • python .agents\skills\autoreview\scripts\autoreview --mode local passed with no accepted/actionable findings.
  • Observed result: all affected duration helpers roll rounded 1000ms values into the existing seconds display path.
  • Not tested / proof gaps:
    • No broad suite or full typecheck run; this is a two-file formatter fix and the focused formatter test covers the changed behavior.
    • First focused test attempt failed because the fresh isolated worktree had no node_modules (OPENCLAW_MISSING_VITEST); corepack pnpm install --frozen-lockfile completed successfully and the same focused test passed afterward.

AI-assisted with Codex.

@clawsweeper

clawsweeper Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Codex review: passed. Reviewed July 4, 2026, 4:33 PM ET / 20:33 UTC.

Summary
The branch updates the shared duration helpers to branch on rounded millisecond values and adds 999.6ms expectations for compact, human, and precise duration output.

PR surface: Source +3, Tests +2. Total +5 across 2 files.

Reproducibility: yes. Current main source branches on raw ms < 1000 before rounding in all three helpers, and the linked issue plus prior review include direct module proof that 999.6ms returned 1000ms.

Review metrics: none identified.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #99978
Summary: This PR is the candidate fix for the canonical duration rollover issue, and searches found no competing canonical item.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🦞 diamond lobster
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • none.

Next step before merge

  • [P2] No repair lane is needed; this PR is already the narrow fix candidate and can proceed through the opted-in exact-head automerge gates.

Security
Cleared: The diff only changes local TypeScript formatter logic and colocated tests; it does not touch dependencies, workflows, scripts, secrets, permissions, or other code-execution surfaces.

Review details

Best possible solution:

Land this narrow shared formatter and regression-test change through the exact-head automerge and CI gates so the linked issue closes cleanly.

Do we have a high-confidence way to reproduce the issue?

Yes. Current main source branches on raw ms < 1000 before rounding in all three helpers, and the linked issue plus prior review include direct module proof that 999.6ms returned 1000ms.

Is this the best way to solve the issue?

Yes. Branching on the rounded millisecond value in the shared formatter is the narrowest maintainable fix and avoids caller-specific display patches.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 7a0188cbd20d.

Label changes

Label changes:

  • add status: 🚀 automerge armed: This PR is in ClawSweeper's automerge lane. Sufficient (terminal): The PR body includes focused test output plus a direct terminal command showing all three helpers return 1s for 999.6ms after the change.
  • remove status: 👀 ready for maintainer look: Current PR status label is status: 🚀 automerge armed.

Label justifications:

  • P3: This is a small, cosmetic user-visible formatter bug fix with a narrow shared helper surface and low operational urgency.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 🚀 automerge armed: This PR is in ClawSweeper's automerge lane. Sufficient (terminal): The PR body includes focused test output plus a direct terminal command showing all three helpers return 1s for 999.6ms after the change.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes focused test output plus a direct terminal command showing all three helpers return 1s for 999.6ms after the change.
Evidence reviewed

PR surface:

Source +3, Tests +2. Total +5 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 9 6 +3
Tests 1 3 1 +2
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 12 7 +5

What I checked:

  • Current main behavior: Current main still checks raw ms < 1000 before rounding in all three shared duration helpers, so the linked rollover bug remains present on main. (src/infra/format-time/format-duration.ts:36, 7a0188cbd20d)
  • PR implementation: The PR head computes roundedMs before the millisecond branch and lets rounded 1000ms values fall through to the existing seconds path. (src/infra/format-time/format-duration.ts:36, 9e069731128b)
  • Regression coverage: The PR adds or updates 999.6ms expectations so compact, human, and precise formatting all expect 1s. (src/infra/format-time/format-time.test.ts:37, 9e069731128b)
  • Shared surface: Repository search shows the helpers feed CLI, status, UI, plugin SDK, and channel-facing display paths, so fixing the shared helper is the right owner boundary. (src/plugin-sdk/runtime-env.ts:25, 7a0188cbd20d)
  • Linked canonical issue: The PR closes the open canonical issue for the exact 999.5-999.99ms duration formatter rollover behavior.
  • Canonical search: Searches for duration formatter rollover terms found the linked issue but no separate replacement or duplicate fix path.

Likely related people:

  • quotentiroler: Authored and merged the centralized date/time formatter PR that added the shared duration formatter and its tests. (role: introduced behavior; confidence: high; commits: a1123dd9bea5; files: src/infra/format-time/format-duration.ts, src/infra/format-time/format-time.test.ts)
  • steipete: Made later duration formatter coverage and fallback-hardening changes around the same helper/test surface. (role: recent area contributor; confidence: high; commits: fa059472252c, eef2f82986fe; files: src/infra/format-time/format-duration.ts, src/infra/format-time/format-time.test.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
Review history (2 earlier review cycles)
  • reviewed 2026-07-04T15:27:52.361Z sha 9e06973 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-04T15:32:35.637Z sha 9e06973 :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Jul 4, 2026
@Takhoffman

Copy link
Copy Markdown
Contributor

@clawsweeper automerge

@clawsweeper

clawsweeper Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

🦞✅
ClawSweeper merged this PR after the passing review.

Source: clawsweeper[bot]
Feedback: structured ClawSweeper verdict: pass (sha=9e069731128b91a1fb8b11815beed8767c52fd51)
Merge status: merged by ClawSweeper automerge
Merged at: 2026-07-04T20:34:58Z
Merge commit: b30278895c3c

What merged:

  • The branch updates the shared duration helpers to branch on rounded millisecond values and adds 999.6ms expectations for compact, human, and precise duration output.
  • PR surface: Source +3, Tests +2. Total +5 across 2 files.
  • Reproducibility: yes. Current main source branches on raw ms < 1000 before rounding in all three helpers, and the linked issue plus prior review include direct module proof that 999.6ms returned 1000ms.

Automerge notes:

  • No ClawSweeper repair was needed after automerge opt-in.

The automerge loop is complete.

Automerge progress:

  • 2026-07-04 20:30:07 UTC review queued 9e069731128b (queued)
  • 2026-07-04 20:34:30 UTC review passed 9e069731128b (structured ClawSweeper verdict: pass (sha=9e069731128b91a1fb8b11815beed8767c52f...)
  • 2026-07-04 20:34:59 UTC merged 9e069731128b (merged by ClawSweeper automerge)

@clawsweeper clawsweeper Bot added clawsweeper:automerge Maintainer opted this PR into bounded ClawSweeper-reviewed automerge status: 🚀 automerge armed This PR is in ClawSweeper's automerge lane. and removed status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Jul 4, 2026
@clawsweeper
clawsweeper Bot merged commit b302788 into openclaw:main Jul 4, 2026
158 of 168 checks passed
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 5, 2026
Summary:
- The branch updates the shared duration helpers to branch on rounded millisecond values and adds 999.6ms expectations for compact, human, and precise duration output.
- PR surface: Source +3, Tests +2. Total +5 across 2 files.
- Reproducibility: yes. Current main source branches on raw `ms < 1000` before rounding in all three helpers, and the linked issue plus prior review include direct module proof that 999.6ms returned `1000ms`.

Automerge notes:
- No ClawSweeper repair was needed after automerge opt-in.

Validation:
- ClawSweeper review passed for head 9e06973.
- Required merge gates passed before the squash merge.

Prepared head SHA: 9e06973
Review: openclaw#100006 (comment)

Co-authored-by: qingminlong <[email protected]>
Approved-by: takhoffman
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clawsweeper:automerge Maintainer opted this PR into bounded ClawSweeper-reviewed automerge P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS status: 🚀 automerge armed This PR is in ClawSweeper's automerge lane.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: duration formatters render 999.5–999.99ms as "1000ms" instead of "1s"

2 participants