Skip to content

fix(macos): align menu cost totals with local days - #140863

Merged
steipete merged 2 commits into
mainfrom
codex/qa2-23-native-cost-day-20260907
Sep 7, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/qa2-23-native-cost-day-20260907

Conversation

@steipete

@steipete steipete commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where Mac users would see another day's spending or n/a in the menu's Today cost total when the local date differed from UTC. Daily cost ranges also used 24-hour UTC days across local daylight-saving transitions.

Why This Change Was Made

Request cost buckets in the Mac's local time zone using the existing Gateway API, including its UTC-offset fallback for older Gateway timezone data. Keep the requested date formatter with the cached response so Today and chart labels use the same day boundaries. This replaces the process-global formatter without adding configuration or changing the wire schema.

User Impact

The menu's Today total and daily chart use local calendar days, including 23- and 25-hour daylight-saving days. Gateways that do not recognize a newer client timezone can still return costs through the existing fixed-offset fallback.

Evidence

  • Compiled native request-method and wire-model proof failed before the change and passes afterward. At 2026-09-07T01:00Z, the Los Angeles display and server now agree on September 6; the Tokyo midnight case also matches.
  • Eight Foundation tests covering 65 cases pass, including five local/UTC/DST cases and seven whole-, half-, and quarter-hour offsets. The new offset cases failed before the compatibility correction.
  • The actual server date resolver accepts the native serialized parameters, preserves IANA timezone precedence, and handles the synthetic unsupported-zone fallback. This is isolated boundary proof; no live pair of mismatched timezone databases was used.
  • Swift 6 cost view/model typechecking, pinned SwiftFormat and SwiftLint checks on all five changed Swift files, and P0–P2 autoreview pass. The initial native CI run caught a non-Sendable JSON dictionary captured in the new test fixture. The correction constructs the existing Sendable request record before the lock closure; an exact pinned-dependency Swift 6 reproduction now compiles and preserves the wire fields. The corrected exact-head CI run passed, including both changed suites, 2,082 default native tests, two isolation tests, and 1,674 shared-package tests.

The change affects date/data behavior without redesigning the menu's appearance. Production delta is +16 lines, with +47 test lines; the added ownership keeps cached data and its date interpretation together.

Request daily cost buckets in the Mac timezone and preserve the existing UTC-offset fallback for older Gateway timezone data. Keep the requested timezone with cached costs so Today and chart labels use the same day boundaries.
@clawsweeper

clawsweeper Bot commented Sep 7, 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.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: macos App: macos size: S maintainer Maintainer-authored PR labels Sep 7, 2026
@steipete
steipete marked this pull request as ready for review September 7, 2026 05:27
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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 7, 2026
@clawsweeper

clawsweeper Bot commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 7, 2026, 2:04 AM ET / 06:04 UTC.

ClawSweeper review

What this changes

The Mac menu requests spending totals by local calendar day and preserves the response’s timezone for Today and chart labels.

Merge readiness

✅ Ready for maintainer review

The fix remains useful: current main still requests UTC cost buckets while the menu interprets dates locally. No introduced blocking defect was found, and the maintainer-authored PR is protected from automatic closure.

Priority: P2
Reviewed head: 758b969e0203a8894bdc87d4645cb325c2297dc0

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-level repair with relevant date and wire coverage, a preserved shipped API contract, and no blocking findings.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: The supplied repository state identifies a maintainer-authored PR, so the external-contributor gate does not apply. The body reports native request/model and real server-resolver boundary verification for local dates and offset fallback; full-app and mismatched-tzdata runtime proof were not independently established here.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The supplied repository state identifies a maintainer-authored PR, so the external-contributor gate does not apply. The body reports native request/model and real server-resolver boundary verification for local dates and offset fallback; full-app and mismatched-tzdata runtime proof were not independently established here.
Evidence reviewed 7 items Current main still needs the repair: The fetched main revision sends usage.cost without date parameters; the existing server contract interprets omitted mode as UTC.
Request and presentation share date ownership: The introduced request supplies the Mac timezone and offset, then caches its date parser with the decoded response after the existing current-refresh check. Today and chart rendering consume that same parser.
Existing shipped Gateway compatibility: The v2026.9.2 resolver already accepts specific mode, prioritizes a valid IANA timezone, and falls back to a supplied valid UTC offset when the timezone is unknown. The PR consumes this contract without introducing a wire-schema or persistent-state change.
Findings None None.
Security None None.

How this fits together

The Mac menu requests session-derived spending summaries from the Gateway. The Gateway groups usage into daily buckets, which the native menu displays as Today’s total and a history chart.

flowchart LR
  A[Mac timezone] --> B[Cost summary request]
  B --> C[Gateway day boundaries]
  D[Session usage records] --> C
  C --> E[Cached totals and timezone]
  E --> F[Today total and daily chart]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Docs 0, Other +63. Total +63 across 6 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 0 0 0 0
Docs 1 1 1 0
Config 0 0 0 0
Generated 0 0 0 0
Other 5 90 27 +63
Total 6 91 28 +63

Review metrics

None.

Technical review

Best possible solution:

Keep local-day interpretation consistent from the existing Gateway request through cached totals and native presentation, retaining the established offset fallback.

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

Yes, from source: when the Mac’s date differs from UTC, the current-main request receives UTC buckets while Today selects a local date. No runtime reproduction was executed in this review.

Is this the best way to solve the issue?

Yes. Using the documented timezone parameters and retaining their interpretation with the response repairs the mismatch at its owner without duplicating server aggregation or adding configuration.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This repairs incorrect daily spending presentation in the Mac menu with a limited reporting-only blast radius.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The supplied repository state identifies a maintainer-authored PR, so the external-contributor gate does not apply. The body reports native request/model and real server-resolver boundary verification for local dates and offset fallback; full-app and mismatched-tzdata runtime proof were not independently established here.

Evidence

What I checked:

  • Current main still needs the repair: The fetched main revision sends usage.cost without date parameters; the existing server contract interprets omitted mode as UTC. (apps/macos/Sources/OpenClaw/StatusMenuSummaries.swift:418, 64887802d73b)
  • Request and presentation share date ownership: The introduced request supplies the Mac timezone and offset, then caches its date parser with the decoded response after the existing current-refresh check. Today and chart rendering consume that same parser. (apps/macos/Sources/OpenClaw/StatusMenuSummaries.swift:418, 758b969e0203)
  • Existing shipped Gateway compatibility: The v2026.9.2 resolver already accepts specific mode, prioritizes a valid IANA timezone, and falls back to a supplied valid UTC offset when the timezone is unknown. The PR consumes this contract without introducing a wire-schema or persistent-state change. (src/gateway/server-methods/usage-date-range.ts:146, 3928bad9badf)
  • Documented local-day API: Usage documentation explicitly defines UTC defaults, IANA local calendar days with daylight saving, timezone precedence, and the supported offset range. This is OpenClaw’s own usage API; no Codex dependency contract is involved. Public docs: docs/concepts/usage-tracking.md. (docs/concepts/usage-tracking.md:30, 758b969e0203)
  • Focused regression coverage: The new coverage inspects the production menu’s serialized request and independently checks five local/UTC/DST date cases plus seven offset cases. The corrected fixture constructs its Sendable request record before entering the lock closure. Tests were inspected, not executed during this read-only review. (apps/macos/Tests/OpenClawIPCTests/StatusMenuSummariesTests.swift:213, 758b969e0203)
  • Captured proof and review continuity: The supplied body snapshot, sourceRevision 71feaa255a1a5ed78d53b3b78637de845552619ed7e4de8a330669671772fcc4, reports compiled native request/model before-and-after verification and actual server-resolver acceptance, while explicitly excluding a live mismatched-tzdata setup. The previous completed review retained no findings or published rank-up moves. Direct inspection of the earlier test blob failed because its object was unavailable and the remote could not resolve; no late-finding or complete historical-comparison claim is made. (758b969e0203)

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 (1 earlier review cycle)
  • reviewed 2026-09-07T05:33:33.127Z sha 1892c5b :: needs maintainer review before merge. :: none

@steipete
steipete merged commit a2770e4 into main Sep 7, 2026
70 checks passed
@steipete
steipete deleted the codex/qa2-23-native-cost-day-20260907 branch September 7, 2026 06:33
@steipete

steipete commented Sep 7, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 8, 2026
* fix(macos): align menu cost totals with local days

Request daily cost buckets in the Mac timezone and preserve the existing UTC-offset fallback for older Gateway timezone data. Keep the requested timezone with cached costs so Today and chart labels use the same day boundaries.

* test(macos): capture sendable usage request records
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: macos App: macos docs Improvements or additions to documentation maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S 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.

1 participant