Conversation
Grok never sends ACP usage_update. Occupancy is _meta.totalTokens on session/update; the window comes from models_cache.json. Do not treat turn_completed.usage.totalTokens as occupancy — that is billed usage.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On Grok Build sessions the usage meter under the composer always showed 0, even after a turn had clearly filled the context window. Plan-limit rows (SuperGrok weekly, etc.) were fine; only the context-window row was empty.
Grok never sends ACP
usage_update. Live occupancy is_meta.totalTokenson everysession/update(latest-wins snapshot of how full the window is right now). The window size isinfo.context_windowin~/.grok/models_cache.json.turn_completed.usage.totalTokensis the turn's billed sum across model calls, not occupancy — using it would over-report.Verified against a live
updates.jsonl/signals.jsonpair:_meta.totalTokensmatchedcontextTokensUsed(e.g. 24095), whileturn_completed.usage.totalTokenswas the billing total (93005).Solution
_meta.totalTokenstoUsageUpdatedoccupancy, deduped so identical snapshots do not wake extra frames.models_cache.json, and from_x.ai/session/updateauto_compact_startedwhen a compact starts.turn_completed.usage.totalTokensso billed totals cannot clobber the meter.Checks
cargo test -p waku-core --lib driver::acp::tests::(21 passed, 3 ignored)cargo test -p waku-core --lib grok_(18 passed, includingreads_context_window_from_groks_model_cacheand the new occupancy tests)Waku Debug.appwith a Grok Build session after a settled turnDid not run the full CONTRIBUTING baseline (
protocol:check,@waku/clienttests). This change is the Grok ACP driver plusdocs/providers.md.