Skip to content

fix(pi): refresh context after compaction - #1634

Merged
tiann merged 1 commit into
tiann:mainfrom
swear01:fix/issue-1630-pi-compact-context
Aug 19, 2026
Merged

fix(pi): refresh context after compaction#1634
tiann merged 1 commit into
tiann:mainfrom
swear01:fix/issue-1630-pi-compact-context

Conversation

@swear01

@swear01 swear01 commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Fixes #1630

Summary

  • publish a context-only usage update immediately after successful Pi /compact
  • use Pi's estimatedTokensAfter as a temporary UI estimate
  • preserve the existing authoritative usage path for the next LLM response

Pi intentionally reports unknown context usage immediately after compaction. HAPI now avoids displaying the pre-compaction value while keeping the estimate separate from provider token accounting.

Testing

  • bun typecheck
  • bun run test

@github-actions github-actions 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.

Findings

  • None.

Summary

Review mode: initial

No issues found in the added or modified lines. Residual risk: the full automated test job was still pending at review time; static validation covered the Pi converter and send path, web usage normalization, and hub usage accounting.

Testing

  • Not run (automation). GitHub integration passed; test was pending at review time.

HAPI Bot

@tiann
tiann merged commit 3a43624 into tiann:main Aug 19, 2026
3 checks passed
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(pi): refresh context usage immediately after compaction

2 participants