feat(grok): native ACP parity (catalog, effort, usage, plan, multi-agent, compact) - #5503
feat(grok): native ACP parity (catalog, effort, usage, plan, multi-agent, compact)#5503EnzoTironi wants to merge 7 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 introduces substantial new Grok integration features (plan mode, multi-agent visibility, usage tracking, slash commands) with ~3000 lines of new runtime behavior and state management. Additionally, an unresolved high-severity bug was identified regarding plan mode state handling. You can customize Macroscope's approvability policy. Learn more. |
- Skip set_model when effort matches currentEffort; no-op when model id missing - Session model context windows win over initializeMeta for the same modelId - Require encoded-cwd/session-id segments for Grok plan.md paths - Prefix /default when leaving plan mode for Build
clearProposedPlanFallback only drops turn-scoped plan.md fallback. Clearing planModeActive there made every new sendTurn see plan mode as off, so Build never emitted /default after a Plan turn.
- Skip plan/default prefix when prompt is already a slash command (/compact etc.) so Grok still dispatches on the real leading token - Validate initialize modelState entries (reject null/missing modelId|name) and skip bad entries in discovery so health check falls back cleanly - Apply planModeActive enter/exit only after successful session/prompt so prep/send failures cannot desync local state from Grok
300d888 to
d91dabf
Compare
- Match only exactly two segments after .grok/sessions/ for plan.md so nested workspace paths cannot surface as the agent plan - Distinguish missing vs present-empty initialize availableCommands and publish empty catalogs so a later session clears stale slash commands
Live config_option_update notifications only emitted ConfigOptionsUpdated; getConfigOptions/validate/setConfigOption kept the setup snapshot. Write upd.configOptions into configOptionsRef when the event is handled.
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 aa9ae80. Configure here.
| // prep or send cannot leave local planModeActive desynced from Grok. | ||
| if (prepared.planModeUpdate !== undefined) { | ||
| ctx.planModeActive = prepared.planModeUpdate; | ||
| } |
There was a problem hiding this comment.
Plan flag revived after exit
High Severity
exit_plan_mode clears planModeActive, but a successful /plan turn then applies planModeUpdate: true and turns it back on. The field docs say plan mode ends when exit_plan_mode resolves, so the next Build turn incorrectly prefixes /default onto the implementation prompt after Grok already left plan mode.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit aa9ae80. Configure here.


What Changed
Grok provider ACP parity (self-contained branch: shared parser commit + Grok adapter commit):
session/updatekinds → typed events;set_model_metapass-through (#5422 same commits)/compactalways presentsession/set_model_meta.reasoningEffort(no process restart)_meta+ usage_update → context meter; per-model windows; idempotent/plantext; Plan/Build toggle for Grokexit_plan_mode→ proposed-plan card + abandoned capture; sessionplan.mdonly under~/.grok/sessions/spawn_subagent→task.*with unique stamps + dedupe/compact+auto_compact_completed→ compacted work-log rowFixes #5417 #5418 #5419 #5420.
Merge note: Prefer merging #5422 first (shared parser only, size L), then this. If maintainers want one PR, this tip already contains both commits and can land alone.
Why
Grok Build already exposes these on the wire. T3 left them dark while Claude/Codex surface them. One adapter-boundary PR avoids unmergeable half-states from mid-file splits.
Related: #5403 #5405 #5409 #5412 #5131 — this tip absorbs those lakes with review fixes.
UI Changes
Uses existing Traits / meter / proposed-plan / task rows / Plan toggle — no new chrome.
Grok selected with effort menu
Plan mode toggle
Slash menu: /plan (built-in) + /compact (provider)
Checklist
Out of scope
Test plan
Model: grok-4.5 (Grok Build)
Note
Medium Risk
Large, behavior-rich changes to the Grok adapter and shared ACP parsing affect turn lifecycle, prompts, and provider snapshots; risk is mitigated by extensive tests but regressions could affect non-Grok ACP consumers of the shared parser.
Overview
Grok provider now maps live Grok ACP behavior into existing T3 UI (context meter, Plan/Build, proposed-plan cards, task rows, slash/skills) instead of leaving those wire events unused.
The shared ACP layer gains parsers and events for thought chunks, usage, command/config/session-info updates, and optional
streamKindon content deltas;session/set_modelcan pass through_meta(used for reasoning effort).GrokAdapter wires xAI extensions: prompt
_metaandusage_update→thread.token-usage.updated;session_info_update→ thread titles;auto_compact_completed→ compacted state;exit_plan_mode→ proposed-plan capture without hanging the turn;spawn_subagent→task.*; plan mode via/planand/defaulton send (after successful prompt). Mid-thread reasoning effort usessession/set_model_meta.reasoningEffortwithout restarting the child process.GrokDriver / GrokProvider push live slash/skills catalogs (including authoritative empty clears), always retain static
/compact, discover model Reasoning options from metadata, setrequiresNewThreadForModelChange: false, enable the interaction-mode toggle, and refresh snapshots on catalog updates—not only health probes.The ACP mock agent and broad unit/integration tests exercise the new paths.
Reviewed by Cursor Bugbot for commit aa9ae80. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add native ACP parity to Grok provider with catalog, effort, usage, plan, multi-agent, and compact support
thread.token-usage.updatedevents from both prompt RPC metadata andUsageUpdatedsession events, includingmaxTokenswhen available.--reasoning-effortand--modelflags via GrokAcpSupport.ts, and mid-thread effort changes are applied viasetSessionModelorsetConfigOptionwithout restarting the process.availableCommandsfrom ACP initialize_metaand liveavailable_commands_updateevents, surfacing slash commands and skills in all provider snapshots including a static/compactcommand.task.started/task.completedevents; tracks plan mode entry/exit viaenter_plan_modetool calls andexit_plan_modeRPC, emittingturn.proposed.completedwith plan markdown.x.aisession_notificationwithauto_compact_completedtothread.state.changed; mapssession_info_updatetitles tothread.metadata.updated.Ref/PubSubpair.Macroscope summarized aa9ae80.