Skip to content

fix: Improve desktop context status metrics#3996

Merged
esengine merged 2 commits into
main-v2from
codex/context-status-metrics
Jun 11, 2026
Merged

fix: Improve desktop context status metrics#3996
esengine merged 2 commits into
main-v2from
codex/context-status-metrics

Conversation

@SivanCola

Copy link
Copy Markdown
Collaborator

Summary

This PR tightens the desktop UI metrics shown around chat context and token usage. The main user-facing areas touched are the bottom status bar and the right-side Context overview panel.

Bottom status bar

  • Adds a current-turn total token metric next to the existing cumulative session token metric. This uses a new turnTotalTokens state value so it reflects the total tokens reported for the current or most recent exchange, rather than reusing the existing completion-only turnTokens value used by the composer.
  • Adds the active session turn count to the status bar. The value prefers the current topic metadata from the project tree and falls back to checkpoints/transcript user turns so it stays useful in both normal and browser-mock modes.
  • Replaces long text labels for dense status metrics with compact Lucide icons plus tooltips. This keeps the bar readable while preserving explanations for cache hit rate, session tokens, turn tokens, turns, context usage, compaction threshold, cost, and balance.
  • Fixes responsive hiding so hidden metrics remove the entire tooltip wrapper instead of leaving blank gaps or separator marks.

Context overview donut

  • Fixes the donut fill so the ring endpoint is always based on current context usage (usedTokens / windowTokens) rather than provider/session totals. This prevents cases like 61k / 1000k = 6% visually rendering as an almost-full ring.
  • Normalizes provider breakdown values when they exceed the current used context tokens, so Prompt/Completion/Reasoning/Other always sum back to the displayed used-token total.
  • Treats reasoning tokens as a subset of completion tokens. The Context overview now displays Completion as non-reasoning completion, Reasoning separately, and Other as the remaining current context usage.

Tests

  • Adds context-panel-breakdown.test.ts to lock the context donut math. The test covers reasoning not being double-counted and oversized provider breakdown values not filling the ring.
  • Wires the new test into the desktop frontend test scripts.

Verification

  • pnpm exec tsx src/__tests__/context-panel-breakdown.test.ts
  • pnpm run typecheck
  • pnpm run test:typecheck

Notes

  • Untracked local .codex/ and designs/ directories were left out of this PR.

@SivanCola SivanCola requested a review from esengine as a code owner June 11, 2026 08:17
@github-actions github-actions Bot added desktop Wails desktop app (desktop/**) v2 Go rewrite (1.x) — main-v2 branch, active development labels Jun 11, 2026

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

Copy link
Copy Markdown

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: 82aa54acbb

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread desktop/frontend/src/App.tsx Outdated
Comment thread desktop/frontend/src/components/ContextPanel.tsx Outdated
@esengine esengine merged commit 40b1f94 into main-v2 Jun 11, 2026
13 checks passed
@esengine esengine deleted the codex/context-status-metrics branch June 11, 2026 08:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

desktop Wails desktop app (desktop/**) v2 Go rewrite (1.x) — main-v2 branch, active development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants