Repository navigation
fix(tray): label the tooltip from the headline lane, not the raw primary - #357
Conversation
The native tray tooltip passed `snapshot.primary` straight to
`compact_tray_status_label`, so a Codex account on a weekly-only plan
rendered the informational placeholder ("No active 5h session") instead
of the real weekly window.
`provider_status_label` already skipped informational lanes through
`codex_lane_headline_window`, but `build_tooltip` never got the same
treatment: nesszer#277 covered the React surfaces and the FloatBar, and the
Rust tray tooltip was left behind.
Extract the shared lane choice into `headline_window` and call it from
both sites so the two cannot drift apart again, and add a regression
test for the tooltip path.
Fixes nesszer#356
Co-Authored-By: Claude Opus 5 <[email protected]>
|
Thanks for the PR, I will review this ASAP. |
Finesssee
left a comment
There was a problem hiding this comment.
Thermo-nuclear review passed. The extraction is the right fix — shared helper eliminates the drift that caused the bug. See the review comment above for the full audit.
Thermo-Nuclear Code Quality Review — ApproveVerdictThis PR is the code-judo move. It removes a duplicated conditional instead of adding a second copy. Findings1. Structural regression — None. +35/-10, one file. The PR deletes complexity by extracting a shared 2. Code-judo — The PR itself IS the simplification. The root cause was a duplicated 3. Spaghetti — Reduced. Conditional count for codex lane selection: before 2 (one correct, one missing), after 1 (shared). Net decrease in branching complexity. 4. Type/boundary — Clean. 5. File size — No concern. 6. Test quality — Good. 7. Scope discipline — Commendable. Author explicitly notes two deliberate non-changes: (1) did not generalize ApprovalNo structural regression, no missed simplification (the PR IS the simplification), no file-size explosion, no spaghetti growth. The shared helper eliminates the drift risk that caused the bug. Approve. |
Summary
The native tray tooltip labelled
snapshot.primarydirectly, so a Codex account on a weekly-only plan showed the informational placeholder —Codex: No active 5h session— instead of the real weekly window.provider_status_labelalready routed Codex throughcodex_lane_headline_windowto skip informational lanes (the F5 / upstream-0.48.0 fix).build_tooltip, 111 lines further down the same file, never got the same treatment: #277 covered the React surfaces and the FloatBar, and the Rust tray tooltip was left behind. That is why the icon, the tray menu rows, the Providers sidebar, the FloatBar and the CLI were all correct while only the hover tooltip was wrong.Rather than repeat the
provider_id == "codex"conditional at a second call site, this extracts it intoheadline_windowand calls it from both, so the two surfaces cannot drift apart again. Net effect on behaviour is limited to the tooltip;provider_status_labelkeeps its existing semantics.Before:
After:
Related issue
Fixes #356
Affected areas
Validation
powershell.exe -ExecutionPolicy Bypass -NoProfile -File scripts\local-check.ps1— not run. No Rust toolchain on my machine (nocargo/rustc, no MSVC Build Tools), and installing the MSVC stack plus a first full build of the Tauri dependency tree was not something I could do here. Flagging this openly rather than ticking a box I did not exercise.pr-check.ymlis the validation path for this PR. The change is Rust-only in one file, socargo fmt --all --check,cargo clippy --workspace --all-targets -- -D warningsandcargo test --workspacecover it. Please let CI run before merging — if anything is red I will fix it.UI / tray proof
CUA Driver needs a built desktop shell, which needs the same toolchain I do not have. Manual proof instead, from the released v0.54.0 installer on a live weekly-only account:
The payload —
codexbar-cli.exe usage -p codex --json, informational primary plus a real weekly secondary:{ "primary": { "is_informational": true, "used_percent": 0.0, "window_minutes": 300, "reset_description": "No active 5h session" }, "secondary": { "is_informational": false, "used_percent": 14.0, "window_minutes": 10080, "reset_description": "3d 17h", "resets_at": "2026-08-27T10:47:41Z" } }The split — same account, same moment, v0.54.0:
selected_tray_percents→selected_usage_windowprovider_status_label→codex_lane_headline_windowbuild_tooltip→&s.primaryThe regression test —
tooltip_skips_informational_codex_primarybuilds the same shape (informational primary, weekly secondary at 16% resetting in3d 17h) and asserts the tooltip readsCodexBar\nCodex: 16% • Resets in 3d 17h. Onmainthat call returns the placeholder instead, so the test pins the regression. To be clear about what I actually did and did not do: I traced the expected string throughcompact_tray_status_label→normalize_reset_description→ResetsInShortby reading, but I have not executed the test (see Validation) — CI is the confirmation. The existingtooltip_uses_compact_status_labelsonly builds non-informational primaries, which is why this path was uncovered.Notes for reviewers
The behaviour change is one line in
build_tooltip; everything else is the extraction and the test.headline_windowdeliberately keeps theprovider_id == "codex"check rather than generalising to all providers. Widening it would change Claude and others too, and that is a bigger call than this bug needs — happy to widen it if you would rather the policy be provider-agnostic.The tooltip still ignores
provider_metrics, so pinning Codex to Weekly in Settings has no effect on it. Usingusage_metric::selected_usage_windowhere instead would fix that too, but it changes the tooltip for every provider, so I kept this PR to the reported bug. Say the word and I will follow up separately.Context on why the account has no 5h window: OpenAI switched this ChatGPT Plus account to a weekly-only limit shape in mid-July 2026. Scanning every
token_countevent in~/.codex/sessionsthat carries a populatedrate_limits.primary:The weekly-only count keeps growing with use; the two boundary timestamps and the zero do not. Same payload shape as [Bug]: Weekly usage and pace break when 5-hour limit is absent #267 and [Bug]: FloatBar shows informational 5h placeholder instead of weekly usage #275.