Skip to content

Port upstream 0.68.0: show Mistral plan amounts as detail lines (stacked on #647) - #657

Draft
Finesssee wants to merge 2 commits into
port/micro-0.67.0-mistral-plan-tokensfrom
port/micro-0.68.0-mistral-plan-detail
Draft

Finesssee wants to merge 2 commits into
port/micro-0.67.0-mistral-plan-tokensfrom
port/micro-0.68.0-mistral-plan-detail

Conversation

@Finesssee

Copy link
Copy Markdown
Collaborator

Summary

For Mistral, the amounts string carried in reset_description (the Included API window and the extra mistral-monthly-plan "Monthly Plan" window) is now treated as a detail line and never as a reset time.

  • CLI text prints the reset line only when resets_at exists, then the amounts line. JSON output is unchanged (the new flag is not serialized).
  • Tray card and the Settings Usage section render the description as its own secondary line and do not pass it through normalizeResetDescription. When resetsAt is absent, no reset text is shown.
  • The float bar and tray compact reset label no longer show the amounts as a reset label.
  • Other providers are unchanged. The only cross-cutting piece is a small provider-owned flag, RateWindow.description_is_detail (skip_serializing), set only by the Mistral provider.

Stacked on #647.

Upstream reference

Upstream 0.68.0: CLIRenderer.appendResetAndDetailLines, MenuDescriptor.appendRateWindow(descriptionIsDetail:), and the Mistral descriptor (usesDetailBackedWindow, extraRateWindowUsesResetDescriptionAsDetail, primaryDescriptionIsDetail), plus MistralCLIOutputTests / MenuDescriptorMistralTests. Read-only, tag-pinned reads.

Ported / Deferred

Ported:

  • RateWindow.description_is_detail flag plus with_description_as_detail() builder (rust/src/core/rate_window.rs).
  • Mistral primary and budget windows set the flag.
  • CLI renderer detail branch (rust/src/cli/usage/render.rs).
  • Bridge DTO field descriptionIsDetail, tray compact reset label guard.
  • Frontend: resetDescriptionFallback / windowDetailText helpers, MenuCardDetails, UsageSection, FloatBar, CSS.

Deferred: none for this item.

Validation

  • cargo +1.98.0 fmt --all: clean
  • cargo +1.98.0 clippy --manifest-path rust/Cargo.toml --all-targets -- -D warnings: clean
  • cargo +1.98.0 clippy --manifest-path apps/desktop-tauri/src-tauri/Cargo.toml --all-targets -- -D warnings: clean
  • cargo +1.98.0 test --manifest-path rust/Cargo.toml -- --test-threads=4: 2169 passed, 0 failed, 1 ignored
  • cargo +1.98.0 test --manifest-path apps/desktop-tauri/src-tauri/Cargo.toml -- --test-threads=4: 463 passed, 1 failed. The failure is commands::tests::bootstrap_payload_exposes_every_provider_variant (catalog size drift, 79 vs 78). This diff does not touch ProviderId or the catalog, and the test reads machine-local state; it is not caused by this change.
  • pnpm --dir apps/desktop-tauri exec vitest run: 67 files, 410 tests passed
  • pnpm --dir apps/desktop-tauri run lint: no errors (existing warnings only)
  • pnpm --dir apps/desktop-tauri run build: passed (tsc + vite + locale drift check)

New tests: CLI text (reset then amounts, no reset line without a date, flag absent from JSON), tray compact-label guard in status.rs, and Vitest cases for MenuCard, UsageSection, FloatBar and usageWindows.

Affected areas

Mistral usage display in CLI text, tray card, Settings Usage section, float bar and tray compact reset label. RateWindowSnapshot bridge DTO gains an optional descriptionIsDetail. No settings, dependency, or wire-format changes.

UI proof

Pending: coordinator will capture CUA proof on a fresh build.

@coderabbitai

coderabbitai Bot commented Sep 29, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

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.

❤️ Share

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

@Finesssee

Copy link
Copy Markdown
Collaborator Author

CUA UI proof (local, fresh build)

  • Build commit: 1a798f64 (PR head, detached). pnpm --dir apps/desktop-tauri install --frozen-lockfile then pnpm --dir apps/desktop-tauri run tauri:build:debug via the E-core wrapper, BUILD_EXIT=0. Binary: ...\cargo-target\slot-cua\debug\codexbar-desktop-tauri.exe.
  • Isolation: CODEXBAR_SEED_USAGE_JSON seeds a synthetic Codex snapshot (the seed hook only supports the codex provider, so the Mistral-shaped fields are carried on it: Included-API-style primary with descriptionIsDetail:true and no resetsAt, a Weekly window with a real resetsAt, and an extra window titled "Monthly Plan" with descriptionIsDetail:true). The control seed is identical without the flag, which reproduces the pre-change behavior. CODEX_HOME pointed at an empty dir.
  • To keep the user's real settings untouched and only Codex enabled (otherwise the 50-provider refresh evicts the seed), the launched build used a temporary, uncommitted local patch in rust/src/logging.rs::config_root (env CODEXBAR_PROOF_CONFIG_ROOT) pointing at a temp settings.json with enabled_providers:["codex"]. The patch was reverted afterwards; the PR diff is unchanged (the patch only redirects the settings path).
  • Driven with cua-driver call list_windows / get_window_state --screenshot-out-file; proof modes popOut:provider:codex and settings:providers.

Assertions

  • PASS (control, flag absent): the pop-out shows "Resets 12.5/50 USD included" and "Resets 140/350 USD plan", i.e. the amounts render as reset text (the old bug shape).
  • PASS (flag set): the pop-out shows "25% used" then a secondary detail line "12.5/50 USD included" with no "Resets" prefix; likewise "40% used" then "140/350 USD plan" for the Monthly Plan window.
  • PASS: with resetsAt absent, no reset text is shown for the detail windows; the Weekly window (has resetsAt, no flag) still shows "Resets in ...".
  • PASS: Settings > Providers > Codex > Usage renders the detail as its own line ("12.5/50 USD included" under Session 25%; UIA texts "12.5/50 USD included", "140/350 USD plan", no "Resets" prefix).
  • PASS: dark theme under auto in all captures.
  • NOT VERIFIED: the compact tray panel (trayPanel) does not show per-window detail lines at all in this build (only labels and percentages), so it does not exercise the change; float bar and CLI text were not captured live (covered by the PR's Vitest and CLI tests). Also not run against a real Mistral account.
  • Note: "Resets in 26399d" on Weekly is just the synthetic 2099 seed date.
  • Privacy: the raw Settings screenshot contained a real Codex account email from the machine, so it was discarded; only a crop of the Usage section and a redacted UIA dump are kept.

Local artifacts (not committed), all under C:\Users\FSOS\AppData\Local\Temp\port-audit\proof\657\

  • 01-control-popout.png (before shape, flag absent), 03-detail-popout.png (after), 04-detail-settings-usage-crop.png, before-tray-compact.png (compact tray, unchanged)
  • *-uia.txt UIA dumps, ../657-build.log, seed-detail.json, seed-control.json

@Finesssee

Copy link
Copy Markdown
Collaborator Author

Reviewed by Codex gpt-6-luna (xhigh); verified and validated by Claude

Thermo-nuclear review of PR #657 (2 findings, both fixed):

  • P2 apps/desktop-tauri/src-tauri/src/usage_metric.rs: same_window ignored the new description_is_detail flag, so windows with different display semantics could be treated as duplicates and a companion window suppressed. Equality now includes the flag.
  • P3 rust/src/cli/usage/render.rs: the detail and reset paths duplicated the CLI metric row, leaving room for formatting drift. The row is now emitted once; only the detail-specific lines are conditional.

@Finesssee

Copy link
Copy Markdown
Collaborator Author

Fixes pushed at 9170b79: both findings fixed, none left. Validated with cargo +1.98.0 fmt --all; clippy --workspace --all-targets -D warnings (clean); cargo test -p codexbar render (23 passed); cargo test -p codexbar-desktop-tauri usage_metric (18 passed). CLI output unchanged; companion-window dedupe now differs only when the detail flag differs. CUA proof not re-run.

@Finesssee

Copy link
Copy Markdown
Collaborator Author

UI proof (browser-use)

Fresh proof at the CURRENT PR head 9170b79 (the earlier CUA proof
was at the older head 1a798f6, before the "Address thermo review" commit).

Build: debug desktop exe at 9170b79 with the proof-only dirs shim and three proof-only overlays
(seed per-provider freshness stamp in main.rs, a force-refresh suppression while the seed is
active, and diagnostic logging) — all reverted after the build; git status clean, PR diff
unchanged. Kit proof\657: isolated home (CODEXBAR_PROOF_HOME, dirs shim), empty provider
homes, plaintext kit settings (codex only, all auto-refresh off), CDP on 9361 (9335 was held by
the concurrent #739 burndown proof), proof-window-guard running. Seeded via
CODEXBAR_SEED_USAGE_JSON (the seed hook is codex-shaped only, so the Mistral-shaped windows ride
on the synthetic codex snapshot, as in the prior proof): primary 25% with
descriptionIsDetail:true and no resetsAt, a Weekly window with a real resetsAt, and a
mistral-monthly-plan extra window with descriptionIsDetail:true. Control seed identical
without the flag. DOM reads/clicks and page-local JS through CDP only; no OS keyboard/mouse.

# Scenario Assertion Result
A0 privacy no e-mails/personal strings on the settings home (793 chars scanned) PASS
A1 flag set (Settings) Usage section: "Session 25%" + detail line "12.5/50 USD included" (own .provider-usage-bar__detail), no "Resets" prefix PASS
A2 flag set (Settings) "Monthly Plan 40%" + detail "140/350 USD plan"; "Weekly 40%" keeps "Resets in 26526d 8h" (non-detail window, reset text intact) PASS
B1 flag set (tray card) Codex menu card: Primary 25% + .menu-metric__detail "12.5/50 USD included"; Secondary 40% + .menu-metric__reset "Resets in ..."; Monthly Plan 40% + detail "140/350 USD plan" PASS
C1 control (flag absent) pre-change bug shape reproduces: "Resets 12.5/50 USD included" and "Resets 140/350 USD plan" — amounts render as reset text; no .provider-usage-bar__detail rows PASS
C2 theme settings + tray surfaces stay dark under theme auto (colorScheme dark) PASS
C3 focus document.hasFocus() true on this base (pre-#713; #713 no-focus-stealing is not on this branch base) — proof actions used DOM clicks only, no OS input, window guard moved windows with SWP_NOACTIVATE PASS (base behavior; noted)

Known seed artifacts (not PR behavior): "Updated 26526d" (2099 seed date), "Data Source: seed".

Screenshots (local, not committed): C:\Users\FSOS\AppData\Local\Win-CodexBar\port-audit\proof\657\shots\A-settings-detail.png, B-tray-card.png, B-tray-detail.png. The Settings screenshot contains the machine's ambient Codex account e-mail rendered by the Codex Accounts section (a settings surface on this base), so it is kept local only and is NOT attached — no personal data in PR comments.

Coordination note: the proof ran under the proof.lock (both port-audit paths, owner=worker) with
the lane-B #739 burndown run paused cooperatively; an idle #739 instance holding the OS-wide
single-instance slot (CPU delta 0 across two samples) was stopped to unblock the kit, with
lane-B's agreement.

@Finesssee

Copy link
Copy Markdown
Collaborator Author

Validated 2026-10-02 at 9170b79 (current PR head, includes the "Address thermo review" fixes):

Chain status: READY for the integrator — merge #647 first, then #657; that unblocks #702 (LiteLLM identity/budgets) and the Mistral 0.70 pair #717/#718, which are stacked on this head.

Finesssee added a commit that referenced this pull request Oct 2, 2026
…ail lines (stacked on #647; keeps #697 monthly-block guards, adopts the #657 reset-description fallback and detail-line CSS)
Finesssee added a commit that referenced this pull request Oct 2, 2026
Finesssee added a commit that referenced this pull request Oct 2, 2026
Finesssee added a commit that referenced this pull request Oct 2, 2026
…menu label (stacked on #657; tray_bridge stays on the presentation-plan layout; picker merges #738 lane labels with #717 primaryMetricLabel)
Finesssee added a commit that referenced this pull request Oct 2, 2026
Finesssee added a commit that referenced this pull request Oct 2, 2026
…riptionFallback for the hook fallback slot, gate informational windows, keep detail lines out of reset wording
Finesssee added a commit that referenced this pull request Oct 2, 2026
…ields in test initializers, qualify reset_backfill calls, drop stale pre-#610 tray tests, restore the HF wallet Auto short-circuit
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