Conversation
The Monthly Plan menu bar metric now selects the provider's plan allowance window (Mistral's Vibe plan, mistral-monthly-plan) instead of a spend window. A missing or unknown plan falls back to the Included API allowance. Providers declare the window through a Provider hook, so the shell has no Mistral branch. The picker offers Automatic, Included API and Monthly Plan for Mistral, and the tray label shows the plan percent when it resolves, otherwise the current-month spend. provider_status_label now takes the caller's settings instead of loading the real settings file, which keeps its tests hermetic.
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
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. Comment |
UI proof (browser-use)Result: PASS on build At the maintainer's direction, this proof drove the app's WebView2 over CDP with the browser-use CLI instead of CUA. It used no keyboard, mouse or focus. The proof windows stayed on the second display, and the kit settings turned the global shortcut off. Setup
Results
Validation at
|
| Command | Result |
|---|---|
cargo +1.98.0 fmt --all --check |
pass |
cargo +1.98.0 clippy --workspace --all-targets -- -D warnings |
pass |
cargo +1.98.0 test -p codexbar |
2171 passed, 0 failed, 1 ignored |
cargo +1.98.0 test -p codexbar-desktop-tauri -- --skip bootstrap_payload_exposes_every_provider_variant |
468 passed, 0 failed. The skipped test is the non-hermetic #684 test, which #711 fixes. |
pnpm install --frozen-lockfile |
pass |
pnpm run check-locale |
880 keys match between Rust and TS |
pnpm test |
67 files, 413 tests passed |
pnpm run lint |
0 errors (unused-import warnings in files this PR does not touch) |
pnpm run build |
pass |
Screenshots
All paths are under C:\Users\FSOS\AppData\Local\Win-CodexBar\port-audit\proof\717\shots\. The float bar window is transparent, so its captures are RGBA. Each -on-dark.png copy composites the capture onto #1c1c1e at 4x so the white pill text is readable.
bu-01-settings-mistral-picker-automatic.png: the Tray Display picker on Automatic.bu-02-floatbar-automatic-on-dark.png: the float bar at 80% under Automatic.bu-03-floatbar-monthly-plan-on-dark.png: the float bar at 42% after selecting Monthly Plan.bu-04-settings-mistral-picker-monthly-plan.png: the picker on Monthly Plan.bu-05-floatbar-included-api-on-dark.png,bu-06-floatbar-automatic-again-on-dark.png,bu-07-floatbar-monthly-plan-final-on-dark.png: the 80%, 80% and 42% cycle.bu-08-settings-mistral-detail-usage.png: the detail pane with the Included API (80%) and Monthly Plan (42%) rows.bu-09-floatbar-after-relaunch-on-dark.png,bu-10-settings-picker-after-relaunch.png: Monthly Plan after a restart.bu-11-noplan-settings-detail.png,bu-12-noplan-settings-picker.png,bu-13-noplan-floatbar-fallback-on-dark.png: thenoplanfallback to 80%.
Not blocking (found on main, not caused by this PR)
- The Settings usage bar for the primary window is labelled "Session", not "Included API". The settings
UsageSectionalways usesProviderSessionLabelfor the primary window and ignoresprimaryLabel. This is generic behavior onmainfor every provider, as in the Port upstream 0.67.0: Raycast provider #668 proof.
This PR stays a draft because it is stacked on #657.
Summary
Ports upstream v0.70.0 steipete#4072: Mistral's Menu bar metric picker offers Monthly Plan, so the tray icon, tray labels, the float bar and the selected metric can show the Vibe plan allowance.
mistral-monthly-planextra window, the Vibe allowance percentage that the provider already publishes. If the plan window is missing or its value is unknown, the choice falls back to the Included API allowance. It never selects a spend window.Providerhooks withNonedefaults,monthly_plan_window_id()andmenu_bar_primary_label(), declare the window and the label. Mistral overrides both.ProviderDetailpasses them to the picker asmonthlyPlanWindowIdandprimaryMetricLabel.Behavior change for saved settings. Since
8db65416(the 0.50.1 port), Windows usedmonthlyPlanto mean "Monthly API spend". That choice never showed a percentage, because the Mistral cost snapshot has no limit, so it fell through to Automatic. The tray label showed the spend amount. A user who savedmonthlyPlannow gets the upstream meaning: the Vibe plan percentage, or the spend text when the plan is unknown. The Mistral card's spend row keeps "Monthly API spend".provider_status_labelnow takes the caller's settings instead of callingSettings::load(). Its tests, including the existingtray_labels_relocalize_on_language_change_without_refetch, no longer read the real%APPDATA%\CodexBar\settings.json. Both production callers already held freshly loaded settings.Stacked on #657 (
port/micro-0.68.0-mistral-plan-detail), which publishes the Included API and Monthly Plan windows.Upstream reference
bc36a04868(v0.70.0 release notes: "Mistral: offer Monthly Plan in the provider's Menu bar metric picker so the menu bar and widgets can show the Vibe allowance").v0.70.0sources:MistralProviderDescriptor.swift(menuBarWindowResolver,menuBarLayoutPrimaryLabel: "Included API"),MenuBarMetricWindowResolver.swift,Tests/CodexBarTests/MistralMenuBarMetricTests.swift(automatic, primary and monthlyPlan stay distinct choices) andMistralMonthlyPlanPickerTests.swift.metric_mistral_monthly_planis "Monthly Plan" (en), "Ежемесячный план" (ru), "Aylık plan" (tr) and "月租方案" (zh-Hant). Upstream leaves es, ja, ko and zh-Hans untranslated, so those fall back to English here too.Ported / Deferred
MetricMonthlyPlanlocale key (en, ru, tr, zh-TW; others fall back to en-US)Validation
Run in the worker worktree on Rust 1.98.0 and Node 24 at
194d76b8:cargo +1.98.0 fmt --all --checkcargo +1.98.0 clippy --workspace --all-targets -- -D warningscargo +1.98.0 test -p codexbarcargo +1.98.0 test -p codexbar-desktop-tauri -- --skip bootstrap_payload_exposes_every_provider_variantpnpm install --frozen-lockfilepnpm run check-localepnpm testpnpm run lintpnpm run buildThe skipped desktop test is the non-hermetic #684 test, which is not on this stacked base. #711 fixes it.
New tests:
usage_metric.rs:mistral_monthly_plan_selects_the_vibe_plan_window(plan 42%, Included API 80%, Automatic 80%, presentationselectedMetric42%)mistral_monthly_plan_falls_back_to_included_api_without_a_known_plan(missing plan and informational plan)mistral_monthly_plan_never_selects_a_spend_window(a €45 / €50 cost still resolves to Included API)monthly_plan_without_a_provider_plan_window_falls_through_to_automatictray_bridge.rs:mistral_monthly_plan_tray_label_shows_the_plan_then_the_spend.providers/mistral:monthly_plan_metric_targets_the_published_vibe_window.MenuBarMetricSection.test.tsx: three cases.monthlyPlan.extraUsagestays selected and labelled.Affected areas
rust/src/core/provider.rs: newProviderhooks.rust/src/providers/mistral/mod.rs: window id and label constants, hook overrides.rust/src/settings/types.rs:MonthlyPlandoc comment and labels.apps/desktop-tauri/src-tauri/src/usage_metric.rs,tray_bridge.rs,commands/provider_detail.rs.apps/desktop-tauri/src/surfaces/settings/providers/sections/MenuBarMetricSection.tsxand its test,types/bridge.ts.rust/src/locale.rs,apps/desktop-tauri/src/i18n/keys.ts,rust/src/locale/{en-US,ru-RU,tr-TR,zh-TW}.ftl.UI proof
Done: PASS at
194d76b8. See the "UI proof (browser-use)" comment: #717 (comment)The proof drove Settings > Providers > Mistral > Tray Display and the float bar over WebView2 CDP with browser-use, on an isolated build of this head. A proof-only hook, never committed, passed billing and flight-HTML fixtures to the real Mistral parsers. It checked the following:
monthlyplanand moves the float bar from 80% to 42%.The tray icon and tray menu label are native and are covered by the
tray_bridge.rsunit test above.