diff --git a/src/plugins/grok.ts b/src/plugins/grok.ts index a74a8d0..1dca6bf 100644 --- a/src/plugins/grok.ts +++ b/src/plugins/grok.ts @@ -1,11 +1,10 @@ // plugins/grok.ts — Grok over native ACP (`grok agent ... stdio`). // // Bundle: model and effort go as process flags BEFORE the `stdio` -// subcommand (`-m --reasoning-effort `); grok stdio has no -// set_config. The acknowledged bundle is read back from the session/new -// response (models.currentModelId + the current model's -// _meta.reasoningEffort, plus the `x.ai/sessionConfig` selected option) and -// recorded in ack.json — evidence, not a gate. +// subcommand (`-m --reasoning-effort `). The acknowledged +// bundle is read back from the session/new response (models.currentModelId +// + the current model's _meta.reasoningEffort, plus the `x.ai/sessionConfig` +// selected option) and recorded in ack.json — evidence, not a gate. // // Posture: `--always-approve` (validated in Grok's own CLI: auto-approves // all tool executions), plus Subturn's ACP client's allow-everything @@ -73,9 +72,14 @@ export const grokPlugin: Plugin = { const realAuth = path.join(realGrokHome(), "auth.json"); const linked = shareAuth(realAuth, path.join(shadow, "auth.json")); return Promise.resolve({ - env: { GROK_HOME: shadow }, + // GROK_CAMPAIGNS=0: a remote campaign (e.g. a model launch) can force + // its own default model in session/new over `-m`. The user's home + // remembers dismissed campaigns; a fresh shadow does not, so without + // this every session would run the campaign's model. + env: { GROK_HOME: shadow, GROK_CAMPAIGNS: "0" }, note: `GROK_HOME=${shadow} (sessions land under the shadow, invisible to \`grok sessions\`); ` + + `GROK_CAMPAIGNS=0 (remote campaigns cannot override -m); ` + `auth.json ${linked ? "symlinked from" : "NOT FOUND at"} ${realAuth}`, }); }, diff --git a/test/live.test.ts b/test/live.test.ts index c636eb1..eec86df 100644 --- a/test/live.test.ts +++ b/test/live.test.ts @@ -71,6 +71,11 @@ test(`live smoke + resume: ${harness} ${model}/${effort}`, { skip: !live || kill assert.fail(`live turn 1 ${done.status}: ${JSON.stringify(evidence.error)}\nstderr: ${JSON.stringify(evidence.stderr_tail)}`); } assert.ok((done.final_text ?? "").toLowerCase().includes("ok")); + // A harness may silently run a different model than asked; where it + // echoes one, the echo must be the requested model. + if (done.bundle?.model !== undefined) { + assert.equal(done.bundle.model, model, "the harness must run the requested model"); + } if (harness === "claude") { assert.equal(