Skip to content

fix(desktop): align context usage and compaction status#56746

Open
Git-on-my-level wants to merge 1 commit into
NousResearch:mainfrom
Git-on-my-level:fix/desktop-context-compaction-status
Open

fix(desktop): align context usage and compaction status#56746
Git-on-my-level wants to merge 1 commit into
NousResearch:mainfrom
Git-on-my-level:fix/desktop-context-compaction-status

Conversation

@Git-on-my-level

Copy link
Copy Markdown
Contributor

Summary

  • keep desktop context usage popup internals consistent by scaling rough category buckets to the provider-measured prompt total when real usage is available
  • re-baseline the status bar from the live session.context_breakdown snapshot when the popup opens, so the footer and popup stop showing stale/different context totals
  • add an explicit compaction-complete status edge and clear the desktop "Summarizing thread" indicator as soon as compaction finishes instead of leaving it latched for the rest of the turn

Issue

The desktop app could show multiple incompatible context numbers at the same time. For example, the footer might show 128.2k/272.0k (47%), while the context popup showed ~241.4k/272.0k (89%), and the popup's category rows could sum to a third value or even show Conversation larger than the header total.

Root causes:

  1. the popup header used provider-measured last_prompt_tokens, but its category rows were independent rough estimates;
  2. the footer used the last pushed usage event while the popup fetched a fresh live breakdown;
  3. auto-compaction only emitted a start event, so the desktop treated "Summarizing thread" as a turn-long latch rather than active summarization work.

Test Plan

  • uv run --with pytest python -m pytest tests/agent/test_context_breakdown.py tests/tui_gateway/test_compaction_status.py tests/test_tui_gateway_server.py::test_get_usage_reports_real_current_occupancy tests/test_tui_gateway_server.py::test_get_usage_clamps_post_compression_sentinel -q -o 'addopts='
  • npm run test:ui -- src/app/shell/context-usage-panel.test.tsx src/store/compaction.test.ts
  • npm run typecheck
  • npx eslint src/app/shell/context-usage-panel.test.tsx src/app/shell/context-usage-panel.tsx src/app/shell/hooks/use-statusbar-items.tsx src/app/session/hooks/use-message-stream/gateway-event.ts
  • git diff --check

@Git-on-my-level Git-on-my-level force-pushed the fix/desktop-context-compaction-status branch from 4c51823 to 53f9cfa Compare July 2, 2026 02:19
@alt-glitch alt-glitch added type/bug Something isn't working comp/desktop Electron desktop app (apps/desktop/*) comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint P3 Low — cosmetic, nice to have labels Jul 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint comp/desktop Electron desktop app (apps/desktop/*) P3 Low — cosmetic, nice to have type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants