CodexBar icon indicating copy to clipboard operation
CodexBar copied to clipboard

feature request: add more metric options for "show most-used provider"

Open dstier-git opened this issue 5 months ago • 5 comments

Currently, "Show most-used provider" in settings only uses one criteria: the provider closest to its rate limit.

Image

As #1743 mentions, this metric is often not very useful when certain providers have lower limits. I propose that we should allow the user to decide how "most-used provider" is defined.

Options could include:

  • Most tokens used in current session
  • Most money-amount worth of current tokens used
  • Potentially user-created criteria with greater code changes

dstier-git avatar Jun 28 '26 18:06 dstier-git

Codex review: this still needs some work. Reviewed October 6, 2026, 7:48 PM ET / 23:48 UTC.

Summary Keep open for product direction: token/spend ranking remains absent, and the owner explicitly retained this request after the related merges. The repository profile also disables automatic closure.

Reproducibility: not applicable. as a bug reproduction: source, settings, and release inspection establish that alternate ranking modes are a missing capability.

Root-cause cluster Relationship: canonical Canonical: https://github.com/steipete/codexbar/issues/1777 Summary: This remains the distinct ranking-metric decision; related merges intentionally address eligibility and presentation only.

Members:

  • partial_overlap: https://github.com/steipete/codexbar/pull/1780 - Closed unmerged proposal included alternate ranking modes and a separate candidate filter.
  • partial_overlap: https://github.com/steipete/codexbar/pull/1781 - Merged eligibility repair explicitly excludes token/spend ranking.
  • adjacent_distinct: https://github.com/steipete/codexbar/issues/1743 - Resolved Overview eligibility request rather than alternate ranking metrics.
  • partial_overlap: https://github.com/steipete/codexbar/pull/2275 - Merged layout customization leaves automatic provider-ranking scope open.
  • adjacent_distinct: https://github.com/steipete/codexbar/issues/2257 - Model-centric aggregation concerns a different display and identity contract.

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Maintainer decision needed

Question Recommendation
Should CodexBar add bounded daily token/spend ranking modes, and what comparison window, data eligibility, and empty-result fallback should they use? Approve bounded daily modes: Define a common reporting day, reuse Overview candidates, require comparable coverage and same-currency spend provenance, and specify the fallback while retaining quota ranking by default.

Why: The owner has explicitly left these choices unresolved; snapshot field names alone cannot define fair cross-provider comparisons.

Next step Obtain owner approval for the daily comparison contract before defining a repair-lane implementation; this is new feature work, not a bounded bug fix.

Review details

Best possible solution:

If approved, add clearly labeled daily ranking modes using comparable data, reuse Overview eligibility, and preserve quota proximity as the existing default.

Do we have a high-confidence way to reproduce the issue?

Not applicable as a bug reproduction: source, settings, and release inspection establish that alternate ranking modes are a missing capability.

Is this the best way to solve the issue?

Unclear until scope is approved; explicitly labeled daily modes are more defensible than treating session-named fields as a common active session or supporting arbitrary criteria.

AGENTS.md: found and applied where relevant.

Remaining risk / open question:

  • The comparison day/time zone, eligible data coverage and pricing provenance, and empty-result fallback need an approved contract before implementation.

Codex review notes: model internal, reasoning medium; reviewed against bba06ff6f3a1.

Label changes

Label changes:

No label changes.

Label justifications:

  • P3: This is optional selection customization with functioning existing behavior and an unresolved product contract.
  • impact:ux-friction: Quota proximity can select a low-limit provider that does not match the user’s intended meaning of most-used.
Evidence reviewed

What I checked:

  • Current ranking: The selector compares rate-window usedPercent; it has no token or spend ranking branch. (Sources/CodexBar/UsageStore+HighestUsage.swift:25, bba06ff6f3a1)
  • Eligibility and fallback: The combined icon ranks Overview-selected providers and keeps its fallback inside a nonempty selection. (Sources/CodexBar/StatusItemController+Animation.swift:1255, bba06ff6f3a1)
  • Data semantics: The shared snapshot builder normally obtains session values from the current local day. Snapshot metadata now includes currency, coverage, partial-scan state, and cost provenance, which should govern any comparison. (Sources/CodexBarCore/CostUsageFetcher.swift:1743, bba06ff6f3a1)
  • Existing comparison policy: The Usage & Spend dashboard already groups native currencies separately and never ranks amounts across currencies; its rankings are a separate display from menu bar provider selection. (docs/providers.md:41, bba06ff6f3a1)
  • Owner direction and related merges: The owner’s September 25 comment explicitly keeps comparison-window, eligibility, and missing-data decisions open: https://github.com/steipete/CodexBar/issues/1777#issuecomment-5826963119. Merged https://github.com/steipete/CodexBar/pull/1781 preserves quota ranking; merged https://github.com/steipete/CodexBar/pull/2275 adds layout customization and expressly leaves this request open.
  • Latest-release behavior: The v0.72.0 source also ranks usedPercent, so the requested ranking modes are absent from both the latest release and current main. (Sources/CodexBar/UsageStore+HighestUsage.swift:25, cfee869f3181)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • dstier-git: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Yuxin Qiao: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

clawsweeper[bot] avatar Jun 28 '26 18:06 clawsweeper[bot]

#1781 was rewritten to resolve the related provider-eligibility request without adding token/spend ranking. Exact head be4c748db5f597d2dfd80a4c3398e9b263fd2344 keeps the established closest-to-limit metric and reuses the existing Overview provider subset.

Token and dollar rankings remain product-ambiguous: provider snapshots cover different windows, may be absent while quota data is present, and have no agreed empty-result fallback. The broad implementation also required two new persisted settings and a second provider filter that could disagree with Overview.

Recommendation: keep this issue open only if those three contracts are worth defining: comparison window, provider eligibility, and missing-data fallback. Otherwise close it as not planned after #1781 lands. No current-main behavior fixes this request, so I am leaving it decision-ready rather than closing it.

steipete avatar Jul 01 '26 07:07 steipete

PR #2275 partially addresses this request and has merged. It adds real drag-and-drop token layouts, presets, one- or two-line stacking, Small/Regular sizing, Tight/Regular spacing, and global or per-provider overrides.

Keeping this issue open: the broader customization ideas discussed here extend beyond the owner-approved menu bar layout-editor scope.

steipete avatar Jul 17 '26 23:07 steipete

Thanks @dstier-git. Current main still ranks the Overview-selected providers by proximity to their quota limit. The available sessionTokens and sessionCostUSD fields normally describe today, not a common active session, and snapshots differ in coverage, currency, and cost provenance. This remains open for the comparison-window, eligibility, and missing-data decisions already identified in the discussion. A bounded next step would be explicitly labeled “Tokens today” and comparable “Estimated spend today” modes, if that scope is approved.

steipete avatar Sep 25 '26 04:09 steipete

Thanks @dstier-git. The most-used provider metric stays simple on purpose; per-provider metric choice is available in Settings instead. Closing as not planned.

steipete avatar Oct 07 '26 16:10 steipete