Repository navigation
Description
Before submitting
- I searched existing issues and did not find an active duplicate.
- I included enough detail to reproduce or investigate the problem.
Related work: the broader #5418 is closed, and #5405 is an open pre-#8358 implementation PR.
Area
apps/server
Steps to reproduce
- Run a T3 Code build containing fix(grok): improve skills, plans, usage, and turn reliability #8358.
- Start a Grok thread with a model that advertises
_meta.totalContextTokensover ACP. - Send a prompt and wait for Grok to report
_meta.totalTokensinsession/updateor the final prompt response. - Inspect the context-window meter beside the composer.
Expected behavior
Grok threads should show the existing context-window meter with used tokens, maximum tokens, and fill percentage, matching Codex and other providers. The value should update when Grok reports a newer usage snapshot.
Actual behavior
The meter is absent for Grok threads.
#8358 added Grok token and cost records to the historical Usage page by parsing updates.jsonl. That is a separate pipeline. The live Grok adapter still does not emit thread.token-usage.updated, so the existing ingestion path never creates context-window.updated activity for the composer.
Impact
Minor bug or occasional failure
The failure is consistent, but it does not block a turn. Users cannot see when a long Grok thread is approaching its context limit or decide when to compact or start a new thread.
Version or commit
main after #8358 (ead4ce52a1624d9c55461f61524580978fc8b719)
Environment
Web or desktop client with the Grok provider.
Logs or stack traces
No error is shown. This is a missing provider-runtime event.
Technical notes
ProviderRuntimeIngestionalready mapsthread.token-usage.updatedtocontext-window.updated.ContextWindowMeteralready renders that activity. No new UI component is needed.- Grok exposes context fill through ACP
_meta.totalTokensand model capacity throughavailableModels[]._meta.totalContextTokens. A standard ACPusage_updateshould also be accepted when available. - fix(grok): surface context window usage in the composer #5405 demonstrates the intended behavior and contains focused tests, but it predates fix(grok): improve skills, plans, usage, and turn reliability #8358 and should be rebased or manually ported rather than merged unchanged.
- Keep the change on top of fix(grok): improve skills, plans, usage, and turn reliability #8358's current
AcpRuntimeModel,GrokAcpSupport, andGrokAdapterstructure.
Acceptance criteria
- A usage-bearing Grok notification or completed prompt emits a positive
thread.token-usage.updatedsnapshot. - The snapshot includes the active model's context-window maximum when Grok advertises it.
- The existing composer meter appears and updates for Grok threads.
- Interrupted turns do not overwrite the last valid context snapshot.
- Focused adapter and ingestion tests prove the public event and visible activity contract.
Workaround
There is no in-app workaround. Users can inspect Grok directly or start a new thread conservatively.
Activity
theman6660 commentedon Sep 2, 2026
Confirmed on a live Grok ACP session with the current CLI.
Grok still does not emit
sessionUpdate: "usage_update". The composer meter stays empty because the live adapter never publishesthread.token-usage.updated.What does work for occupancy:
session/update_meta.totalTokensis the context fill. A greeting turn was 1615; a long thread sat around 199k–210k.signals.jsonrecordscontextWindowTokens: 500000._meta.totalTokensonto the existingthread.token-usage.updated→context-window.updatedpath is enough forContextWindowMeter. No new UI.What does not work for the meter:
usage.totalTokens/_meta.usageis billed API tokens, not context occupancy. Same greeting: 20554 billed vs 1615 occupancy. Using that as an end-of-turn snapshot overwrites the correct number.#5405 already maps
_meta.totalTokens(the right source) and also prompt-response usage (the source to drop). Happy to help rebase or retest against currentGrokAdapterif that is useful.Squashed '.repos/effect-smol/' changes from a43c7e244c..e17ecdbe90