Skip to content

feat(grok): support ACP model switching#2903

Open
janburzinski wants to merge 6 commits into
mainfrom
emdash/grok-model-switching
Open

feat(grok): support ACP model switching#2903
janburzinski wants to merge 6 commits into
mainfrom
emdash/grok-model-switching

Conversation

@janburzinski

@janburzinski janburzinski commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

Description

Add model switching for Grok ACP sessions by normalizing Grok's model state into ACP config options and translating model changes to session/set_model.

The chat composer now keeps model changes serialized, blocks prompts while a switch is pending, shows progress, and rolls back cleanly when the change fails.

Switching between Composer 2.5 and Grok 4.5 took roughly eight seconds in local testing because Grok rebuilds its harness and re-registers skills and MCP servers during session/set_model. The pending state makes that provider-side work visible and prevents prompts from racing the harness rebuild.

Screen recording

https://cap.link/q82zyr2dpw269fj

Checklist
  • I kept this PR small and focused
  • I ran a self-review before opening this PR
  • I ran the relevant local checks or explained why not
  • I added or updated tests when behavior changed
  • I only added comments where the logic is not obvious
  • I used Conventional Commits for commit messages and the PR title

@janburzinski

Copy link
Copy Markdown
Collaborator Author

@greptileai

@greptile-apps

greptile-apps Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds model switching for Grok ACP sessions. The main changes are:

  • Normalizes Grok model state into ACP configuration options.
  • Translates model changes into session/set_model requests.
  • Blocks prompt submission and shows progress while a model switch is pending.
  • Reconciles model and attachment state after asynchronous operations.
  • Adds tests for model switching, rollback, fallback models, and disposal.

Confidence Score: 5/5

This looks safe to merge.

  • The updated attachment flow excludes removed items and preserves attachments added during prompt preparation.
  • Model selection returns to confirmed session state after success or failure.
  • No blocking issues were found in the changed code.

Important Files Changed

Filename Overview
apps/emdash-desktop/src/renderer/features/conversations/acp/acp-chat-panel.tsx Synchronizes attachment state during asynchronous prompt preparation and displays model-switch progress.
apps/emdash-desktop/src/renderer/features/conversations/acp/acp-chat-store.ts Serializes model changes, blocks prompts during transitions, and clears optimistic state after completion or failure.
packages/plugins/src/agents/impl/grok/acp.ts Adds the Grok-specific ACP adapter for model normalization and session/set_model requests.
packages/ui/src/react/components/chat-composer/index.tsx Disables model and send controls while a model change is pending and renders a progress indicator.

Reviews (3): Last reviewed commit: "fix(chat): resolve ACP submission races" | Re-trigger Greptile

Comment thread apps/emdash-desktop/src/renderer/features/conversations/acp/acp-chat-panel.tsx Outdated
Comment thread apps/emdash-desktop/src/renderer/features/conversations/acp/acp-chat-store.ts Outdated
@janburzinski
janburzinski marked this pull request as ready for review July 17, 2026 16:06
@janburzinski

Copy link
Copy Markdown
Collaborator Author

@greptileai

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Found two blocking regressions in the core switching/submission paths, plus one model-ID normalization issue. The existing format check passes, but these behaviors are not covered by the added tests.

Open in Web View Automation 

Sent by Cursor Automation: Untitled

Comment thread packages/plugins/src/agents/impl/grok/acp.ts
Comment thread apps/emdash-desktop/src/renderer/features/conversations/acp/acp-chat-panel.tsx Outdated
Comment thread packages/plugins/src/agents/impl/grok/acp.ts
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.

1 participant