Skip to content

feat(providers): add first-class Grok ACP client#2378

Closed
JOUYO wants to merge 1 commit into
getpaseo:mainfrom
JOUYO:feat/grok-acp-provider
Closed

feat(providers): add first-class Grok ACP client#2378
JOUYO wants to merge 1 commit into
getpaseo:mainfrom
JOUYO:feat/grok-acp-provider

Conversation

@JOUYO

@JOUYO JOUYO commented Jul 23, 2026

Copy link
Copy Markdown

Linked issue

Closes #2375

Related: #2053

Type of change

  • Bug fix
  • New feature (with prior issue + design alignment)
  • Refactor / code improvement
  • Docs

What does this PR do

Adds a dedicated GrokACPAgentClient instead of treating Grok as a plain generic ACP provider:

  • Modes: Ask before tools, Always approve, Plan, Full access
  • Launch-only mode/model/thinking config + Grok CLI launch args (--model, --reasoning-effort, --permission-mode, sandbox)
  • Context usage resolver from Grok CLI signals.json when ACP usage updates are missing
  • ACP base hooks needed by Grok (contextUsageResolver, sessionLaunchArgs, launchOnlyConfig, autoApprovePermissionModes)

How did you verify it

  • npx vitest run packages/server/src/server/agent/providers/grok-acp-agent.test.ts packages/server/src/server/agent/providers/grok-context-usage.test.ts --bail=1 (5 passed)
  • npm run typecheck --workspace=@getpaseo/server
  • Manual: create a Grok agent, use Always approve / Full access, confirm context meter updates from session signals
  • lint/format/typecheck via pre-commit hook

Checklist

  • One focused change. Unrelated cleanups split out.
  • npm run typecheck passes
  • npm run lint passes
  • Linked issue present for bug fix / behavior change
  • Verification section filled with what I actually ran

Made with Cursor

Register a dedicated Grok ACP provider with Always approve / Plan /
Full access modes, Grok-specific launch args, and context usage from
CLI session signals when ACP omits usage updates.

Co-authored-by: Cursor <cursoragent@cursor.com>
@greptile-apps

greptile-apps Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds a dedicated Grok ACP provider integration.

  • Registers Grok-specific provider construction and modes.
  • Adds launch-time model, reasoning-effort, permission-mode, and sandbox arguments.
  • Extends the generic ACP client with launch-only configuration, permission auto-approval, model metadata, persistence metadata, and context-usage hooks.
  • Reads Grok context usage from local session signals when ACP usage is incomplete.
  • Adds focused tests for Grok launch arguments, model metadata, and signal parsing.

Confidence Score: 3/5

The PR should not merge until live Grok configuration changes either take effect or are rejected instead of being reported as active.

Grok encodes mode, model, and reasoning effort only at process launch, but the new live-session branches mutate, emit, and persist those values without restarting or reconfiguring the child process.

packages/server/src/server/agent/providers/acp-agent.ts, packages/server/src/server/agent/providers/grok-acp-agent.ts

Important Files Changed

Filename Overview
packages/server/src/server/agent/providers/acp-agent.ts Adds reusable ACP hooks, but launch-only setters can report configuration changes that were never applied to the running process.
packages/server/src/server/agent/providers/grok-acp-agent.ts Defines Grok modes, model metadata, and launch arguments; its launch-only configuration exposes the runtime-state mismatch.
packages/server/src/server/agent/providers/grok-context-usage.ts Adds a guarded fallback that reads Grok session context counters from signals.json.
packages/server/src/server/agent/provider-registry.ts Routes the exact grok provider identifier to the dedicated ACP client.
packages/server/src/server/agent/providers/generic-acp-agent.ts Passes the new generic ACP extension hooks through to the base client.

Sequence Diagram

sequenceDiagram
  participant Client
  participant Session as ACPAgentSession
  participant Grok as Grok CLI process
  Client->>Session: Create session with mode/model/effort
  Session->>Grok: Spawn with launch arguments
  Client->>Session: Change mode/model/effort
  Session-->>Client: Emit changed runtime state
  Note over Session,Grok: Running process is not restarted or reconfigured
  Client->>Session: Send next prompt
  Session->>Grok: Prompt uses original launch configuration
Loading

Reviews (1): Last reviewed commit: "feat(providers): add first-class Grok AC..." | Re-trigger Greptile

Comment on lines +1739 to +1749
if (this.launchOnlyConfig.mode) {
if (modeId === this.currentMode) return;
this.currentMode = modeId;
this.config.modeId = modeId;
this.pushEvent({
type: "mode_changed",
provider: this.provider,
currentModeId: this.currentMode,
availableModes: [...this.availableModes],
});
return;

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.

P1 Launch-only state diverges from process

When a client changes a running Grok session's mode, model, or reasoning effort, these branches update, emit, and persist the new selection without restarting or reconfiguring the process, causing subsequent prompts to use the original launch configuration while the UI reports the new configuration as active.

Knowledge Base Used: Agent Orchestration

@JOUYO

JOUYO commented Jul 24, 2026

Copy link
Copy Markdown
Author

Superseded by #2385, which includes this change (and later polish) on current main.

@JOUYO JOUYO closed this Jul 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: first-class Grok ACP provider with modes and context usage

1 participant