fix: default --no-auto-update off to fix Grok ACP startup on CLI v1.0.0 (#3390)

The released Grok CLI (v1.0.0, latest stable) does not recognize the
--no-auto-update flag and exits immediately with error: unexpected
argument. This causes Fusion to report 'ACP connection closed' when
spawning grok agent stdio.

buildGrokAcpArgs previously defaulted noAutoUpdate to true (via !==
false). Changed to opt-in (=== true) so the flag is only passed when
explicitly enabled. Updated acp-settings.test.ts assertions accordingly.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Bug Fixes**
  - Grok ACP startup no longer disables automatic updates by default.
- Automatic update prevention is applied only when explicitly enabled in
settings.
- **Tests**
- Updated startup argument validation to reflect the revised default
behavior.
- **Documentation**
  - Added release notes documenting the change.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: gsxdsm <gsxdsm@users.noreply.github.com>
This commit is contained in:
Drew Donaldson
2026-08-09 19:51:03 -04:00
committed by GitHub
parent 3766dfc2a7
commit a3e37757e6
3 changed files with 22 additions and 12 deletions

View File

@@ -0,0 +1,7 @@
---
"@runfusion/fusion": patch
---
summary: Fix Grok ACP startup by making --no-auto-update opt-in.
category: fix
dev: Released Grok CLI v1.0.0 rejects --no-auto-update; buildGrokAcpArgs now only pushes it when noAutoUpdate === true. Updated acp-settings.test.ts.

View File

@@ -9,23 +9,21 @@ import {
} from "../acp-settings.js";
describe("acp-settings", () => {
it("builds grok agent stdio args without -m when model is absent", () => {
// Official docs: --no-auto-update for automated ACP/headless clients.
expect(buildGrokAcpArgs()).toEqual(["--no-auto-update", "agent", "stdio"]);
expect(buildGrokAcpArgs({})).toEqual(["--no-auto-update", "agent", "stdio"]);
expect(buildGrokAcpArgs({ noAutoUpdate: false })).toEqual(["agent", "stdio"]);
it("builds grok agent stdio args without --no-auto-update by default (Grok CLI v1.0.0 rejects the flag)", () => {
// --no-auto-update is opt-in only; the released Grok CLI does not support it.
expect(buildGrokAcpArgs()).toEqual(["agent", "stdio"]);
expect(buildGrokAcpArgs({})).toEqual(["agent", "stdio"]);
expect(buildGrokAcpArgs({ noAutoUpdate: true })).toEqual(["--no-auto-update", "agent", "stdio"]);
});
it("places plugin-dir and -m before the stdio subcommand", () => {
expect(buildGrokAcpArgs({ model: "grok-4.5" })).toEqual([
"--no-auto-update",
"agent",
"-m",
"grok-4.5",
"stdio",
]);
expect(buildGrokAcpArgs({ model: "grok-4.5", pluginDirs: ["/tmp/skills-plugin"] })).toEqual([
"--no-auto-update",
"agent",
"--plugin-dir",
"/tmp/skills-plugin",
@@ -59,7 +57,7 @@ describe("acp-settings", () => {
it("builds AcpRuntimeAdapter settings for Grok ACP", () => {
const settings = buildGrokAcpRuntimeSettings({ binary: "/usr/local/bin/grok", model: "grok-cli/grok-4.5" });
expect(settings.acpBinaryPath).toBe("/usr/local/bin/grok");
expect(settings.acpArgs).toEqual(["--no-auto-update", "agent", "-m", "grok-4.5", "stdio"]);
expect(settings.acpArgs).toEqual(["agent", "-m", "grok-4.5", "stdio"]);
expect(settings.acpEnvAllowList).toEqual([...GROK_ACP_ENV_ALLOWLIST]);
expect(settings.acpFsRead).toBe(false);
expect(settings.acpFsWrite).toBe(false);

View File

@@ -68,8 +68,13 @@ export function resolveGrokAcpAuthPreferMethods(
* Official headless/ACP scripting docs recommend `--no-auto-update` for CI and
* automated clients (https://docs.x.ai/build/cli/headless-scripting). Place it
* before the `agent` subcommand: `grok --no-auto-update agent … stdio`.
* Model / plugin-dir flags belong on `grok agent` before the transport:
* `grok --no-auto-update agent [--plugin-dir <dir>…] [-m <model>] stdio`.
*
* FNXC:GrokAcp 2026-08-09-00:00:
* The released Grok CLI (v1.0.0, latest stable) does not recognize
* `--no-auto-update` and exits immediately with "unexpected argument".
* Default is now OFF; callers must opt in via noAutoUpdate:true. Fusion
* manages its own update cycle, so disabling auto-update in the subprocess
* is unnecessary and breaks startup for all users on current Grok CLI.
*/
export function buildGrokAcpArgs(options?: {
model?: string;
@@ -77,8 +82,8 @@ export function buildGrokAcpArgs(options?: {
noAutoUpdate?: boolean;
}): string[] {
const args: string[] = [];
// Default ON for Fusion automation; callers can pass noAutoUpdate:false.
if (options?.noAutoUpdate !== false) {
// Default OFF — Grok CLI v1.0.0 rejects --no-auto-update (unknown flag).
if (options?.noAutoUpdate === true) {
args.push("--no-auto-update");
}
args.push("agent");