Skip to content

Added option to show Codex 5-hr & weekly usage limit as a ring+pie chart#428

Open
le0-VV wants to merge 7 commits intosteipete:mainfrom
le0-VV:codex/pie-ring-pr-clean-v2
Open

Added option to show Codex 5-hr & weekly usage limit as a ring+pie chart#428
le0-VV wants to merge 7 commits intosteipete:mainfrom
le0-VV:codex/pie-ring-pr-clean-v2

Conversation

@le0-VV
Copy link

@le0-VV le0-VV commented Feb 25, 2026

Screenshot 2026-02-25 at 3 22 05 pm

By Codex:

  1. New Codex pie/ring display mode plumbing:
    • Added CodexMenuBarVisualizationMode support in settings/state.
    • Hooked mode selection into menu-bar rendering path so Codex can render:
      • default: weekly in pie, 5-hour in outer ring
      • swapped: weekly in outer ring, 5-hour in pie
  2. Pie/ring rendering behaviour:
    • Extended IconRenderer.makeCodexPieRingIcon(...) to render both mappings based on mode.
    • Added logic for used/unused colour inversion so track/fill semantics can be flipped.
    • Fixed 0-usage ring edge case by drawing a full visible ring when usage is exactly/near zero instead of producing a near-zero arc artifact.
  3. Non-finite upstream hardening:
    • In StatusItemController+Animation, added sanitization:
      • non-finite usage values (NaN, +inf, -inf) are treated as invalid and normalized out of normal percent maths.
    • Added invalid-chart targeting logic:
      • determines whether pie, ring, or both are affected depending on current weekly/session mapping mode.
  4. Invalid-value visual fallback (“flash”):
    • Added a 1-second ticker task (codexPieRingInvalidFlashTask) managed by StatusItemController.
    • When invalid values are present and Codex pie/ring is visible, affected chart alternates each second between:
      • full used colour
      • full available/track colour
    • This preserves a meaningful “error/attention” visual state without showing misleading partial usage.
  5. Lifecycle safety:
    • Flash task is started/stopped based on visibility + mode + invalid-data conditions.
    • Task is cancelled in controller deinit to prevent leaked background animation work.
  6. Test hardening:
    • Updated StatusItemAnimationTests to avoid fragile single-pixel assertions.
    • Replaced with sampled-region average alpha checks around the outer ring.
    • Added assertions for:
      • zero-usage ring visibility contrast
      • invalid-flash phase contrast (available-phase stronger than used-phase)
    • Keeps intent identical, reduces renderer-environment flakiness.

Add explicit invalid-chart rendering controls for codex pie/ring mode. This lets the UI keep a meaningful visual state when upstream usage values are non-finite by toggling full-track vs full-used rendering per affected chart.
Track the codex pie/ring invalid-flash task on the controller and cancel it during deinit. This prevents background task leaks and keeps animation lifecycle consistent with other controller-owned tasks.
…ash state

Detect non-finite upstream usage values, map them to affected pie/ring charts based on current layout mode, and run a 1-second flash ticker only when codex pie/ring is actively displayed. This aligns error handling with existing upstream resilience while preserving meaningful on-icon feedback.
…l variance

Replace brittle single-pixel outer-ring checks with sampled-region average alpha assertions, and cover zero-usage plus invalid-flash phase contrast. This keeps the same behavioral intent while reducing flakiness across rendering environments.
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3778bcbd4f

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Route pie/ring inputs through usedPercent vs remainingPercent based on usageBarsShowUsed in both merged and per-provider icon paths. Add regression test to assert rendered output matches expected used/remaining mappings.
Draw pie and ring used segments from start angle to used endpoint so low usage values render as small fills in show-used mode. Add regression coverage for 1% usage to guard against complement-arc regressions.
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