mirror of
https://github.com/NanmiCoder/cc-haha
synced 2026-07-16 13:03:31 +08:00
Context inspection was switching from the local context estimate to the latest provider usage total once a response completed. That provider total omitted the assistant output tokens, even though those tokens become part of the next turn's context, so the desktop meter could fall from 11% to 10% after work finished. The context total now includes output tokens and keeps the local estimate as a lower bound. Constraint: Provider usage and local context estimates use different token accounting paths Rejected: Trust provider input tokens alone | it omits the latest assistant output from the next-turn context Confidence: high Scope-risk: narrow Directive: Context usage totals must represent the next-turn conversation context, not billing-only input tokens Tested: bun test src/utils/__tests__/context.test.ts Tested: bun run check:server