feat(server): ACP sessionUpdate parity for Grok clients - #5502
feat(server): ACP sessionUpdate parity for Grok clients#5502EnzoTironi wants to merge 3 commits into
Conversation
CursorAdapter now maps usage_update → thread.token-usage.updated via the shared factory (same consumer pattern as ContentDelta/streamKind).
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ApprovabilityVerdict: Needs human review This PR introduces a new feature adding multiple new session update event types (usage, commands, config, session info, thought chunks) with parsing logic and runtime integration across several layers. The scope and new capability introduced warrant human review. You can customize Macroscope's approvability policy. Learn more. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit a45fb3d. Configure here.
…flag Refresh configOptionsRef when config_option_update arrives so validation and getConfigOptions stay live. Stop hardcoding compactsAutomatically on generic ACP token usage events; only set it when the caller knows auto-compact.

What Changed
Shared ACP
session/updateparsing so live Grok (and other ACP clients) map into typed runtime events instead of being dropped:agent_thought_chunk→ reasoning stream (streamKind: reasoning_text)usage_update→thread.token-usage.updatedviamakeAcpTokenUsageEventavailable_commands_update,config_option_update,session_info_update,user_message_chunkUnknownSessionUpdatefallback for forward compatibilitysession/set_modeloptional_metapass-through (needed by Grok effort)Fixes #5417
Why
Live
grok agent stdioalready emits these update kinds. Without shared parser coverage, each provider adapter drops them or casts ad hoc. Putting the model inAcpRuntimeModel/AcpCoreRuntimeEventskeeps orchestration pure.UI Changes
None (server/shared ACP only).
Checklist
Test plan
Model: grok-4.5 (Grok Build)
Note
Medium Risk
Touches core ACP event parsing and Cursor runtime event emission for token usage and streaming; behavior changes for live ACP sessions but scope is server-only with unit test coverage.
Overview
Extends shared ACP
session/updatehandling so Grok-shaped agents no longer drop common update kinds.parseSessionUpdateEventnow emits typed events for reasoning chunks (agent_thought_chunk→ContentDeltawithstreamKind: reasoning_text), token usage, slash commands, live config options, session title/metadata, and user echo chunks, with anUnknownSessionUpdatefallback for forward compatibility.Adds
makeAcpTokenUsageEventand optionalstreamKindonmakeAcpContentDeltaEventso adapters can publishthread.token-usage.updatedand distinguish assistant vs reasoning text. CursorAdapter wiresUsageUpdatedthrough that helper and forwardsstreamKind/rawPayloadon content deltas.AcpSessionRuntimenow returnsauthenticateResultfrom startup, passes optional_metaonsession/set_model, and refreshesconfigOptionsRefwhenconfig_option_updatearrives so config validation stays current. The acp-mock-agent gains Grok-like toggles (/compact, session info, usage on prompt result, init commands, non-numeric JSON-RPC id).Reviewed by Cursor Bugbot for commit 6fbe75f. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add ACP sessionUpdate parity for Grok clients with token usage, thought chunks, and session info events
AcpRuntimeModel.tsto parse additional ACP session update types:agent_thought_chunk,user_message_chunk,usage_update,available_commands_update,config_option_update, andsession_info_update, plus anUnknownSessionUpdatefallback.makeAcpTokenUsageEventfactory inAcpCoreRuntimeEvents.tsto producethread.token-usage.updatedruntime events;makeAcpContentDeltaEventnow accepts an optionalstreamKindto distinguishassistant_textfromreasoning_text.UsageUpdatedandContentDelta(withstreamKind/rawPayload) through theCursorAdapterso token usage and stream kind reach the event stream.AcpSessionRuntime.tsto returnauthenticateResultfromstart(), keepconfigOptionsRefin sync on live updates, and forward optional_metainsetSessionModel.acp-mock-agent.tsto simulate/compactcommands,session_info_updatenotifications, skills-reload responses, and token usage fields in prompt responses.Macroscope summarized 6fbe75f.