Skip to content

feat(server): ACP sessionUpdate parity for Grok clients - #5422

Closed
EnzoTironi wants to merge 2 commits into
pingdotgg:mainfrom
EnzoTironi:pr/grok-acp-parser
Closed

feat(server): ACP sessionUpdate parity for Grok clients#5422
EnzoTironi wants to merge 2 commits into
pingdotgg:mainfrom
EnzoTironi:pr/grok-acp-parser

Conversation

@EnzoTironi

@EnzoTironi EnzoTironi commented Aug 5, 2026

Copy link
Copy Markdown

What Changed

Shared ACP session/update parsing 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_updatethread.token-usage.updated via makeAcpTokenUsageEvent
  • available_commands_update, config_option_update, session_info_update, user_message_chunk
  • UnknownSessionUpdate fallback for forward compatibility
  • session/set_model optional _meta pass-through (needed by Grok effort)
  • acp-mock-agent toggles for Grok-shaped session behavior

Fixes #5417

Why

Live grok agent stdio already emits these update kinds. Without shared parser coverage, each provider adapter drops them or casts ad hoc. Putting the model in AcpRuntimeModel / AcpCoreRuntimeEvents keeps orchestration pure.

UI Changes

None (server/shared ACP only).

Checklist

  • This PR is small and focused (~+379 / 6 files)
  • I explained what changed and why
  • UI screenshots N/A
  • Video N/A

Test plan

  • AcpRuntimeModel / AcpCoreRuntimeEvents unit tests
  • Live Grok 0.2.x initialize/session on macOS

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/update handling in line with what live Grok already emits, so updates are parsed into typed events instead of being dropped.

AcpRuntimeModel now recognizes agent_thought_chunk (reasoning via streamKind: reasoning_text), usage_update, available_commands_update, config_option_update, session_info_update, user_message_chunk, and an UnknownSessionUpdate fallback. makeAcpTokenUsageEvent maps usage into thread.token-usage.updated, and makeAcpContentDeltaEvent honors an optional streamKind.

CursorAdapter forwards UsageUpdated and reasoning ContentDelta into those helpers. AcpSessionRuntime exposes authenticateResult on start and passes optional _meta through session/set_model (e.g. Grok reasoning effort).

acp-mock-agent gains Grok-shaped toggles: /compactauto_compact_completed, prompt _meta token usage, init availableCommands, unsolicited JSON-RPC responses, and session_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

  • Extends parseSessionUpdateEvent in 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 include rawPayload.
  • Adds makeAcpTokenUsageEvent factory in AcpCoreRuntimeEvents.ts to emit thread.token-usage.updated events with token breakdown fields; extends makeAcpContentDeltaEvent with an optional streamKind (assistant_text | reasoning_text).
  • Updates CursorAdapter.ts to handle UsageUpdated events by publishing thread.token-usage.updated and to pass streamKind/rawPayload through ContentDelta events.
  • Exposes authenticateResult from AcpSessionRuntime.start() and adds _meta passthrough to setSessionModel.
  • Updates the ACP mock agent script to handle /compact prompts, emit optional session_info_update, and return usage metadata on prompt responses.

Macroscope summarized a45fb3d.

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: eec28603-fc05-48a5-9415-72beeee352c8

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added size:L 100-499 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels Aug 5, 2026
@macroscopeapp

macroscopeapp Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: 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.

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ 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.

Comment thread apps/server/src/provider/acp/AcpCoreRuntimeEvents.ts
CursorAdapter now maps usage_update → thread.token-usage.updated via the
shared factory (same consumer pattern as ContentDelta/streamKind).
@EnzoTironi EnzoTironi closed this by deleting the head repository Aug 6, 2026
@EnzoTironi

Copy link
Copy Markdown
Author

Head fork was deleted and GitHub closed this PR permanently (cannot reopen).

Correct recovery PR: pull request title must not be blank

Same commits/branch tip as this one. #5424 and #5425 stay closed on purpose (absorbed into the Grok native parity PR).

@EnzoTironi

Copy link
Copy Markdown
Author

Correction — recovery PR is: #5502

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Grok/ACP: sessionUpdate parity for live Grok agent stdio

1 participant