Repository navigation
fix(macos): align menu cost totals with local days - #140863
Conversation
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.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 7, 2026, 2:04 AM ET / 06:04 UTC. ClawSweeper reviewWhat this changesThe 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 Review scores
Verification
How this fits togetherThe 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]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceDocs 0, Other +63. Total +63 across 6 files. View PR surface stats
Review metricsNone. Technical reviewBest 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. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Merged via squash.
|
* 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
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
2026-09-07T01:00Z, the Los Angeles display and server now agree on September 6; the Tokyo midnight case also matches.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.