feat(server): ACP sessionUpdate parity for Grok clients - #5422
feat(server): ACP sessionUpdate parity for Grok clients#5422EnzoTironi wants to merge 2 commits into
Conversation
|
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 adds new feature capability for handling Grok client session updates, introducing multiple new event types (usage, commands, config options, session info, reasoning tokens) and their parsing/runtime integration. New features that add runtime behavior warrant human review. You can customize Macroscope's approvability policy. Learn more. |
1a7aba3 to
c6f1f87
Compare
c6f1f87 to
c1292f1
Compare
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 c1292f1. Configure here.
CursorAdapter now maps usage_update → thread.token-usage.updated via the shared factory (same consumer pattern as ContentDelta/streamKind).
|
Correction — recovery PR is: #5502 |

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 shared ACP parsing and runtime events used by multiple provider adapters; behavior is covered by unit tests and limited adapter wiring, but incorrect mapping could affect token usage and streaming UI.
Overview
Brings shared ACP
session/updatehandling in line with what live Grok already emits, so updates are parsed into typed events instead of being dropped.AcpRuntimeModelnow recognizesagent_thought_chunk(reasoning viastreamKind: reasoning_text),usage_update,available_commands_update,config_option_update,session_info_update,user_message_chunk, and anUnknownSessionUpdatefallback.makeAcpTokenUsageEventmaps usage intothread.token-usage.updated, andmakeAcpContentDeltaEventhonors an optionalstreamKind.CursorAdapter forwards
UsageUpdatedand reasoningContentDeltainto those helpers.AcpSessionRuntimeexposesauthenticateResulton start and passes optional_metathroughsession/set_model(e.g. Grok reasoning effort).acp-mock-agentgains Grok-shaped toggles:/compact→auto_compact_completed, prompt_metatoken usage, initavailableCommands, unsolicited JSON-RPC responses, andsession_info_update.Reviewed by Cursor Bugbot for commit a45fb3d. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add ACP sessionUpdate parity for Grok clients including usage, reasoning, and session info events
parseSessionUpdateEventin AcpRuntimeModel.ts to parse additional ACP session events:agent_thought_chunk(reasoning text),usage_update,available_commands_update,session_info_update,user_message_chunk, and unknown updates. All events now includerawPayload.makeAcpTokenUsageEventfactory in AcpCoreRuntimeEvents.ts to emitthread.token-usage.updatedevents with token breakdown fields; extendsmakeAcpContentDeltaEventwith an optionalstreamKind(assistant_text|reasoning_text).UsageUpdatedevents by publishingthread.token-usage.updatedand to passstreamKind/rawPayloadthroughContentDeltaevents.authenticateResultfromAcpSessionRuntime.start()and adds_metapassthrough tosetSessionModel./compactprompts, emit optionalsession_info_update, and return usage metadata on prompt responses.Macroscope summarized a45fb3d.