You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This ports upstream v0.70.0 work-days weekly pace. When Settings → Weekly progress work days is set to 2–6, pace on a 10080-minute weekly window counts only Monday through that weekday as elapsed time. Day boundaries are local midnight. ETAs map the remaining work time back to wall-clock time and skip the off days. When the setting is unset, 1 or 7, pace stays plain elapsed-time pace, as before.
weekly(window, now, default_window_minutes, work_days) is an exact port of upstream weekly(window:now:defaultWindowMinutes:workDays:calendar:), including workdayProgress and wallClockInterval.
Same guards as upstream: workday mode only applies when work days is 2..<7 and the window is 10080 minutes. Zero usage is "lasts until reset" only once work time has elapsed. A workday ETA with no remaining work time is nil.
Day boundaries use chrono Local, matching upstream's Calendar.current.
weekly_in(.., &tz) injects the time zone for tests. I didn't reuse session_equivalent_forecast::is_workday.
Threading of Settings::weekly_progress_work_days into every weekly pace call site:
Bridge card lanes and the provider-level pace: ProviderUsageSnapshot::from_fetch_result, WindowPaceSnapshot::for_window.
The refresh engine: refresh_provider, fetch_provider_snapshot.
Predictive pace warnings.
Tray pace colour, which reads the bridge's provider-level pace.
CLI text and JSON (codexbar usage).
The serve dashboard snapshot.
Proof harness (proof_harness.rs): seed lanes that have resetsAt but no pace now get the pace the bridge would compute at launch, using the settings' work days. Proof runs therefore exercise the live math, not a hand-written result. No existing kit seed carries resetsAt, so current suite baselines are unchanged.
Changing the setting already triggers a forced provider refresh (refreshes_provider_data, commands/settings.rs:129), so pace updates on that refresh.
Not applicable on Windows (checked):
Float bar: it shows no pace. FloatBar.tsx and src-tauri/src/floatbar/ have no pace references.
Codex historical pace: there's no evaluator. historical_pace/HistoricalPace appear nowhere in rust/ or src-tauri/. codex_historical_tracking is only a settings toggle (bridge.rs:962, OptionsSection.tsx), so upstream's "historical pace only when workDays == nil" rule has nothing to gate yet.
Card guards: the frontend visiblePace (lib/metricRowModel.ts) already matches upstream weeklyPaceDetail and displayableWeeklyPace: it hides at 100% used and needs expected >= 3% or ETA 0. No frontend change was needed.
Mac reference (v0.70.0)
Sources/CodexBarCore/UsagePace.swift:
43–125: weekly.
173: workdayProgress.
216: wallClockInterval.
246–254: nextDayBoundary, isWorkday.
Sources/CodexBar/UsageStore+HistoricalPace.swift 20–54: work days are passed everywhere, and historical pace runs only when workDays == nil.
Sources/CodexBar/MenuCardView+ModelHelpers.swift 825, 851, 1097: card call sites that pass workDaysPerWeek.
Sources/CodexBarCLI/CLIRenderer.swift 897–903: the CLI passes weeklyWorkDays.
Tests/CodexBarTests/UsagePaceTests.swift and MenuCardWorkdayPaceTests.swift are ported as Rust fixtures with literal values.
Ports of the upstream UsagePaceTests cases: Friday and midweek on-track, the exhausted quota over the weekend, ETAs that exclude or cross a weekend, flat pace on off days, and zero usage before and after the first workday.
Non-midnight reset split at local day boundaries (America/Los_Angeles).
None/7/1 fall back to linear, and non-weekly windows are ignored.
Plus workday_boundaries_follow_the_injected_time_zone (UTC+14).
bridge::pace tests:
weekly_lane_pace_follows_configured_work_days: the for_window path with a fixed instant.
fetch_result_lane_pace_follows_work_days: the real refresh path through from_fetch_result.
pnpm run tauri:build:debug (with the uncommitted dirs/reqwest proof shims)
built
The frontend is unchanged, so pnpm test, tsc and build weren't needed.
Proof (real window, proof kit: CDP + cua-driver)
Proof is saved under W:/mac-parity/report/pace/A/:
seed.json
predict.py: an independent Python model of the upstream math.
predictions-vs-observed.txt
workdays5/ and unset/, each with tray-panel.png, cached_providers.json, body_text.json, settings.json and native.json.
Setup
The exe was built from dd01d245a. Later commits only add tests.
Each run used an isolated proof home on the secondary monitor (park.py running).
Isolated settings.json: {"enabled_providers":["codex"], "weekly_progress_work_days":5} for one run, and the same without work days for the other. Without enabled_providers the cache is incomplete and a refresh replaces the seed.
Seed: a Codex weekly window (10080 min) at 55% used, with resetsAt = Wed 2026-10-14 12:00 local (UTC+7). Captured Sunday 2026-10-11 ~23:10 local.
Run
Predicted (predict.py)
Bridge pace
Card text
work days 5
expected 50.00%, delta +5 → "5% in deficit", runs out in 49.9 h
expected 50, delta +5, eta 179 700 s
5% in deficit · Runs out in 2d 1h
unset
expected 63.80%, delta −8.80 → "9% in reserve", lasts
expected 63.80, delta −8.80, lasts
9% in reserve · Lasts until reset
Workday math: 60 of the window's 120 work hours have elapsed, so expected is 50%. The weekend adds no elapsed time.
Linear math: 107.2 of 168 hours, so expected is 63.8%.
Both texts were asserted with cdp.py assert, and screenshots were taken with cua.py shot. The screenshots show seed data only, with no personal data.
fetch_result_lane_pace_follows_work_days covers the live refresh path.
Tray colour isn't in the window proof. For Codex it follows the 5 h primary, which work days never change. It's covered by threading plus unit tests.
Changing the setting live isn't shown in the window proof. In proof mode the forced refresh it triggers replaces the seed with fetch errors.
Open questions (default chosen)
speedMultiplierToReset and runOutProbability aren't ported. The Windows UsagePace has neither field, and nothing renders them. The upstream asserts on them were omitted; every other assert is ported. Default: leave them out; add them if a surface needs them.
The DST-gap day boundary is approximate. When local midnight doesn't exist, the first existing local quarter hour after it is used, which approximates Foundation startOfDay. Default: keep it; this only matters in zones with midnight DST transitions.
Applying the setting needs a refresh. Pace is baked into the cached snapshot at fetch time; the Mac computes it at render time. The settings change already forces a refresh. If that fetch fails, the previous snapshot's pace stays until the next successful refresh. Default: keep the refresh-based update; recomputing pace on cached snapshots would be a separate change.
Codex historical pace has no Windows evaluator. The workDays == nil gate is documented, not code. Default: N/A until historical pace is ported.
Summary by CodeRabbit
New Features
Weekly usage pace and estimated completion times now account for configured workdays, using local time and excluding non-workdays.
Workday-aware pacing is reflected in usage reports, dashboards, and desktop usage views.
Bug Fixes
Weekly pace calculations consistently apply the configured workday schedule across usage windows.
Linear pacing remains in effect when no workday schedule is configured or the window does not support workday-based pacing.
Reviewing files that changed from the base of the PR and between c4bc144 and 3876ef3.
📒 Files selected for processing (1)
rust/src/core/usage_pace.rs
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.
📝 Walkthrough
Walkthrough
Weekly pace calculations now support an optional work-day schedule. Desktop provider refreshes, proof snapshots, dashboard snapshots, and CLI usage rendering pass the configured setting into those calculations.
Changes
Weekly usage pace
Layer / File(s)
Summary
Workday-aware weekly pace calculation rust/src/core/usage_pace.rs, rust/src/providers/grok/tests.rs
UsagePace::weekly accepts an optional work-day count. For 10,080-minute windows and counts from two through six, pace and ETA calculations use local workdays. Other cases retain linear pacing. Tests cover workday schedules, time zones, and fallback cases.
Provider refreshes pass the configured work-day count to pace calculation and snapshot construction. Proof snapshot seeding calculates missing pace for eligible reset windows. Tests cover workday-aware pace and seeded snapshots.
Dashboard weekly pace input rust/src/cli/serve/dashboard/snapshot.rs, rust/src/cli/serve/dashboard/source.rs, rust/src/cli/serve/dashboard/*/tests.rs, rust/src/cli/serve/metrics/tests.rs, rust/src/cli/serve/tests.rs
Dashboard snapshot input carries the optional work-day setting from configuration into account pace construction. Test fixtures set the new input to None.
CLI weekly pace rendering rust/src/cli/usage.rs, rust/src/cli/usage/fetch_helpers.rs, rust/src/cli/usage/render.rs, rust/src/cli/usage_tests.rs
Usage commands load the configured work-day count and pass it through text and JSON rendering. Renderer tests check secondary-window pacing with five- and seven-day schedules.
No merge-blocking issue was established for the workday-aware weekly pace change; it is ready for normal merge checks.
Pre-merge checks | 7 | 1
❌ Failed checks (1 inconclusive)
Check name
Status
Explanation
Resolution
Ui Changes Include Windows Proof
The PR changes user-visible pace output in the desktop bridge, CLI renderers, and dashboard snapshot. The supplied context reports a real-window proof and a debug build, but it does not establish that…
Provide the complete PR description, or confirm with a description note that a fresh Windows build was used and that the changed pace display was verified. Include screenshots if no equivalent proof note exists.
✅ Passed checks (7 passed)
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title is a short imperative summary that accurately describes porting upstream work-days weekly pace support.
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Provider Data Stays Siloed
The change threads weekly_progress_work_days into pace calculations only. In bridge.rs, the new argument affects provider and lane pace values, not identity or account fields. In providers.rs, r…
Secrets Handled Safely
The pull request changes pace calculations, settings propagation, proof-seed normalization, and tests. Diff inspection found no added credential, token, cookie, API-key, OAuth, authorization-header, k…
No Unapproved Dependencies
The pull-request diff changes only Rust source and test files. It does not change any Cargo.toml or package.json, add an npm/yarn lockfile, or change a pinned pnpm packageManager version. Approval is …
Full details: Ui Changes Include Windows Proof
Explanation
The PR changes user-visible pace output in the desktop bridge, CLI renderers, and dashboard snapshot. The supplied context reports a real-window proof and a debug build, but it does not establish that the proof came from a fresh Windows build. The contributor description is explicitly truncated, so the missing section could contain the required Windows proof note or screenshots.
✨ Finishing Touches
📝 Generate docstrings
Commit to this branch
Create a new PR
🧪 Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This ports upstream v0.70.0 work-days weekly pace. When Settings → Weekly progress work days is set to 2–6, pace on a 10080-minute weekly window counts only Monday through that weekday as elapsed time. Day boundaries are local midnight. ETAs map the remaining work time back to wall-clock time and skip the off days. When the setting is unset, 1 or 7, pace stays plain elapsed-time pace, as before.
codexbar::core::UsagePace(rust/src/core/usage_pace.rs)weekly(window, now, default_window_minutes, work_days)is an exact port of upstreamweekly(window:now:defaultWindowMinutes:workDays:calendar:), includingworkdayProgressandwallClockInterval.nil.Local, matching upstream'sCalendar.current.weekly_in(.., &tz)injects the time zone for tests. I didn't reusesession_equivalent_forecast::is_workday.Settings::weekly_progress_work_daysinto every weekly pace call site:ProviderUsageSnapshot::from_fetch_result,WindowPaceSnapshot::for_window.refresh_provider,fetch_provider_snapshot.codexbar usage).servedashboard snapshot.proof_harness.rs): seed lanes that haveresetsAtbut nopacenow get the pace the bridge would compute at launch, using the settings' work days. Proof runs therefore exercise the live math, not a hand-written result. No existing kit seed carriesresetsAt, so current suite baselines are unchanged.refreshes_provider_data,commands/settings.rs:129), so pace updates on that refresh.Not applicable on Windows (checked):
FloatBar.tsxandsrc-tauri/src/floatbar/have no pace references.historical_pace/HistoricalPaceappear nowhere inrust/orsrc-tauri/.codex_historical_trackingis only a settings toggle (bridge.rs:962,OptionsSection.tsx), so upstream's "historical pace only whenworkDays == nil" rule has nothing to gate yet.visiblePace(lib/metricRowModel.ts) already matches upstreamweeklyPaceDetailanddisplayableWeeklyPace: it hides at 100% used and needs expected >= 3% or ETA 0. No frontend change was needed.Mac reference (v0.70.0)
Sources/CodexBarCore/UsagePace.swift:weekly.workdayProgress.wallClockInterval.nextDayBoundary,isWorkday.Sources/CodexBar/UsageStore+HistoricalPace.swift20–54: work days are passed everywhere, and historical pace runs only whenworkDays == nil.Sources/CodexBar/MenuCardView+ModelHelpers.swift825, 851, 1097: card call sites that passworkDaysPerWeek.Sources/CodexBarCLI/CLIRenderer.swift897–903: the CLI passesweeklyWorkDays.Tests/CodexBarTests/UsagePaceTests.swiftandMenuCardWorkdayPaceTests.swiftare ported as Rust fixtures with literal values.Tests added (26)
core::usage_pace::upstream_usage_pace_tests: 21 tests.UsagePaceTestscases: Friday and midweek on-track, the exhausted quota over the weekend, ETAs that exclude or cross a weekend, flat pace on off days, and zero usage before and after the first workday.workday_boundaries_follow_the_injected_time_zone(UTC+14).bridge::pacetests:weekly_lane_pace_follows_configured_work_days: thefor_windowpath with a fixed instant.fetch_result_lane_pace_follows_work_days: the real refresh path throughfrom_fetch_result.proof_harnesstests:seed_pace_is_computed_from_reset_time_and_work_days.seed_pace_keeps_explicit_pace.cli::usage::tests::json_pace_follows_weekly_work_days.Commands run
All run in
W:/wcb-wt/pace-workdayswithCARGO_TARGET_DIR/CARGO_BUILD_BUILD_DIR=W:\cargo-target\pace-workdays.cargo fmt --all -- --checkcargo test --manifest-path rust/Cargo.tomlcargo test --manifest-path apps/desktop-tauri/src-tauri/Cargo.tomlcargo clippy --manifest-path rust/Cargo.toml --all-targets -- -D warningscargo clippy --manifest-path apps/desktop-tauri/src-tauri/Cargo.toml --all-targets -- -D warningspnpm run tauri:build:debug(with the uncommitted dirs/reqwest proof shims)The frontend is unchanged, so pnpm test, tsc and build weren't needed.
Proof (real window, proof kit: CDP + cua-driver)
Proof is saved under
W:/mac-parity/report/pace/A/:seed.jsonpredict.py: an independent Python model of the upstream math.predictions-vs-observed.txtworkdays5/andunset/, each withtray-panel.png,cached_providers.json,body_text.json,settings.jsonandnative.json.Setup
dd01d245a. Later commits only add tests.park.pyrunning).settings.json:{"enabled_providers":["codex"], "weekly_progress_work_days":5}for one run, and the same without work days for the other. Withoutenabled_providersthe cache is incomplete and a refresh replaces the seed.resetsAt= Wed 2026-10-14 12:00 local (UTC+7). Captured Sunday 2026-10-11 ~23:10 local.cdp.py assert, and screenshots were taken withcua.py shot. The screenshots show seed data only, with no personal data.What each check covers
for_window→UsagePace→ frontend render.fetch_result_lane_pace_follows_work_dayscovers the live refresh path.Open questions (default chosen)
speedMultiplierToResetandrunOutProbabilityaren't ported. The WindowsUsagePacehas neither field, and nothing renders them. The upstream asserts on them were omitted; every other assert is ported. Default: leave them out; add them if a surface needs them.startOfDay. Default: keep it; this only matters in zones with midnight DST transitions.workDays == nilgate is documented, not code. Default: N/A until historical pace is ported.Summary by CodeRabbit