Skip to content
Source
Sign inSign up
pingdotgg/t3code

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

ClosedEnzoTironi(GitHub profile, opens in a new tab)wants to merge 2 commits intomain fromrefs/pull/5422/headopened View on GitHub

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_update → thread.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: /compact → auto_compact_completed, prompt _meta token usage, init availableCommands, unsolicited JSON-RPC responses, and session_info_update.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit a45fb3d0739e4d1bead42c07b4c58f5e64b8ea6d. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

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.
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      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.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    3. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      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](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. 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](https://www.cursor.com/dashboard/bugbot). Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit c1292f163c7a7c5e3c79b43135a70ae44711e5c6. Configure [here](https://www.cursor.com/dashboard/bugbot).
    5. 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).

Sign in to join this conversation.