Repository navigation
fix(native-chat): Grok chats run the saved Command and honor or refuse the saved Arguments - #26367
Closed
brennanb2025 wants to merge 4 commits into
Closed
brennanb2025 wants to merge 4 commits into
brennanb2025 wants to merge 4 commits into
Conversation
…e the saved Arguments A Grok chat always ran the stock `grok agent [--always-approve] stdio`: it ignored the Command setting, even one that named no program, and never read the saved Arguments beyond the permission posture, so a terminal's `-m grok-4`, `--debug` or `--cwd` silently did nothing in chat. The Command now resolves through the same resolver Claude and Codex chats use: blank runs the stock grok found on PATH or in $GROK_HOME/bin exactly as before, a set Command runs that program, and one that names no runnable program refuses the start with the existing Command copy. The saved Arguments, written for a terminal's `grok`, are placed where `grok agent` reads them: --debug, --debug-file, --leader-socket, --disable-web-search and --no-auto-update stay before `agent`; -m/--model, --effort and --no-leader move to the agent's own options. Permission options (--permission-mode, --always-approve, --allow/--deny, --sandbox, --trust), terminal-only ones and session/print options drop, since Agent Permissions and the chat own those. --cwd/--worktree, --leader, --rules, --system-prompt, --tools, prompts and unknown options refuse by name. Untouched Arguments launch exactly today's argv.
…gent reads, and refuse its login options
…'s, not the chat's
…nal sign-in options A saved `--debug-file=-grok.log` (any `--opt=value` whose value starts with `-`) was accepted and then handed to Grok as two tokens, which Grok's parser reads as a new option, so the chat failed to start with a raw error. A value written joined now reaches Grok joined, where it stays a value. `--oauth` and `--force-login` only shape the terminal's sign-in screen and `grok agent` never reads them, so they now drop like the other terminal-only options instead of refusing the chat. A test drives a refused Grok Argument and an unrunnable Command through the real launch resolver and the ACP start path to the refusal a client receives, before any spawn.
Contributor
Author
Review summaryProblem. Grok native chat ignored Settings → Agents → Command and Arguments:
User-facing change.
What review fixed (2 rounds plus readiness):
Design decisions:
Deferred:
Verified:
Not verified:
Stacking: this targets #26059's branch and is retargeted to |
6 of 7 tasks
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ELI5
Settings → Agents → Command and Arguments are shared by terminal tabs and native chat. Grok native chat ignored both:
grokfrom PATH, even when the saved Command pointed somewhere else or couldn't run;--model,--effortand the rest were silently dropped.Now Grok chat runs the saved Command, or refuses to start with the same message Claude and Codex chats show. Every saved Argument is applied the way a Grok terminal applies it, or refused by name.
Stacked on #26059 (the same change for Codex). It reuses that PR's refusal wording and unclosed-quote handling, and is retargeted to
mainafter #26059 merges.What Changed
Before (Grok native chat):
grok.After:
grokexactly as before, including the$GROK_HOME/binsearch. A test pins this on macOS and Linux.grok [options] agent [agent options] stdio, the only shape Grok's chat mode accepts:agent:--debug,--debug-file,--leader-socket,--disable-web-search,--no-auto-update,--compaction-mode,--compaction-detail,--log-sampling.agent, where Grok's chat mode reads them:-m/--model(refused if given twice),--effort/--reasoning-effort,--no-leader.--permission-mode,--always-approve/--yolo/--dangerously-skip-permissions,--allow,--deny,--sandbox,--trust.--oauth/--force-login, which only affect the terminal's sign-in screen.--cwdand--worktree, which get the hint "A chat already works in its workspace folder". Also--leader,--rules,--system-prompt,--tools, prompt text, unknown options, and an unclosed quote. An unclosed quote is refused by name when the host starts or restarts a chat. A NEW chat opened from the desktop tab bar is stopped earlier, by the shared terminal-launch planning, and shows main's toast "Could not build launch command for Grok." Terminal tabs behave the same way; this is the same follow-up noted in fix(native-chat): apply or refuse saved Codex Arguments instead of silently dropping them #26059.--no-memory,--no-subagents,--no-plan,--agent,--max-turnsand--disallowed-tools. These now stop the chat from starting and name the option. Before, a Grok chat ignored all Arguments and always started. Arguments are shared with Grok terminal tabs, so removing such an option there changes terminal tabs too.--modelonly sets the starting model for a chat with no pick; Orca re-applies the chat's saved model over the session after it opens.grok agent --always-approve stdiowhen the setting says full access.Why
Grok's chat mode honors only some of the options a terminal
grokaccepts, and it reads the model and effort only asagentoptions. So saved terminal Arguments need the same honor-or-refuse translation #26059 gives Codex, rather than being passed through raw or ignored. The common pattern for a Grok binary is a path setting, used as-is; for launch arguments to a stdio agent, it refuses reserved options by name and keeps the user's arguments after its own.Differences from the common pattern:
agent, and model, effort and--no-leadergo after it. Intended: this is the only placement Grok's chat mode reads.Temporary: until STA-9763, Grok chat under Ask follows the user's Grok config. With full access off, Orca passes Grok no permission mode, so a
~/.grokconfig that auto-approves still auto-approves in chat. Making Grok chat state its mode from the chat permission setting (Ask →--permission-mode default, Full access →agent --always-approve, plus the other modes) is owned by STA-9763, a follow-up of the chat permission setting work. This PR only changes Command and Arguments.Linked Issue
Follow-up to #25721, #25667 and #26059.
Visual Proof
QA ran on Windows (low spec), driven by a non-Claude agent over the DevTools protocol against a hidden window. The Grok agent was a stand-in that replays a recorded Grok session and logs its full command line. The box's real agent configs and its real
~/.grokwere unchanged at every step.Untouched settings start as before:


grok agent --always-approve stdio, found on PATH the way stockgrokis. Manual isagent stdio:A saved Command runs (quoted path with a space). An unrunnable Command refuses with the shared message, and nothing starts:


Arguments placed where Grok's chat mode reads them. Saved


--debug --disable-web-search -m qa-model --effort high --no-leader --sandbox read-only --oauth --resume xstartedgrok --debug --disable-web-search agent --model qa-model --reasoning-effort high --no-leader stdio. The sandbox, sign-in and resume flags were dropped. A joined--debug-file=-x.logstays joined:Refused by name (




--cwdwith the workspace hint,--no-memory,-mgiven twice). Nothing starts, and Retry works after fixing Arguments:The chat's model pick wins. After picking Grok 4.6, a new chat with saved


-m qa-otherstarts on qa-other, then switches to the picked model before replying:Testing
orca-ci-checks, which runs CI's lint, code-quality, localization and typecheck steps: 23/23 pass.Review
Pending.
Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
Grok. An older client doesn't recognize it. On a new chat it shows the generic "Chat could not be started." with Retry; in an existing chat, the status row and message cards show the host's full sentence.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)