Skip to content

fix: Fix context window size and redesign usage indicator#1328

Merged
charlesvien merged 11 commits intomainfrom
03-24-context_window_bugs
Mar 25, 2026
Merged

fix: Fix context window size and redesign usage indicator#1328
charlesvien merged 11 commits intomainfrom
03-24-context_window_bugs

Conversation

@charlesvien
Copy link
Copy Markdown
Member

@charlesvien charlesvien commented Mar 25, 2026

Problem

Closes #1323

Context window size was underreported by the SDK (returning 200K for 1M-context models), causing inaccurate usage percentages and premature compaction warnings.

Changes

  1. Use gateway-reported context window as floor, only adopt SDK value when larger
  2. Persist lastContextWindowSize across prompt() calls so it survives turn boundaries
  3. Replace text-only percentage indicator with circular progress ring in session footer
  4. Emit live usage_update during streaming (on assistant messages, not just on result)
  5. Show context percentage in compact boundary markers
  6. Remove old getDefaultContextWindow hardcoded lookup in favor of gateway model data

How did you test this?

Manually

Copy link
Copy Markdown
Member Author

charlesvien commented Mar 25, 2026

@charlesvien charlesvien changed the title Context window bugs fix: Fix context window size and redesign usage indicator Mar 25, 2026
@charlesvien charlesvien changed the base branch from main to graphite-base/1328 March 25, 2026 17:30
@charlesvien charlesvien force-pushed the 03-24-context_window_bugs branch from f69d0be to 5bdb2b4 Compare March 25, 2026 17:30
@charlesvien charlesvien changed the base branch from graphite-base/1328 to 03-25-update-claude-adapter March 25, 2026 17:30
@charlesvien charlesvien marked this pull request as ready for review March 25, 2026 17:35
Copy link
Copy Markdown
Member Author

charlesvien commented Mar 25, 2026

Merge activity

  • Mar 25, 5:48 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Mar 25, 5:49 PM UTC: Graphite rebased this pull request as part of a merge.
  • Mar 25, 5:56 PM UTC: @charlesvien merged this pull request with Graphite.

@charlesvien charlesvien changed the base branch from 03-25-update-claude-adapter to graphite-base/1328 March 25, 2026 17:48
@charlesvien charlesvien changed the base branch from graphite-base/1328 to main March 25, 2026 17:48
@charlesvien charlesvien force-pushed the 03-24-context_window_bugs branch from 5d9d923 to 168d89a Compare March 25, 2026 17:49
@charlesvien charlesvien merged commit e8aa7f2 into main Mar 25, 2026
15 checks passed
@charlesvien charlesvien deleted the 03-24-context_window_bugs branch March 25, 2026 17:56
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.

Fix compaction happening too early + fix context window disconnect

2 participants