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
16 changes: 10 additions & 6 deletions src/plugins/grok.ts
Original file line number Diff line number Diff line change
@@ -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 <model> --reasoning-effort <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 <model> --reasoning-effort <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
Expand Down Expand Up @@ -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}`,
});
},
Expand Down
5 changes: 5 additions & 0 deletions test/live.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Loading