Skip to content

Sync FloatBar with menu bar metric preference - #335

Merged
Finesssee merged 1 commit into
nesszer:mainfrom
romeroej2:codex/sync-selected-usage-window
Aug 18, 2026
Merged

Finesssee merged 1 commit into
nesszer:mainfrom
romeroej2:codex/sync-selected-usage-window

Conversation

@romeroej2

Copy link
Copy Markdown

Summary

  • Make the existing per-provider menu-bar metric preference drive both the native menu bar and FloatBar.
  • Move metric selection into one canonical Rust policy and include the selected window in provider presentation payloads.
  • Use that selected window for FloatBar percentage, remaining capacity, tone, reset time, and provider sorting.
  • Rename the setting in all supported locales so its cross-surface scope is clear.

Why this is needed

ChatGPT/Codex quota lanes are not always stable. The service can temporarily omit the 5-hour window while continuing to return a valid weekly window. In that state, a surface tied to the primary lane can show an informational 0% placeholder instead of actionable quota usage.

PR #277 fixed the automatic primary-to-weekly fallback for compact surfaces, but intentionally left explicit metric preferences unchanged. The existing preference therefore controlled the menu bar while FloatBar could show a different temporal window. This is especially confusing because both are persistent, glanceable indicators: users can see two different percentages for the same provider, and FloatBar becomes ineffective when the unavailable 5-hour lane is selected implicitly.

Using one preference for both surfaces makes the user's choice authoritative and keeps the indicators consistent when a provider adds, removes, or temporarily suppresses a quota window.

Related issue

Follow-up to #275 and #277. The original issue explicitly allowed exposing a FloatBar metric setting; this change reuses the existing setting instead of adding duplicate configuration.

Affected areas

  • Tray panel
  • Settings UI
  • Config file / settings persistence
  • CLI
  • Provider-specific behavior
  • Installer / release packaging
  • Startup / background behavior
  • Documentation
  • Other: native tray icon and FloatBar presentation

Validation

Hosted PR check runs on Blacksmith Windows when CI_BUDGET_MODE is not off (see .github/workflows/pr-check.yml and CONTEXT.md). Still run the local slice and list commands/results below. If a check is not relevant, say why.

  • powershell.exe -ExecutionPolicy Bypass -NoProfile -File scripts\local-check.ps1 — shared Rust passed (1,228 tests) and Tauri Rust passed (346 tests); frontend reached 257/258 tests and stopped on the pre-existing clock-dependent paceBudget test (today expected 80, received 30). The failing files are unchanged, and the same failure is documented in fix(ui): use real window for compact usage metrics #277.
  • For full pre-release validation: not applicable; this is not a release change.
  • For installer/release changes: not applicable; no installer or release files changed.
  • Thermo-nuclear code quality review completed before submitting: the initial duplicate TypeScript policy was replaced with one canonical Rust module; the tray bridge is reduced by more than 150 lines and the final review found no structural blockers.
  • Other: focused frontend suite passed (4 files, 39 tests); canonical metric policy passed (5 tests); tray integration passed (32 tests); frontend production build and locale contract passed; Tauri clippy passed; cargo fmt and git diff checks passed.
  • Shared Rust clippy — blocked by an unrelated duplicate cfg(test) attribute in rust/src/providers/minimax/coding_plan.rs:673-674, unchanged by this PR.

UI / tray proof

For UI, tray, settings, or visual behavior changes, use CUA Driver for visual proof. If CUA Driver cannot be used, explain why and attach equivalent manual proof.

  • Not applicable
  • CUA Driver visual proof attached
  • CUA Driver could not be used; equivalent manual proof and explanation attached

CUA Driver is not available in this environment. The contributor ran the branch through the Windows Tauri development flow, selected Weekly under Settings > Providers > Codex > Menu and floating bar metric, enabled FloatBar, and confirmed that FloatBar displayed weekly usage instead of the unavailable 5-hour 0% value. The final internal refactor preserves that behavior through the canonical policy and focused integration tests listed above.

Notes for reviewers

The settings value and persistence format are unchanged. Provider cache entries remain raw; selectedMetric is derived at the presentation boundary for both cached reads and provider-updated events. Existing settings-changed handling reloads cached presentation data, so changing the metric updates FloatBar without requiring a provider refetch.

The native tray now consumes the same policy that produces selectedMetric, preventing future drift between the two surfaces. Please focus review on the presentation payload boundary and fallback parity preserved by the existing tray regression suite.

@Finesssee
Finesssee marked this pull request as ready for review August 17, 2026 04:13
@Finesssee
Finesssee merged commit 3c8873c into nesszer:main Aug 18, 2026
2 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.

2 participants