Skip to content

fix(infra): roll session warning durations across unit boundaries#100096

Merged
vincentkoc merged 6 commits into
openclaw:mainfrom
NarahariRaghava:fix/session-maintenance-warning-duration-rollover
Jul 5, 2026
Merged

fix(infra): roll session warning durations across unit boundaries#100096
vincentkoc merged 6 commits into
openclaw:mainfrom
NarahariRaghava:fix/session-maintenance-warning-duration-rollover

Conversation

@NarahariRaghava

@NarahariRaghava NarahariRaghava commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Session maintenance warnings could display rounded durations as 60 seconds, 60 minutes, or 24 hours instead of promoting them to 1 minute, 1 hour, or 1 day.

Why This Change Was Made

The warning formatter selected a unit from the raw millisecond value and rounded only afterward. It now rounds progressively from seconds through days, matching the rollover semantics used by the shared duration formatter while preserving the warning text's spelled-out unit labels.

User Impact

Warn-only session maintenance messages now use natural duration boundaries without changing cleanup behavior or configuration.

Evidence

  • Regression cases cover 59.5 seconds, 59.5 minutes, and 23 hours 59.5 minutes.
  • Guard cases cover 30 seconds, 30 minutes, and 12 hours to ensure values are not promoted early.
  • Focused tests and the changed-file gate will be rerun against the final rebased head before merge.

@clawsweeper

clawsweeper Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Codex review: stale review; fresh review needed.

Summary
The latest durable ClawSweeper review was for head 2fe8129f3e535376f25636d9b0822f65ebad1281, but the PR head is now 7fe0680c3a3f9e755b44d70b044856251fe2e05f. Its old verdict and PR readiness labels are no longer current.

Next step
Run or wait for a fresh ClawSweeper review on the current PR head.

Review history (5 earlier review cycles)
  • reviewed 2026-07-04T21:19:45.981Z sha e730636 :: needs real behavior proof before merge. :: [P2] Preserve lower-unit ranges when promoting rounded durations
  • reviewed 2026-07-04T21:25:20.434Z sha e730636 :: needs real behavior proof before merge. :: [P2] Preserve lower-unit ranges when promoting rounded durations
  • reviewed 2026-07-04T23:17:16.118Z sha 173d9f7 :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-04T23:22:55.575Z sha 173d9f7 :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-04T23:36:44.869Z sha 4378613 :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Jul 4, 2026
@NarahariRaghava

Copy link
Copy Markdown
Contributor Author
Screenshot 2026-07-04 at 6 09 53 PM @clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Jul 4, 2026
@NarahariRaghava

Copy link
Copy Markdown
Contributor Author

Verbose test run showing all 6 formatter cases from the actual session-maintenance-warning.ts module:

Rollover: 59500ms → "1 minute", 3570000ms → "1 hour", 86370000ms → "1 day"
Guard: 30000ms → "30 seconds", 1800000ms → "30 minutes", 43200000ms → "12 hours"
All 11 tests passed against the real module. formatDuration is an internal function so it runs through deliverSessionMaintenanceWarning with NODE_ENV=development and a forced delivery failure to capture the generated warning text via enqueueSystemEvent.

Screenshot 2026-07-04 at 6 20 48 PM

@clawsweeper re-review

@NarahariRaghava

Copy link
Copy Markdown
Contributor Author
Screenshot 2026-07-04 at 6 27 28 PM @clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. 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. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. 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. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. labels Jul 4, 2026
@vincentkoc vincentkoc self-assigned this Jul 5, 2026
@vincentkoc vincentkoc changed the title fix(infra): formatDuration rolls over near-boundary values to the nex… fix(infra): roll session warning durations across unit boundaries Jul 5, 2026
…t unit

The raw float was checked against the boundary before rounding, so values
like 59.5s, 59m30s, and 23h59m30s rounded up to "60 seconds", "60 minutes",
and "24 hours" in session maintenance warning messages instead of "1 minute",
"1 hour", and "1 day". Round first, then check the unit boundary.

Closes openclaw#99978
…nance warning

Round seconds first, then promote to the next unit only when the
rounded lower unit reaches its overflow threshold (60s->min, 60m->hr,
24h->day). The previous approach compared raw milliseconds against the
unit boundary before rounding, causing half-unit values like 30s, 30m,
and 12h to promote one unit too early.

Closes openclaw#99978
@vincentkoc
vincentkoc force-pushed the fix/session-maintenance-warning-duration-rollover branch from 7fe0680 to 30667de Compare July 5, 2026 01:52
@vincentkoc

Copy link
Copy Markdown
Member

Reviewed and repaired for landing.

The formatter now promotes rounded duration boundaries without prematurely promoting ordinary values. I removed the unused test-only export, corrected the stale issue reference, and rebased the branch onto current main.

Proof on exact head 30667ded2601777c1a1825850327d907f34ae8ac:

  • Testbox tbx_01kwqzn4xhnkx2mcra99zc9dce: CI=true corepack pnpm test:serial src/infra/session-maintenance-warning.test.ts passed 11/11 tests.
  • Same Testbox: path-scoped pnpm check:changed passed for src/infra/session-maintenance-warning.ts and its test.
  • git diff --check origin/main...HEAD passed.
  • Autoreview found no accepted/actionable findings, confidence 0.96.
  • Hosted CI run 28726185982 passed on the exact head, including QA Smoke CI.

No remaining proof gaps.

@vincentkoc
vincentkoc merged commit 7d3cfa8 into openclaw:main Jul 5, 2026
96 checks passed
@vincentkoc

Copy link
Copy Markdown
Member

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 5, 2026
…enclaw#100096)

* fix(infra): formatDuration rolls over near-boundary values to the next unit

The raw float was checked against the boundary before rounding, so values
like 59.5s, 59m30s, and 23h59m30s rounded up to "60 seconds", "60 minutes",
and "24 hours" in session maintenance warning messages instead of "1 minute",
"1 hour", and "1 day". Round first, then check the unit boundary.

Closes openclaw#99978

* fix(infra): fix formatDuration progressive rollover in session maintenance warning

Round seconds first, then promote to the next unit only when the
rounded lower unit reaches its overflow threshold (60s->min, 60m->hr,
24h->day). The previous approach compared raw milliseconds against the
unit boundary before rounding, causing half-unit values like 30s, 30m,
and 12h to promote one unit too early.

Closes openclaw#99978

* test(infra): expose formatDuration via testing export for direct verification

* ci: retrigger checks

* ci: retrigger checks

* test(infra): keep duration formatter private

---------

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

Labels

P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants