Skip to content

fix(opencode): show context usage against usable limit#28059

Open
MoodyMarshmallow wants to merge 2 commits into
anomalyco:devfrom
MoodyMarshmallow:context-usage-percentage-fix
Open

fix(opencode): show context usage against usable limit#28059
MoodyMarshmallow wants to merge 2 commits into
anomalyco:devfrom
MoodyMarshmallow:context-usage-percentage-fix

Conversation

@MoodyMarshmallow
Copy link
Copy Markdown

Issue for this PR

Closes #28057

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Updates TUI context usage to use opencode's usable compaction limit instead of the raw model context limit.

percent = used context tokens / usable context limit

For input-limited models, usable context limit = input token limit - compaction reserved tokens.

This better reflects how close a session is to compaction/overflow.

How did you verify your code works?

bun test test/session/compaction.test.ts
bun typecheck

Screenshots / recordings

If this is a UI change, please include a screenshot or recording.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

If you do not follow this template your PR will be automatically rejected.

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.

[BUG]: Context percentage indicator doesn't reflect usable context proportion

1 participant