Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

Guest shell test reads a held engine's turns apart from its one-off calls

milind-soni0f3fbf3a6e7b
diff --git a/server/cloud-guest-shell.e2e.test.ts b/server/cloud-guest-shell.e2e.test.ts
index 60b89f8edb..5c5c408e34 100644
--- a/server/cloud-guest-shell.e2e.test.ts
+++ b/server/cloud-guest-shell.e2e.test.ts
@@ -82,10 +82,11 @@ beforeAll(async () => {
const codex = probing("codex", "fake-codex-app-server.ts", `process.env.FAKE_CODEX_DUMP = ${JSON.stringify(join(home, "codex.json"))};
process.env.FAKE_CODEX_DUMP_TURNS_ONLY = "1";`);
// A Claude whose turns hold until the test writes the release file; each
- // engine dumps its latest start to <name>.json.
+ // engine dumps its latest turn to <name>.json, and its latest one-off call
+ // (a title, whether a reply needs its requester) to <name>-one-shot.json.
const held = (name: string) => probing(name, "fake-claude-cli.ts", `if (process.argv[2] === "auth") { console.log(JSON.stringify({ loggedIn: true, email: "[email protected]" })); process.exit(0); }
process.env.FAKE_CLAUDE_VERSION = "2.1.284";
-if (process.argv[2] !== "--version") { process.env.FAKE_CLAUDE_DUMP = ${JSON.stringify(home)} + "/${name}.json"; process.env.FAKE_CLAUDE_MODE = "hang"; process.env.FAKE_CLAUDE_RELEASE = ${JSON.stringify(join(home, "release"))}; }`);
+if (process.argv[2] !== "--version") { process.env.FAKE_CLAUDE_DUMP = ${JSON.stringify(home)} + "/${name}.json"; process.env.FAKE_CLAUDE_TEXT_DUMP = ${JSON.stringify(home)} + "/${name}-one-shot.json"; process.env.FAKE_CLAUDE_MODE = "hang"; process.env.FAKE_CLAUDE_RELEASE = ${JSON.stringify(join(home, "release"))}; }`);
writeFileSync(join(dataDir, "config.json"), JSON.stringify({
instances: {
...Object.fromEntries(["cursor", "githubCopilot", "openaiCompat", "qwen", "hermes", "pi", "claude"].map((id) => [id, { driver: "not-a-real-driver" }])),
@@ -322,9 +323,16 @@ it("a run of a guest's routine is the guest's: confined, and so is work it hands
expect(new Set(handed.map((node) => node.threadId)).size).toBe(1);
expect(handed[0]!.threadId).not.toBe(teammate.threadId);
rmSync(teammateDump, { force: true });
+ const oneShots = ["claude", "teammate"].map((name) => join(home, `${name}-one-shot.json`));
+ for (const file of oneShots) rmSync(file, { force: true });
writeFileSync(join(home, "release"), "");
await expect.poll(() => existsSync(teammateDump), { timeout: hostTimeout(20_000) }).toBe(true);
expect(argv(teammateDump)).toContain("--restricted");
+ // A one-off call about this work, such as whether the teammate's reply needs the routine's turn, has no tools at all.
+ for (const file of oneShots.filter((one) => existsSync(one))) {
+ expect(argv(file)[argv(file).indexOf("--tools") + 1]).toBe("");
+ expect(argv(file)).toContain("--strict-mcp-config");
+ }
const owners = ((await api("GET", `/api/threads/${teammate.threadId}/messages`, { token: owner })).body.messages as any[]);
expect(owners.filter((message) => message.role === "user")).toEqual([]);
const own = await api("POST", "/api/routines", { token: owner, body: { ...routine(teammate.id), name: "Owner routine" } });