Skip to content

fix(grok): forward role-specific model config to the Grok Build CLI#3004

Open
krishrathi1 wants to merge 2 commits into
AgentWrapper:mainfrom
krishrathi1:fix/grok-model-config
Open

fix(grok): forward role-specific model config to the Grok Build CLI#3004
krishrathi1 wants to merge 2 commits into
AgentWrapper:mainfrom
krishrathi1:fix/grok-model-config

Conversation

@krishrathi1

Copy link
Copy Markdown
Contributor

Summary

The Grok Build adapter's GetLaunchCommand and GetRestoreCommand never read cfg.Config.Model, so a project's per-role agentConfig.model was silently dropped and Grok Build workers/orchestrators always launched on Grok's own global default model instead of the configured one.

This mirrors the pattern already applied to the Codex (#2869), Cline (#2894, #2953), Goose (#2885, #2956), and Autohand (#2889, #2993) adapters: append a trimmed --model flag on both the launch and restore argv when a model is configured, and advertise the field via GetConfigSpec so it shows up in project config UI/validation.

Fixes #2886

Changes

  • backend/internal/adapters/agent/grok/grok.go: add an appendModelFlag helper, call it from GetLaunchCommand and GetRestoreCommand (right after the approval-mode flags), and override GetConfigSpec to advertise the model field (previously inherited the empty default from agentbase.Base).
  • backend/internal/adapters/agent/grok/grok_test.go: replace the now-stale TestGetConfigSpecEmpty with TestGetConfigSpecReportsModelField, and add regression tests for: trimmed model appended on launch, blank model omitted on launch, and trimmed model appended on restore.

Test plan

  • go build ./... passes
  • go vet ./internal/adapters/agent/grok/... passes
  • go test ./internal/adapters/agent/grok/... — all new/updated tests pass (pre-existing unrelated failures on this Windows dev box: TestGrokLocalAuthStatusAuthorizedWithAuthFile / TestGrokLocalAuthStatusUnauthorizedWithEmptyAuthFile, both failing identically on main before this change due to a local HOME/config-path environment quirk, not this change)

GetLaunchCommand and GetRestoreCommand never read cfg.Config.Model, so a
project's per-role agentConfig.model was silently dropped and Grok Build
always launched on its own global default model instead of the configured
one.

Mirrors the pattern used by the Codex (AgentWrapper#2869), Cline (AgentWrapper#2894), Goose (AgentWrapper#2885),
and Autohand (AgentWrapper#2889) adapters: append a trimmed --model flag on both the
launch and restore argv, and advertise the field via GetConfigSpec.

Fixes AgentWrapper#2886
@krishrathi1

Copy link
Copy Markdown
Contributor Author

@Vaibhaav-Tiwari broo look for this changes

Comment thread backend/internal/adapters/agent/grok/grok.go Outdated
@somewherelostt

Copy link
Copy Markdown
Collaborator

Thanks for contributing to Agent Orchestrator.

This PR is being picked up by the current external contributor on-call pair:

If someone is already working on this, please continue as usual.
The on-call pair is added for visibility, tracking, and support, not to take over the work.
If you need help with review, direction, reproduction, or next steps, please tag @illegalcall and @Pulkit7070 here.

For faster context or live questions, you can also join the AO Discord.

Join the session here:
https://discord.gg/H6ZDcUXmq

Come by if you want to see what is being built, ask questions, or just hang around with the community.

Review feedback on AgentWrapper#3004 pointed out --model had no citation, unlike the
--permission-mode flags above it which cite `grok -h`. The only source for
--model was a third-party CLI cheat sheet.

docs.x.ai/build/overview documents -m as the flag to "pick the model in
headless mode or in the TUI" (`grok -p "Hello" -m my-model`), with no
--model long form mentioned. Switch to the officially documented flag and
cite the source in the doc comment.
@krishrathi1

Copy link
Copy Markdown
Contributor Author

@Vaibhaav-Tiwari please review these changes ....!!!

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.

Grok Build ignores role-specific model config on launch

4 participants