Skip to content

Port Mac window lengths and menu-bar pace lane (F1-F7) - #835

Merged
Finesssee merged 13 commits into
mainfrom
feat/pace-length-gaps
Oct 12, 2026
Merged

Finesssee merged 13 commits into
mainfrom
feat/pace-length-gaps

Conversation

@Finesssee

@Finesssee Finesssee commented Oct 12, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Mac-parity port of the seven window-length gaps (F1 to F7) from the Lane R validation. In each, Windows either dropped a usage-window length that the Mac keeps, or paced the tray on a different lane than the Mac. A window with no length gets no menu-bar pace and, for some rows, no card pace line. Mac citations are upstream v0.73.0 unless noted. Each one was rechecked against the bare upstream repo.

Gap Before (Windows) After Mac source
F1 Codebuff weekly Weekly lane had no length, so the card had no pace line Weekly lane is 10080 min; the Credits lane still has no length Sources/CodexBarCore/Providers/Codebuff/CodebuffUsageSnapshot.swift:97-106 (windowMinutes: 7 * 24 * 60)
F2 MiniMax Services (cookie coding-plan page, HTML or JSON) Services rows had no length Length comes from the row's window type (5 hours → 300, Weekly → 10080, …) MiniMaxUsageSnapshot.swift:116-119, :225-287 (windowMinutes(for:))
F3 MiniMax Remains weekly A weekly row without start and end had no length, so pace fell back to a 30-day span Weekly rows are always 10080 min MiniMaxUsageFetcher.swift:880-888 (windowTypeOverride: "Weekly") → MiniMaxUsageSnapshot.windowMinutes(for:)
F4 Synthetic regen regen_window dropped the payload minutes Minutes kept. The card hides the pace line for regenerating windows (typed resetRegenerates, no provider check), and the "Regenerates" wording from #833 is unchanged Resources/Plugins/synthetic.js:260-263; card MenuCardView+ModelHelpers.swift:179-186 (syntheticRollingRegenDetail replaces the pace), MenuCardView.swift:1407-1415
F5 Grok credits proxy Required now < end, so an ended period lost its length Only end > start and start <= now Providers/Grok/GrokCreditsProxyFetcher.swift:86-93 (v0.70.0 :98-104)
F6 Z.ai TIME_LIMIT TIME_LIMIT windows had no length (except the monthly MCP marker); the 5-hour reset plausibility check ran on every limit Every limit uses the unit multipliers {1: 1440, 3: 60, 5: 1, 6: 10080}; the monthly MCP marker (unit 5, number 1) keeps the 30-day sentinel; the 5-hour plausibility check runs on token limits only Resources/Plugins/zai.js:85-99
F7 Tray pace lane The tray tint reused the provider-level card pace (bridge.rs:438-460 at 723aa7725): the primary lane, or the secondary lane when the primary is an informational placeholder, whatever metric the icon drew. It was skipped when that lane had no length (window_has_length) The tint is scored on the menu-bar pace window: Codex → weekly lane, Abacus → primary, everything else → the window the tray icon draws for the selected metric. It uses the generic weeklyPace guards: pace allowed, quota left > 0, the window has its own length, monthly sentinel resolved, expected use ≥ 3% Sources/CodexBar/StatusItemController+Animation.swift:1207-1225 (menuBarPaceWindow, called at :914-927); StatusItemController.swift:349-360 (menuBarMetricWindow); Sources/CodexBar/UsageStore+HistoricalPace.swift:8-64, :118-124

F7 design

  • The rule is generic and lives in tray_presentation.rs. The two Mac exceptions are a typed provider hook, Provider::menu_bar_pace_lane() (default None). Only Codex (Secondary, its weekly lane after normalize_named_windows) and Abacus (Primary) override it. Shared code has no provider checks.
  • The Mac's combined Session+Weekly lane branch doesn't apply: Windows has no combined metric preference.
  • ProviderUsageSnapshot gains a tray-only pace_authoritative flag (allowsPace(dataConfidence:)). It is skip_serializing, so the frontend payload is unchanged. The old PaceSnapshot.window_has_length flag is removed.
  • The provider-level pace that the Settings detail uses is unchanged.
  • Cost: the lane lookup instantiates the selected provider once per TrayPresentationPlan::resolve, only when pace tint is on. resolve runs on provider refresh and on tray-relevant settings, locale, currency or preferences changes (tray_bridge.rs:346, :368, :411), never on a timer. The shell already instantiates providers this way for metadata.

Providers whose tray tint changes (only with "Color menu bar icon by pace" on)

  • All providers: no tint when the drawn window has no quota left, or when it expects under 3% use (Mac minimumExpectedPercent: 3). Both are new.
  • The tint now follows the drawn lane instead of the primary lane:
    • Codex always tints from its weekly lane. A Codex account with only a session lane now gets no tint; the Mac's weekly projection lane is nil there too.
    • Any provider with an explicit Weekly, Tertiary or Model metric.
    • Under Automatic (usage_metric::automatic_window), whenever the drawn window isn't the primary one:
      • generic providers draw their fullest window, so a fuller weekly or model lane now drives the tint;
      • Claude also draws its weekly lane when the model lane is exhausted;
      • Antigravity draws its fullest window that still has quota;
      • Cursor draws its monthly Auto allowance (secondary);
      • LiteLLM prefers its secondary (team budget) window (automatic_metric_prefers_secondary_window).
    • Doubao: its Agent Plan windows are icon fallbacks (doubao/mod.rs:467-510), so they drive the tint.
  • Gain a tint because F1-F6 give their windows a length: Codebuff (weekly), MiniMax (Services and Remains weekly), Z.ai (TIME_LIMIT), Synthetic (regen windows; the Mac menu bar has no regen exclusion).
  • No change: Abacus already paced its primary lane. Grok's credits proxy (F5) keeps its length after the period ends, but an ended period has no pace (UsagePace::weekly needs a future reset), so its tint doesn't change.
  • Copilot's length-less windows still get no tint.

Tests added

  • F1 codebuff::tests::weekly_lane_is_seven_days_and_credits_lane_has_no_length
  • F2 minimax::coding_plan_html::tests::services_rows_take_their_length_from_the_window_type, minimax::coding_plan::tests::window_type_minutes_follow_the_mac_units
  • F3 minimax::coding_plan::tests::weekly_row_without_start_and_end_is_seven_days
  • F4 synthetic Rust tests now assert Some(300) / Some(10_080) on regen windows; vitest metricRowModel "hides pace on a regenerating window that keeps its length" (pace text and marker null, workday ticks kept)
  • F5 grok::credits_proxy_tests::ended_period_keeps_its_length
  • F6 zai::tests::time_limit_primary_takes_its_unit_length, weekly_time_limit_primary_is_seven_days
  • F7 tray_presentation::tests:
    • tray_pace_tint_is_opt_in_and_follows_the_drawn_window_stage (stage plus rendered RGBA for Bars and Percent)
    • tray_pace_tint_follows_the_selected_metric_lane
    • codex_tray_pace_tint_uses_its_weekly_lane
    • tray_pace_tint_follows_the_mac_weekly_pace_guards (no length, not authoritative, exhausted, 1.7% vs 3.3% expected)
    • tray_pace_tint_uses_the_icon_fallback_window
    • tray_pace_tint_scores_a_regenerating_window_with_a_length
    • stacked_tray_icon_keeps_usage_colours_when_pace_tint_is_enabled
    • Also bridge::pace::tests::copilot_lengthless_window_keeps_provider_and_lane_pace.

Commands (PR head 70e311cce)

All on a local Windows workstation; logs in W:/mac-parity/report/lane-f/checks/.

Command Result
cargo fmt --all -- --check pass
cargo test --manifest-path rust/Cargo.toml 4109 passed, 0 failed, 1 ignored
cargo clippy --manifest-path rust/Cargo.toml --all-targets -- -D warnings pass, 0 lint warnings
cargo test --manifest-path apps/desktop-tauri/src-tauri/Cargo.toml 683 passed, 0 failed
cargo clippy --manifest-path apps/desktop-tauri/src-tauri/Cargo.toml --all-targets -- -D warnings pass, 0 lint warnings
pnpm --config.verify-deps-before-run=false test 118 files, 1064 tests passed
pnpm exec tsc --noEmit pass
pnpm run build pass

Proof

  • Tray tint: proven by the tray_presentation unit tests above (stage and rendered RGBA). It isn't captured live, because the provider icons sit in the hidden-icons area.
  • Cards:
    • Method: build-proof.sh debug build of the head (proof shims not committed), compared with the same build of 723aa7725.
    • Each capture used win_run.py with the localhost mock server, an isolated home and park.py on the secondary monitor.
    • Paths are on the workstation, under W:/mac-parity/report/lane-f/:
      • runs/<Pack>@before|@after/panel.png;
      • side-by-side sheets (before, after, Mac v0.70.0): Codebuff-before-after-mac.png, MiniMax-before-after-mac.png, Synthetic-before-after-mac.png, Zai-before-after-mac.png.
    • Visible changes, from the captured DOM text:
      • Codebuff Weekly gains "26% in reserve · Lasts until reset", the same as the Mac.
      • MiniMax: the weekly lane changes from "5% in deficit · Runs out in 3d 6h" to "5% in reserve · Lasts until reset", the same as the Mac "Window" row. "Text Generation · Weekly" gains "5% in reserve · Lasts until reset".
      • Synthetic: no change. The Five-hour regen row keeps "76% after next regen · Full in ~3 regens" with no pace, as on the Mac.
      • MiniMax Services (F2, cookie coding-plan path, pack packs/MiniMaxServices, runs runs/MiniMaxServices@before|@after):
        • the 5-hour row gains "25% in reserve · Lasts until reset";
        • the Today row gains "21% in reserve · Lasts until reset";
        • the Weekly service row has no reset time in the payload, so it has no pace either way.
      • Z.ai and Grok: no change with these packs. The Z.ai MCP row is the monthly marker, and Grok uses the CLI billing path.
  • Not covered:
    • tray icon pixels live;
    • the Grok credits-proxy path (F5). It has no visible change: an ended period has no pace line on the card or in the tray. It is covered by ended_period_keeps_its_length.

Known differences, not changed (reverse direction: Windows has a length the Mac lacks)

  • Grok protobuf billing window.
  • ZoomMate.
  • The Kimi fallback window.
  • MiniMax Remains bucketing: Windows draws Remains rows as bars, while the Mac lists them under "Quota services".
  • Seen in the captures, outside this PR: the MiniMax weekly lane (and the Services "Today" row) is titled "30-Day" (Mac: "Window"), and the Z.ai weekly token row is titled "MCP". Both are label wording only.

Open questions (default chosen)

  1. F3: MiniMax weekly rows are always 10080, even when the payload has a weekly start and end with a different span. Default: the Mac's windowMinutes(for: "Weekly").
  2. F7: the Mac paces Codex with its historical curve (CodexHistoricalPaceEvaluator) when historical tracking is on and work days are off. Windows keeps linear UsagePace for the tray. Default: not ported (smallest change).
  3. F7: the 3% expected-use floor and the remaining > 0 guard are new on Windows. Default: the Mac's.
  4. F4: now that the Synthetic primary has a length, the Settings "Usage details" showed an on-pace budget and a projection chart for the regenerating weekly window. Fixed in 5b799e69c (see below). The expected/actual pace bars in that section were already there before this PR and still show for the regenerating five-hour window. That is left for a Settings follow-up.
  5. F7: the Mac colours the pace text in the menu bar (MenuBarLayoutRenderer.swift:664, :1017); Windows tints the tray icon. Default: keep the icon tint as the Windows version.
  6. F7: a Codex account with a session and a monthly lane can tint from the monthly lane. Default: unchanged.

Adversarial validation (Opus, W:/mac-parity/report/lane-f/VALIDATE.md)

Verdict: MERGE-READY. Commits added after the builder's head 70e311cce:

Checks on dcb95da94: cargo fmt --check pass; rust cargo test 4119 passed, 0 failed, 1 ignored; tauri cargo test 687 passed, 0 failed; clippy -D warnings pass on both manifests; vitest 119 files, 1078 tests passed; tsc --noEmit pass; pnpm run build pass.

Proof: Settings › Providers › Synthetic before (70e311cce) shows "Weekly tokens · On-pace budget" plus the chart; after (dcb95da94) shows neither, with card rows unchanged. Saved locally in W:/mac-parity/report/lane-f/validate/runs/SyntheticWeeklyRegen@{before,after}/; not committed.

@coderabbitai

coderabbitai Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

⚙️ Run configuration
  • Configuration used: Repository: nesszer/Win-CodexBar/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 2c4e3255-d48b-4263-932d-7285e741c5ce

📥 Commits

Reviewing files that changed from the base of the PR and between dcb95da and 3a04482.


You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: nesszer/Win-CodexBar/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: fbde71cb-7922-4d73-b236-24b15790e942



📥 Commits

Reviewing files that changed from the base of the PR and between 70e311c and dcb95da.




📒 Files selected for processing (8)
  • apps/desktop-tauri/src-tauri/src/tray_bridge.rs
  • apps/desktop-tauri/src-tauri/src/tray_presentation_tests.rs
  • apps/desktop-tauri/src/lib/paceBudget.test.ts
  • apps/desktop-tauri/src/lib/paceBudget.ts
  • rust/src/providers/minimax/coding_plan.rs
  • rust/src/providers/minimax/coding_plan_tests.rs
  • rust/src/providers/zai/mod.rs
  • rust/src/providers/zai/tests.rs



Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 1 remain after this review.





📝 Walkthrough
📝 Walkthrough
📝 Walkthrough

Walkthrough

Provider mappings now retain or derive rate-window durations. Desktop snapshots carry pace-authority state, and tray presentation scores eligible windows to select pace tint. Metric rows and pace-budget calculations exclude regenerating windows from pace display and calculations.

Changes

Pace scoring and rate-window metadata

Layer / File(s) Summary
Provider pace-lane selection
rust/src/core/provider.rs, rust/src/providers/abacus/mod.rs, rust/src/providers/codex/mod.rs
The Provider trait adds an optional menu-bar pace lane. Abacus selects its primary lane, and Codex selects its secondary lane.
Provider rate-window durations
rust/src/providers/codebuff/mod.rs, rust/src/providers/grok/credits_proxy.rs, rust/src/providers/grok/credits_proxy_tests.rs, rust/src/providers/minimax/coding_plan*, rust/src/providers/minimax/coding_plan_html.rs, rust/src/providers/synthetic/*, rust/src/providers/zai/*
Provider mappings retain or derive durations for weekly, timed, ended, regenerating, and MCP windows. Tests cover mapped durations, reset data, MiniMax parsing, and error classification.
Snapshot authority and rate-window conversion
apps/desktop-tauri/src-tauri/src/commands/bridge.rs, apps/desktop-tauri/src-tauri/src/commands/bridge/pace.rs, apps/desktop-tauri/src-tauri/src/commands/chart.rs, apps/desktop-tauri/src-tauri/src/commands/providers.rs, apps/desktop-tauri/src-tauri/src/commands/providers/reset_backfill.rs, apps/desktop-tauri/src-tauri/src/powertoys.rs, apps/desktop-tauri/src-tauri/src/tray_bridge.rs, apps/desktop-tauri/src-tauri/src/usage_metric.rs
Provider snapshots add a non-serialized pace_authoritative field. RateWindowSnapshot adds shared conversion to core RateWindow values, which chart code now uses. Related snapshot tests and fixtures are updated.
Tray pace scoring and tint
apps/desktop-tauri/src-tauri/src/tray_presentation.rs, apps/desktop-tauri/src-tauri/src/tray_presentation_tests.rs
Tray resolution scores eligible rate windows using provider lane selection or the selected metric. Tests cover timestamped scoring, tint rendering, guard conditions, fallback windows, and stacked icons.
Regenerating-window pace display
apps/desktop-tauri/src/lib/metricRowModel.ts, apps/desktop-tauri/src/lib/metricRowModel.test.ts, apps/desktop-tauri/src/lib/paceBudget.ts, apps/desktop-tauri/src/lib/paceBudget.test.ts
Metric rows omit pace text and pace bars for regenerating windows. Pace-budget and chart-snapshot calculations also return no pace result for those windows. Tests check that window length and weekly workday markers remain available.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix





Merge Risk: ⚪ Minimal · up to dcb95

This change brings window-length and tray pace-tint behavior to Windows. No actionable merge-blocking risk was identified in the supplied review material.

Pre-merge checks | Passed 7 | Inconclusive 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Ui Changes Include Windows Proof Inconclusive The diff changes user-visible behavior in apps/desktop-tauri/src/lib/metricRowModel.ts and paceBudget.ts: regenerating windows no longer show card pace or pace budgets. The check therefore require… Provide the complete PR description for review, or add screenshots or an explicit proof note from a fresh Windows build that verifies the changed UI.
✅ Passed checks (7 passed)
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Provider Data Stays Siloed Passed The change does not add identity, plan, account, or email transfer between providers or accounts. The new pace_authoritative field is tray-only and uses skip_serializing. `RateWindowSnapshot::to_r…
Secrets Handled Safely Passed The pull request changes quota-window parsing, pace metadata, tray presentation, and tests. The added pace_authoritative field is a boolean with skip_serializing, and the new snapshot conversion c…
No Unapproved Dependencies Passed The pull-request diff changes source and test files only. It does not add or modify any Cargo.toml or package.json, add an npm or yarn lockfile, or change the pinned pnpm packageManager version. The a…
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title uses a short imperative summary and accurately identifies the main changes: porting window lengths and menu-bar pace-lane behavior for F1–F7.


Full details: Ui Changes Include Windows Proof

Explanation

The diff changes user-visible behavior in apps/desktop-tauri/src/lib/metricRowModel.ts and paceBudget.ts: regenerating windows no longer show card pace or pace budgets. The check therefore requires screenshots or a proof note from a fresh Windows build. The supplied PR description is explicitly truncated. The visible text mentions card-capture comparisons and automated tests, but it does not establish whether the omitted text contains the required fresh-Windows proof. No complete description or proof note is present in the checkout.




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

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Finesssee
Finesssee merged commit 27434ca into main Oct 12, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant