The open-source app everyone uses to manage agents at work
TypeScript acpxagent-orchestrationagent-skillsagentic-aiai-agentsai-engineeringai-governanceai-toolsautonomous-agentsclaudeclaude-codeclaude-skillscodexhermesllmmcpmulti-agentopenclawproject-managementworkflow-automation
fix(grok_local): do not warn when the default model sentinel is unavailable (#12062)
Devin Foley83fefaadd104
diff --git a/packages/adapters/grok-local/src/server/test.test.ts b/packages/adapters/grok-local/src/server/test.test.tsindex 6800744b6f..e2d9e495c7 100644--- a/packages/adapters/grok-local/src/server/test.test.ts+++ b/packages/adapters/grok-local/src/server/test.test.ts@@ -105,6 +105,84 @@ describe("grok_local testEnvironment", () => {);});+ it("does not warn when the default-sentinel model is absent from the real model list", async () => {+ // Real grok never lists the "grok-build" sentinel; execute.ts never sends+ // it. The probe must treat the default as valid (info), not warn.+ runProcessMock+ .mockResolvedValueOnce({+ exitCode: 0,+ signal: null,+ timedOut: false,+ stdout: [+ "You are logged in with grok.com.",+ "",+ "Default model: grok-4.20-0309-non-reasoning",+ "",+ "Available models:",+ " * grok-4.20-0309-non-reasoning (default)",+ " * grok-4",+ ].join("\n"),+ stderr: "",+ })+ .mockResolvedValueOnce({+ exitCode: 0,+ signal: null,+ timedOut: false,+ stdout: [+ JSON.stringify({ type: "text", data: "hello" }),+ JSON.stringify({ type: "end", stopReason: "EndTurn", sessionId: "s", requestId: "r" }),+ ].join("\n"),+ stderr: "",+ });++ const result = await testEnvironment({+ companyId: "company-1",+ adapterType: "grok_local",+ config: { command: "grok", cwd: "/tmp/project" }, // no model → default sentinel+ });++ const codes = result.checks.map((check: { code: string }) => check.code);+ expect(codes).toContain("grok_model_configured");+ expect(codes).not.toContain("grok_model_not_found");+ expect(result.status).toBe("pass");+ });++ it("warns when an explicitly configured real model is not available", async () => {+ runProcessMock+ .mockResolvedValueOnce({+ exitCode: 0,+ signal: null,+ timedOut: false,+ stdout: [+ "You are logged in with grok.com.",+ "",+ "Default model: grok-4",+ "",+ "Available models:",+ " * grok-4",+ ].join("\n"),+ stderr: "",+ })+ .mockResolvedValueOnce({+ exitCode: 0,+ signal: null,+ timedOut: false,+ stdout: [+ JSON.stringify({ type: "text", data: "hello" }),+ JSON.stringify({ type: "end", stopReason: "EndTurn", sessionId: "s", requestId: "r" }),+ ].join("\n"),+ stderr: "",+ });++ const result = await testEnvironment({+ companyId: "company-1",+ adapterType: "grok_local",+ config: { command: "grok", cwd: "/tmp/project", model: "grok-nonexistent" },+ });++ expect(result.checks.map((check: { code: string }) => check.code)).toContain("grok_model_not_found");+ });+it("downgrades auth failures to warnings", async () => {runProcessMock.mockResolvedValueOnce({diff --git a/packages/adapters/grok-local/src/server/test.ts b/packages/adapters/grok-local/src/server/test.tsindex b69ad7ff6c..f166d3c6af 100644--- a/packages/adapters/grok-local/src/server/test.ts+++ b/packages/adapters/grok-local/src/server/test.ts@@ -226,15 +226,22 @@ export async function testEnvironment(});}if (configuredModel) {+ // The default model id is a sentinel meaning "let the Grok CLI pick its+ // own default" — execute.ts only passes `--model` when the value differs+ // from it, so the sentinel is never sent to grok and must not be checked+ // against the discovered list (real grok never lists "grok-build", which+ // otherwise produced a spurious "not found" warning on every probe).+ const usesCliDefault = configuredModel === DEFAULT_GROK_LOCAL_MODEL;+ const available = usesCliDefault || parsedModels.models.includes(configuredModel);checks.push({- code: parsedModels.models.includes(configuredModel) ? "grok_model_configured" : "grok_model_not_found",- level: parsedModels.models.includes(configuredModel) ? "info" : "warn",- message: parsedModels.models.includes(configuredModel)- ? `Configured model: ${configuredModel}`- : `Configured model "${configuredModel}" not found in available models.`,- hint: parsedModels.models.includes(configuredModel)- ? undefined- : "Run `grok models` and choose an available model id.",+ code: available ? "grok_model_configured" : "grok_model_not_found",+ level: available ? "info" : "warn",+ message: usesCliDefault+ ? `Using the Grok CLI's default model${parsedModels.defaultModel ? ` (${parsedModels.defaultModel})` : ""}.`+ : available+ ? `Configured model: ${configuredModel}`+ : `Configured model "${configuredModel}" not found in available models.`,+ hint: available ? undefined : "Run `grok models` and choose an available model id.",});}}