Skip to content

feat(ai): Show context window usage as absolute tokens Closes - #14628

Open
sikongyue wants to merge 1 commit into
warpdotdev:masterfrom
sikongyue:feat/context-window-absolute-tokens
Open

feat(ai): Show context window usage as absolute tokens Closes#14628
sikongyue wants to merge 1 commit into
warpdotdev:masterfrom
sikongyue:feat/context-window-absolute-tokens

Conversation

@sikongyue

@sikongyue sikongyue commented Aug 1, 2026

Copy link
Copy Markdown

Display absolute token counts alongside percentages in AI Agent context window usage UI, so users can judge when to compact or hand off based on actual token counts rather than relative percentages.

  • Add context_window_tokens and context_window_limit fields to ConversationUsageInfo
  • Add context_window_tokens() method in conversation.rs, computed by summing segment token counts
  • Pass context window token data through terminal/view.rs
  • Update conversation_usage_view.rs display format:
    • With limit: "112k / 1M (41%)"
    • Without limit: "112k (41%)"
    • Fallback: "41%" (when no segment data available)
  • Update agent input footer tooltip: "41% context remaining (112k / 1M)"
  • Fix struct initialization in gql_convert.rs and test files

Closes #14629: Show context window usage as absolute tokens

Description

Linked Issue

  • The linked issue is labeled ready-to-spec or ready-to-implement.
  • Where appropriate, screenshots or a short video of the implementation are included below (especially for user-visible or UI changes).

Testing

  • I have manually tested my changes locally with ./script/run

Screenshots / Videos

Agent Mode

  • Warp Agent Mode - This PR was created via Warp's AI Agent Mode

@cla-bot

cla-bot Bot commented Aug 1, 2026

Copy link
Copy Markdown

Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: sikongyue.
This is most likely caused by a git client misconfiguration; please make sure to:

  1. check if your git client is configured with an email to sign commits git config --list | grep email
  2. If not, set it up using git config --global user.email email@example.com
  3. Make sure that the git commit email is configured in your GitHub account settings, see https://github.com/settings/emails

@oz-for-oss

oz-for-oss Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

@sikongyue

Every PR must be linked to a same-repo issue before Oz can review it.

This PR is linked to #14629, but no linked issue is marked ready-to-implement yet. Only repository maintainers apply that label, so please wait for a maintainer to mark the issue. Once it is marked, push a new commit or comment /oz-review to re-trigger review.

See the contribution guidelines for the full readiness model.

Powered by Oz

@github-actions github-actions Bot added the external-contributor Indicates that a PR has been opened by someone outside the Warp team. label Aug 1, 2026

@oz-for-oss oz-for-oss Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@sikongyue

Every PR must be linked to a same-repo issue before Oz can review it.

Next step: open or find a same-repo issue describing this change, then link it to this PR by adding Closes #123 to the PR description (or using the "Development" sidebar on GitHub). A maintainer will mark the issue ready-to-implement when it is ready. Once it is marked, comment /oz-review to re-trigger review.

See the contribution guidelines for the full readiness model.

Powered by Oz

@sikongyue
sikongyue force-pushed the feat/context-window-absolute-tokens branch from 716b9bd to 25a36e6 Compare August 1, 2026 16:57
@cla-bot

cla-bot Bot commented Aug 1, 2026

Copy link
Copy Markdown

Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: sikongyue.
This is most likely caused by a git client misconfiguration; please make sure to:

  1. check if your git client is configured with an email to sign commits git config --list | grep email
  2. If not, set it up using git config --global user.email email@example.com
  3. Make sure that the git commit email is configured in your GitHub account settings, see https://github.com/settings/emails

@sikongyue

Copy link
Copy Markdown
Author

/oz-review

@oz-for-oss oz-for-oss Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@sikongyue

Every PR must be linked to a same-repo issue before Oz can review it.

Next step: open or find a same-repo issue describing this change, then link it to this PR by adding Closes #123 to the PR description (or using the "Development" sidebar on GitHub). A maintainer will mark the issue ready-to-implement when it is ready. Once it is marked, comment /oz-review to re-trigger review.

See the contribution guidelines for the full readiness model.

Powered by Oz

@sikongyue

Copy link
Copy Markdown
Author

/oz-review

@oz-for-oss oz-for-oss Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@sikongyue

Every PR must be linked to a same-repo issue before Oz can review it.

This PR is linked to #14629, but no linked issue is marked ready-to-implement yet. Only repository maintainers apply that label, so please wait for a maintainer to mark the issue. Once it is marked, push a new commit or comment /oz-review to re-trigger review.

See the contribution guidelines for the full readiness model.

Powered by Oz

@sikongyue

Copy link
Copy Markdown
Author

/oz-review

@oz-for-oss oz-for-oss Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@sikongyue

Every PR must be linked to a same-repo issue before Oz can review it.

This PR is linked to #14629, but no linked issue is marked ready-to-implement yet. Only repository maintainers apply that label, so please wait for a maintainer to mark the issue. Once it is marked, push a new commit or comment /oz-review to re-trigger review.

See the contribution guidelines for the full readiness model.

Powered by Oz

@sikongyue

Copy link
Copy Markdown
Author

/oz-review

@oz-for-oss oz-for-oss Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@sikongyue

Every PR must be linked to a same-repo issue before Oz can review it.

This PR is linked to #14629, but no linked issue is marked ready-to-implement yet. Only repository maintainers apply that label, so please wait for a maintainer to mark the issue. Once it is marked, push a new commit or comment /oz-review to re-trigger review.

See the contribution guidelines for the full readiness model.

Powered by Oz

@sikongyue

Copy link
Copy Markdown
Author

/oz-review

@oz-for-oss oz-for-oss Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@sikongyue

Every PR must be linked to a same-repo issue before Oz can review it.

Next step: open or find a same-repo issue describing this change, then link it to this PR by adding Closes #123 to the PR description (or using the "Development" sidebar on GitHub). A maintainer will mark the issue ready-to-implement when it is ready. Once it is marked, comment /oz-review to re-trigger review.

See the contribution guidelines for the full readiness model.

Powered by Oz

@sikongyue

Copy link
Copy Markdown
Author

/oz-review

@oz-for-oss oz-for-oss Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@sikongyue

Every PR must be linked to a same-repo issue before Oz can review it.

Next step: open or find a same-repo issue describing this change, then link it to this PR by adding Closes #123 to the PR description (or using the "Development" sidebar on GitHub). A maintainer will mark the issue ready-to-implement when it is ready. Once it is marked, comment /oz-review to re-trigger review.

See the contribution guidelines for the full readiness model.

Powered by Oz

@sikongyue sikongyue changed the title feat(ai): Show context window usage as absolute tokens (e.g. 112k / 1M) feat(ai): Show context window usage as absolute tokens Aug 1, 2026
@sikongyue

Copy link
Copy Markdown
Author

/oz-review

@oz-for-oss oz-for-oss Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@sikongyue

Every PR must be linked to a same-repo issue before Oz can review it.

This PR is linked to #14629, but no linked issue is marked ready-to-implement yet. Only repository maintainers apply that label, so please wait for a maintainer to mark the issue. Once it is marked, push a new commit or comment /oz-review to re-trigger review.

See the contribution guidelines for the full readiness model.

Powered by Oz

@sikongyue

Copy link
Copy Markdown
Author

/oz-review

@oz-for-oss oz-for-oss Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@sikongyue

Every PR must be linked to a same-repo issue before Oz can review it.

This PR is linked to #14629, but no linked issue is marked ready-to-implement yet. Only repository maintainers apply that label, so please wait for a maintainer to mark the issue. Once it is marked, push a new commit or comment /oz-review to re-trigger review.

See the contribution guidelines for the full readiness model.

Powered by Oz

Display absolute token counts alongside percentages in AI Agent context
window usage UI, so users can judge when to compact or hand off based
on actual token counts rather than relative percentages.

- Add context_window_tokens and context_window_limit fields to ConversationUsageInfo
- Add context_window_tokens() method in conversation.rs, computed by summing segment token counts
- Pass context window token data through terminal/view.rs
- Update conversation_usage_view.rs display format:
  - With limit: "112k / 1M (41%)"
  - Without limit: "112k (41%)"
  - Fallback: "41%" (when no segment data available)
- Update agent input footer tooltip: "41% context remaining (112k / 1M)"
- Fix struct initialization in gql_convert.rs and test files

Closes issue: Show context window usage as absolute tokens
@sikongyue
sikongyue force-pushed the feat/context-window-absolute-tokens branch from 25a36e6 to 1d6df7f Compare August 1, 2026 17:47
@cla-bot

cla-bot Bot commented Aug 1, 2026

Copy link
Copy Markdown

Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: sikongyue.
This is most likely caused by a git client misconfiguration; please make sure to:

  1. check if your git client is configured with an email to sign commits git config --list | grep email
  2. If not, set it up using git config --global user.email email@example.com
  3. Make sure that the git commit email is configured in your GitHub account settings, see https://github.com/settings/emails

@sikongyue

Copy link
Copy Markdown
Author

/oz-for-oss

@sikongyue

Copy link
Copy Markdown
Author

/oz-review

@oz-for-oss oz-for-oss Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@sikongyue

Every PR must be linked to a same-repo issue before Oz can review it.

This PR is linked to #14629, but no linked issue is marked ready-to-implement yet. Only repository maintainers apply that label, so please wait for a maintainer to mark the issue. Once it is marked, push a new commit or comment /oz-review to re-trigger review.

See the contribution guidelines for the full readiness model.

Powered by Oz

@sikongyue sikongyue changed the title feat(ai): Show context window usage as absolute tokens feat(ai): Show context window usage as absolute tokens Closes #14629 Aug 1, 2026
@sikongyue sikongyue changed the title feat(ai): Show context window usage as absolute tokens Closes #14629 feat(ai): Show context window usage as absolute tokens Closes Aug 1, 2026
@sikongyue

Copy link
Copy Markdown
Author

/oz-review

@oz-for-oss oz-for-oss Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@sikongyue

Every PR must be linked to a same-repo issue before Oz can review it.

This PR is linked to #14629, but no linked issue is marked ready-to-implement yet. Only repository maintainers apply that label, so please wait for a maintainer to mark the issue. Once it is marked, push a new commit or comment /oz-review to re-trigger review.

See the contribution guidelines for the full readiness model.

Powered by Oz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external-contributor Indicates that a PR has been opened by someone outside the Warp team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Show context window usage as absolute tokens (e.g. 112k / 1M), not only as a percentage.

1 participant