Skip to content

fix(ui): use the selected timezone for Usage date shortcuts - #148277

Merged
roboclaw-bot merged 6 commits into
openclaw:mainfrom
quziang:fix/usage-utc-presets
Sep 15, 2026
Merged

roboclaw-bot merged 6 commits into
openclaw:mainfrom
quziang:fix/usage-utc-presets

Conversation

@quziang

@quziang quziang commented Sep 14, 2026 •

Copy link
Copy Markdown

What Problem This Solves

Fixes Usage date shortcuts selecting the wrong day when UTC is selected and the browser's local date differs from the UTC date.

User Impact

Today, 7d, 30d, 90d, 1y, and All use the selected calendar, so UTC usage is not omitted or assigned to tomorrow near local midnight. The cost comparison's Today label follows the same timezone.

Why This Change Was Made

Preset arithmetic and formatting used local dates even when requests were sent in UTC mode. They now use the selected timezone through the existing shared date formatter; local calendar and daylight-saving behavior remain intact.

Evidence

  • Real Chrome E2E tests against the production UI build failed in both UTC+8 and UTC−7 cross-day scenarios before the fix; the same-day control passed.
  • After the fix, all 5 calendar-boundary E2E tests pass, including existing DST cases. The new cases exercise all six presets in both UTC and Local modes, date inputs, sessions.usage and usage.cost requests, displayed usage, and the Today label.
  • All 98 related Usage unit tests pass.
  • UI TypeScript checking (pnpm tsgo:ui), formatting, i18n verification, and scoped stylelint pass. Independent review and the required autoreview (P0–P2) found no actionable issues.
  • Exact-head CI run 34883371099, attempt 2 passed on 2330df403ea700bb7986cf65b3e4467e48636185; reverified September 15. The full matrix was not run locally.
  • Maintainer validation records integration repairs, focused passing checks, independent review, and proof limits.
  • Screenshots use synthetic data at 2026-09-13T16:30:00Z in an Asia/Shanghai browser. Clicking UTC Today incorrectly selected September 14 before the fix; afterward it selects September 13 and displays 1.2K tokens / $0.12.

Before:

UTC Today before the fix

After:

UTC Today after the fix

@clawsweeper

clawsweeper Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@quziang
quziang marked this pull request as ready for review September 14, 2026 13:49
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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. labels Sep 14, 2026
@clawsweeper

clawsweeper Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 15, 2026, 2:33 AM ET / 06:33 UTC (Revision 5).

ClawSweeper review

What this changes

Makes Usage date shortcuts and Today labels follow the selected timezone, consolidates date formatting, and adds browser coverage plus small test-fixture and routing repairs.

Merge readiness

✅ Ready for maintainer review

The fix remains necessary on current main and v2026.9.4. The patch and inspected browser proof support the intended correction, with no actionable correctness or security findings.

Priority: P2
Reviewed head: 2330df403ea700bb7986cf65b3e4467e48636185

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, maintainable correction with convincing visible browser proof, useful regression coverage, and successful exact-head CI.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (screenshot): Inspected before/after screenshots show the production Usage UI selecting the corrected UTC date and displaying usage in Chrome with synthetic Gateway responses; the documented browser run covers both cross-day directions and retained local/DST behavior.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (screenshot): Inspected before/after screenshots show the production Usage UI selecting the corrected UTC date and displaying usage in Chrome with synthetic Gateway responses; the documented browser run covers both cross-day directions and retained local/DST behavior.
Evidence reviewed 9 items Current main still needs the fix: Current main calculates preset dates with local setters and calls the formatter without the selected timezone. Comparing the four changed production modules against the pinned base produced no differences.
Latest release retains the defect: The supplied latest release, v2026.9.4, also uses local date arithmetic and timezone-unaware formatting for the shortcuts.
Existing calendar contract and narrow repair: The existing request adapter sends UTC mode or the browser's IANA timezone. The patch makes preset arithmetic and formatting agree with that contract, retains local behavior, and replaces both callers of the removed duplicate formatter.
Findings None None.
Security None None.

How this fits together

The Control UI Usage page turns calendar selections into Gateway requests for session usage and costs. Its date shortcuts determine which days appear in the totals, charts, and session details.

flowchart TD
  A[Current time] --> C[Usage date shortcuts]
  B[Selected UTC or local timezone] --> C
  C --> D[Start and end dates]
  D --> E[Gateway usage requests]
  E --> F[Usage totals and charts]
  B --> G[Today label and day filters]
  G --> F
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +6, Tests +218. Total +224 across 9 files.

View PR surface stats
Area Files Added Removed Net
Source 4 27 21 +6
Tests 5 219 1 +218
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 9 246 22 +224

Review metrics

Metric Value Why it matters
Production versus test growth Production net +6 lines; tests/support net +218 lines The small production increase expresses timezone selection while removing duplicate formatting; most growth supplies browser regression coverage.

Technical review

Best possible solution:

Keep calendar selection consistent across shortcut arithmetic, request dates, day filters, and labels through the existing shared formatter.

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

Yes: selecting UTC Today when the browser's local date differs from UTC reaches the source-proven mismatch still present on main. Supplied before/after browser evidence demonstrates the scenario; this review did not rerun it.

Is this the best way to solve the issue?

Yes: the patch repairs the existing date-selection owner, reuses one formatter, and preserves local-calendar behavior without adding settings or changing stored data.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against e9ca5bc044a8.

Labels

Label justifications:

  • P2: This repairs misleading Usage date ranges near UTC/local day boundaries with limited dashboard impact.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (screenshot): Inspected before/after screenshots show the production Usage UI selecting the corrected UTC date and displaying usage in Chrome with synthetic Gateway responses; the documented browser run covers both cross-day directions and retained local/DST behavior.
  • proof: sufficient: Contributor real behavior proof is sufficient. Inspected before/after screenshots show the production Usage UI selecting the corrected UTC date and displaying usage in Chrome with synthetic Gateway responses; the documented browser run covers both cross-day directions and retained local/DST behavior.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. Inspected before/after screenshots show the production Usage UI selecting the corrected UTC date and displaying usage in Chrome with synthetic Gateway responses; the documented browser run covers both cross-day directions and retained local/DST behavior.

Evidence

What I checked:

  • Current main still needs the fix: Current main calculates preset dates with local setters and calls the formatter without the selected timezone. Comparing the four changed production modules against the pinned base produced no differences. (ui/src/pages/usage/view.ts:311, e9ca5bc044a8)
  • Latest release retains the defect: The supplied latest release, v2026.9.4, also uses local date arithmetic and timezone-unaware formatting for the shortcuts. (ui/src/pages/usage/view.ts, 3a9d69db306c)
  • Existing calendar contract and narrow repair: The existing request adapter sends UTC mode or the browser's IANA timezone. The patch makes preset arithmetic and formatting agree with that contract, retains local behavior, and replaces both callers of the removed duplicate formatter. (ui/src/lib/sessions/usage.ts:28, 2330df403ea7)
  • Calendar behavior documentation: The documented usage API contract defines UTC calendar dates and IANA-zone calendar days with daylight-saving handling. Public docs: docs/concepts/usage-tracking.md. (docs/concepts/usage-tracking.md:34, 2330df403ea7)
  • Inspected before and after browser proof: Both downloaded PR-body screenshots were inspected. At the stated Asia/Shanghai boundary instant, UTC Today changes from September 14 with zero usage to September 13 with 1.2K tokens and $0.12. The captured body and fix(ui): use the selected timezone for Usage date shortcuts #148277 (comment) explicitly identify a production UI build with a mocked Gateway, record cross-day failures before repair and five passing browser cases afterward, and confirm screenshot delivery in the originating chat and GitHub. (2330df403ea7)
  • Meaningful browser regression coverage: The added cases exercise six shortcuts in UTC and local modes across two opposite cross-day boundaries and a same-day control, asserting date inputs, both usage requests, displayed tokens, and the Today label. Existing DST cases remain intact. (ui/src/e2e/usage-calendar-boundaries.e2e.test.ts:10, 2330df403ea7)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • 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.

History

Review history (4 earlier review cycles)
  • reviewed 2026-09-14T14:07:27.170Z sha 7586424 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-14T16:19:46.545Z sha a934a18 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-14T18:36:01.651Z sha dee7bb3 :: blocked before merge. :: none
  • reviewed 2026-09-14T18:57:56.218Z sha 2330df4 :: needs maintainer review before merge. :: none

@roboclaw-bot roboclaw-bot self-assigned this Sep 14, 2026
Use the canonical Date clone and avoid a shadowed test label. Route the existing wizard recovery integration test through the host-capable infra owner so pending plugin-install recovery exercises the real shared-state broker.

Co-authored-by: Qu Ziang <[email protected]>
Co-authored-by: Tak Hoffman <[email protected]>
Co-authored-by: Takhoffman <[email protected]>
@roboclaw-bot

roboclaw-bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Collaborator

Maintainer validation

Reviewed head: 2330df403ea700bb7986cf65b3e4467e48636185. Original contributor ancestry is preserved.

  • Exact-head CI run 34883371099, attempt 2 completed successfully; reverified on September 15. Native exact-head review artifacts validate with no outstanding findings.
  • The original browser calendar proof remains applicable: both cross-day UTC defects failed before repair; all five browser cases and 98 related Usage unit tests passed afterward. Local/DST behavior is retained. The four changed production modules on current main remain identical to the inspected baseline and still need this fix.
  • Corrected the Date-clone and shadowed-label lint failures. Preserved canonical scoped lint and formatting checks pass.
  • Wizard recovery was reproduced in original order (1 failed / 7 passed), then passed 8/8 with its existing host-capable test owner; no broker guard or assertion changed.
  • node scripts/run-vitest.mjs src/agents/worktrees/service.provisioned.test.ts passed 18/18 after automatic Git maintenance was disabled at fixture initialization.
  • node scripts/run-vitest.mjs test/scripts/ci-node-test-plan.test.ts test/scripts/test-projects.test.ts -t 'covers every infra test exactly once|keeps host-owned database consumers|retains database worker ownership' passed seven focused checks. All 72 host-capable test routes are unique.
  • Independent original and fixture reviews found no actionable P0–P2 defects. Production delta is +27/-21 (net +6); tests/support +219/-1. The small production growth expresses UTC/local selection while removing duplicate formatting.

Proof limits: no full local matrix is claimed. An earlier full routing-file run was terminated; selected assertions and hosted CI supply the relevant proof. Inspected original screenshots were delivered in chat and their GitHub embeds verified; a new full-browser pixel recheck was unavailable. The browser uses a mocked Gateway, not a live provider.

Named follow-up: watch load sensitivity of the unrelated Claw package process-exit probe if it recurs. Its first CI attempt timed out; the unchanged full file passed 8/8 locally and the single diagnostic failed-job rerun passed. No timeouts or assertions were relaxed.

Credit is preserved for Qu Ziang and Tak Hoffman. Native preparation has passed on this exact head. Companion #148883 repairs the canonical squash helper so it does not reintroduce automation credit; the Usage source and its green CI remain unchanged.

roboclaw-bot and others added 2 commits September 14, 2026 11:25
Preserve the upstream wizard routing and persisted cloud follow-up repair before refreshing the PR base.

Co-authored-by: Qu Ziang <[email protected]>
Co-authored-by: Tak Hoffman <[email protected]>
Co-authored-by: Takhoffman <[email protected]>
@openclaw-barnacle openclaw-barnacle Bot added the agents Agent runtime and tooling label Sep 14, 2026
Remove the duplicate wizard recovery entry introduced by parallel main-branch fixes; retain the canonical host-capable test owner.

Co-authored-by: Qu Ziang <[email protected]>
Co-authored-by: Tak Hoffman <[email protected]>
Co-authored-by: Takhoffman <[email protected]>
roboclaw-bot added a commit that referenced this pull request Sep 15, 2026
Exclude the verified automation service-email alias from native squash coauthor credit. Reuse the exact identity filter and preserve requested human credit without broad name or domain matching.

Related: #148277

Real captured-input composition and the 390 native merge/outcome tests pass. Independent P0-P2 review found no actionable issues.

Co-authored-by: Tak Hoffman <[email protected]>
Co-authored-by: Takhoffman <[email protected]>
@roboclaw-bot
roboclaw-bot merged commit a4b601e into openclaw:main Sep 15, 2026
330 of 333 checks passed
@roboclaw-bot

Copy link
Copy Markdown
Collaborator

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 15, 2026
* commit '0cd944c01416c4f9c1f6dc9d1dea9670c5b99cab':
  improve: speed up session search for restricted operators (#148826)
  fix(update): avoid retry guidance for historical abandoned runs (#146982)
  fix(android): reduce queued-message send overhead (#148899)
  refactor(slack): count table cells only for native output (#148872)
  fix: correct update status and apply saved model keys (#148830)
  refactor(nostr): share doctor state migration flow (#148647)
  refactor(gateway): centralize device token denial responses (#148644)
  test: make kitchen sink assertions runtime portable (#148891)
  refactor(agents): share preferred block chunk boundaries (#148391)
  fix(ui): use the selected timezone for Usage date shortcuts (#148277)
  test: probe active Node in release preflight (#148892)
  fix(test): restore services typecheck shard headroom (#148889)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 16, 2026
…148883)

Exclude the verified automation service-email alias from native squash coauthor credit. Reuse the exact identity filter and preserve requested human credit without broad name or domain matching.

Related: openclaw#148277

Real captured-input composition and the 390 native merge/outcome tests pass. Independent P0-P2 review found no actionable issues.

Co-authored-by: Tak Hoffman <[email protected]>
Co-authored-by: Takhoffman <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 16, 2026
…#148277)

Fix Usage date shortcuts and Today comparison labels selecting the wrong calendar day when UTC is selected near local midnight. Use the selected UTC or Local calendar through the shared formatter while preserving Local daylight-saving behavior.

Keep browser regression coverage for all six shortcuts across calendar boundaries. Stabilize the temporary Git fixture and remove duplicate host-test routing uncovered during integration. Exact-head CI passed in run34883371099, attempt2.

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

Labels

agents Agent runtime and tooling app: web-ui App: web-ui P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants