Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions src/supervisor/agents/grok/argv.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ import { describe, expect, it } from "vitest";
import { buildGrokArgs, buildGrokAcpArgs } from "./argv";

describe("buildGrokArgs (TUI/PTY)", () => {
it("emits nothing for a bare default config", () => {
expect(buildGrokArgs({ mode: "agent" } as any, "", undefined)).toEqual([]);
it("disables auto-update for a bare default config", () => {
expect(buildGrokArgs({ mode: "agent" } as any, "", undefined)).toEqual(["--no-auto-update"]);
});

it("passes -r <id> when resuming a materialized session", () => {
expect(
buildGrokArgs({ mode: "agent" } as any, "", { kind: "resume", sessionId: "abc-123" }),
).toEqual(["-r", "abc-123"]);
).toEqual(["--no-auto-update", "-r", "abc-123"]);
});

it("passes -s <id> when pre-assigning a new session id", () => {
expect(
buildGrokArgs({ mode: "agent" } as any, "", { kind: "new", sessionId: "abc-123" }),
).toEqual(["-s", "abc-123"]);
).toEqual(["--no-auto-update", "-s", "abc-123"]);
});

it("never emits -c, --no-plan, or --permission-mode", () => {
Expand All @@ -35,6 +35,7 @@ describe("buildGrokArgs (TUI/PTY)", () => {

it("forwards config.effort as --reasoning-effort", () => {
expect(buildGrokArgs({ mode: "agent", effort: "low" } as any, "", undefined)).toEqual([
"--no-auto-update",
"--reasoning-effort",
"low",
]);
Expand All @@ -49,7 +50,7 @@ describe("buildGrokArgs (TUI/PTY)", () => {
it("adds --always-approve when approval policy bypasses permissions", () => {
expect(
buildGrokArgs({ mode: "agent", approvalPolicy: "bypassPermissions" } as any, "", undefined),
).toEqual(["--always-approve"]);
).toEqual(["--no-auto-update", "--always-approve"]);
});

it("treats legacy 'never' and 'yolo' policies as bypass", () => {
Expand All @@ -68,6 +69,7 @@ describe("buildGrokArgs (TUI/PTY)", () => {

it("passes -m <model> when set", () => {
expect(buildGrokArgs({ mode: "agent", model: "grok-4.5" } as any, "", undefined)).toEqual([
"--no-auto-update",
"-m",
"grok-4.5",
]);
Expand All @@ -86,6 +88,7 @@ describe("buildGrokArgs (TUI/PTY)", () => {
{ kind: "new", sessionId: "abc-123" },
),
).toEqual([
"--no-auto-update",
"-s",
"abc-123",
"-m",
Expand Down
2 changes: 1 addition & 1 deletion src/supervisor/agents/grok/argv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export function buildGrokArgs(
_prompt: string,
session?: GrokSessionArg,
): string[] {
const args: string[] = [];
const args = ["--no-auto-update"];

if (session?.kind === "resume") {
args.push("-r", session.sessionId);
Expand Down
17 changes: 9 additions & 8 deletions src/supervisor/agents/grok/grok.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,10 @@ describe("createGrokAdapter buildLaunchArgv / buildResumeArgv session flags", ()
it("pre-assigns a fresh UUID with -s and returns it as the session ref", () => {
const adapter = createGrokAdapter();
const result = adapter.buildLaunchArgv(location, config, "", undefined, {});
expect(result.args[0]).toBe("-s");
expect(result.args[1]).toMatch(UUID_RE);
expect(result.sessionRef?.providerSessionId).toBe(result.args[1]);
expect(result.args[0]).toBe("--no-auto-update");
expect(result.args[1]).toBe("-s");
expect(result.args[2]).toMatch(UUID_RE);
expect(result.sessionRef?.providerSessionId).toBe(result.args[2]);
});

it("resumes a known id with -r when the session dir has materialized", () => {
Expand All @@ -186,7 +187,7 @@ describe("createGrokAdapter buildLaunchArgv / buildResumeArgv session flags", ()
createKnownSessionRef(SESSION_ID),
{},
);
expect(result.args.slice(0, 2)).toEqual(["-r", SESSION_ID]);
expect(result.args.slice(0, 3)).toEqual(["--no-auto-update", "-r", SESSION_ID]);
expect(result.sessionRef?.providerSessionId).toBe(SESSION_ID);
});

Expand All @@ -199,7 +200,7 @@ describe("createGrokAdapter buildLaunchArgv / buildResumeArgv session flags", ()
createKnownSessionRef(SESSION_ID),
{},
);
expect(result.args.slice(0, 2)).toEqual(["-s", SESSION_ID]);
expect(result.args.slice(0, 3)).toEqual(["--no-auto-update", "-s", SESSION_ID]);
expect(result.sessionRef?.providerSessionId).toBe(SESSION_ID);
});

Expand All @@ -217,13 +218,13 @@ describe("createGrokAdapter buildLaunchArgv / buildResumeArgv session flags", ()
createKnownSessionRef(SESSION_ID),
{},
);
expect(result.args.slice(0, 2)).toEqual(["-r", SESSION_ID]);
expect(result.args.slice(0, 3)).toEqual(["--no-auto-update", "-r", SESSION_ID]);
});

it("buildResumeArgv applies the same materialization fallback", () => {
const adapter = createGrokAdapter();
const fresh = adapter.buildResumeArgv(location, config, "", createKnownSessionRef(SESSION_ID));
expect(fresh.args.slice(0, 2)).toEqual(["-s", SESSION_ID]);
expect(fresh.args.slice(0, 3)).toEqual(["--no-auto-update", "-s", SESSION_ID]);

mkdirSync(join(grokHome, "sessions", encodeURIComponent(projectDir), SESSION_ID), {
recursive: true,
Expand All @@ -234,7 +235,7 @@ describe("createGrokAdapter buildLaunchArgv / buildResumeArgv session flags", ()
"",
createKnownSessionRef(SESSION_ID),
);
expect(materialized.args.slice(0, 2)).toEqual(["-r", SESSION_ID]);
expect(materialized.args.slice(0, 3)).toEqual(["--no-auto-update", "-r", SESSION_ID]);
});

it("does not project custom MCP servers into Grok's global config", () => {
Expand Down