fix(tray): show real percentage when no declared primary candidate is present - #24
Open
Abhijith14 wants to merge 1 commit into
Open
Conversation
A plan can expose progress lines that are absent from its plugin manifest's declared primary candidates. Usage-based Codex accounts (Self_serve_business_usage_based) report only a "Credits" progress line and never "Session", which is the only candidate codex declares via primaryOrder. getTrayPrimaryBars then matched no label, left fraction undefined, and the tray rendered "--%" even though a perfectly usable progress line was present (used 1000 / limit 1000). Fall back to the first progress line in the runtime data when none of the declared candidates match, so the tray shows a real number. Plugins that declare no candidates at all are still skipped, exactly as before.
Abhijith14
force-pushed
the
fix/tray-percent-without-primary-candidate
branch
from
July 27, 2026 00:51
9ee1eda to
34e84bc
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
When none of a plugin's declared primary candidates appear in the runtime data,
getTrayPrimaryBarsnow falls back to the first available progress line instead of leavingfractionundefined.Why
The tray shows
--%for plans that expose a perfectly usable progress line, just not the one the manifest declares.Concrete case — a usage-based Codex account (
plan: Self_serve_business_usage_based):codex/plugin.jsonmarks onlySessionwithprimaryOrder, soprimary_candidates == ["Session"].Sessionline at all. Its only progress line isCredits(used: 1000.0,limit: 1000.0).primaryLabeltherefore resolves toundefined, theif (primaryLabel)branch is skipped,fractionstaysundefined, andformatTrayPercentText(undefined)returns"--%".The panel UI renders this account correctly (
0 credits left / 1,000 credits) — only the tray loses the number, which makes it look like a data problem rather than a metric-selection one.formatTrayPercentTextitself is fine: it already handles0correctly and has a test assertingformatTrayPercentText(0) === "0%". The fraction simply never reached it.Fix
If no declared candidate matches, use the first
progressline present in the data. With the case above this yieldslimit - used = 0overlimit 1000inleftmode →0%.Plugins that declare no candidates at all are still skipped by the existing guard, so this does not surface plugins that have no progress concept.
Testing
fraction: 0rather thanundefined.--%to0%.No visual changes to icon rendering in this PR.