Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
fix(codex): keep the person's AGENTS.md out of bot turns with no env switch (fix for #6542)
milind-soni17a3f5af396e
diff --git a/server/drivers/codex-shared-home.test.ts b/server/drivers/codex-shared-home.test.tsindex 2a2eb4dd87..c2b4519e58 100644--- a/server/drivers/codex-shared-home.test.ts+++ b/server/drivers/codex-shared-home.test.ts@@ -4,7 +4,7 @@ import { tmpdir } from "node:os";import { dirname, join } from "node:path";import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";-import { inheritsUserCodexInstructions, keepChatsOutOfCodexHistory, linkSharedCodexHome } from "./codex-shared-home.ts";+import { keepChatsOutOfCodexHistory, linkSharedCodexHome } from "./codex-shared-home.ts";let root: string;let shared: string;@@ -68,49 +68,26 @@ describe("linkSharedCodexHome", () => {write(join(shared, "skills", "review", "SKILL.md"));write(join(shared, "auth.json"), "person's sign-in");- expect(linkSharedCodexHome(shared, plan, "person", false)).toBe(true);+ expect(linkSharedCodexHome(shared, plan, "person")).toBe(true);for (const name of ["AGENTS.md", "AGENTS.override.md"]) expect(existsSync(join(plan, name)), name).toBe(false);for (const name of ["config.toml", "skills", "auth.json"]) expect(linksTo(join(plan, name), join(shared, name)), name).toBe(true);expect(readFileSync(join(shared, "AGENTS.md"), "utf8")).toBe("person's instructions");});- it("links the person's AGENTS.md when asked to inherit their setup", () => {- write(join(shared, "AGENTS.md"), "person's instructions");- write(join(shared, "AGENTS.override.md"), "person's override");-- linkSharedCodexHome(shared, plan, "own", true);-- for (const name of ["AGENTS.md", "AGENTS.override.md"]) expect(linksTo(join(plan, name), join(shared, name)), name).toBe(true);- });-it("removes an AGENTS.md link from before, and leaves the person's file where it is", () => {write(join(shared, "AGENTS.md"), "person's instructions");write(join(shared, "config.toml"));mkdirSync(plan, { recursive: true });symlinkSync(join(shared, "AGENTS.md"), join(plan, "AGENTS.md"));- linkSharedCodexHome(shared, plan, "own", false);+ linkSharedCodexHome(shared, plan, "own");expect(() => lstatSync(join(plan, "AGENTS.md"))).toThrow();expect(linksTo(join(plan, "config.toml"), join(shared, "config.toml"))).toBe(true);expect(readFileSync(join(shared, "AGENTS.md"), "utf8")).toBe("person's instructions");});- it("follows OMB_CODEX_INHERIT_USER_CONFIG when no choice is passed", () => {- write(join(shared, "AGENTS.md"), "person's instructions");- expect(inheritsUserCodexInstructions({})).toBe(false);- expect(inheritsUserCodexInstructions({ OMB_CODEX_INHERIT_USER_CONFIG: "1" })).toBe(true);-- linkSharedCodexHome(shared, plan);- expect(existsSync(join(plan, "AGENTS.md"))).toBe(false);-- vi.stubEnv("OMB_CODEX_INHERIT_USER_CONFIG", "1");- linkSharedCodexHome(shared, plan);- expect(linksTo(join(plan, "AGENTS.md"), join(shared, "AGENTS.md"))).toBe(true);- vi.unstubAllEnvs();- });-it("removes links to the person's chats from before, and leaves the chats themselves where they are", () => {write(join(shared, "sessions", "2026", "rollout-person.jsonl"), "person's chat");write(join(shared, "history.jsonl"), "person's history");diff --git a/server/drivers/codex-shared-home.ts b/server/drivers/codex-shared-home.tsindex 2a1dbe2df5..6200f1cb24 100644--- a/server/drivers/codex-shared-home.ts+++ b/server/drivers/codex-shared-home.ts@@ -78,21 +78,15 @@ function linkEntry(target: string, link: string, name: string): boolean {/** Whose login a MausBot home uses: its own (a ChatGPT plan's) or the person's, linked in. */export type CodexHomeLogin = "own" | "person";-/** Escape hatch: bot turns also load the person's own AGENTS.md, as Claude bots do with OMB_CLAUDE_INHERIT_USER_CONFIG. */-export function inheritsUserCodexInstructions(env: NodeJS.ProcessEnv = process.env): boolean {- return env.OMB_CODEX_INHERIT_USER_CONFIG === "1";-}-/** Makes MausBot's Codex home and links the person's own Codex home into it. Linking never fails the turn: an entry* that cannot be linked (a file link Windows refuses without Developer Mode) stays as the home had it. True when the* home has the login it should: its own, or the person's (none when they have none). */-export function linkSharedCodexHome(sharedHome: string | null, mausHome: string, login: CodexHomeLogin = "own",- inheritInstructions = inheritsUserCodexInstructions()): boolean {+export function linkSharedCodexHome(sharedHome: string | null, mausHome: string, login: CodexHomeLogin = "own"): boolean {mkdirSync(mausHome, { recursive: true, mode: 0o700 });if (!isAbsolute(mausHome)) return false;const own = resolve(mausHome);const apart = (name: string) => CHATS.has(name) || DATABASE.test(name) || (login === "own" && PRIVATE.has(name))- || (!inheritInstructions && USER_INSTRUCTIONS.has(name));+ || USER_INSTRUCTIONS.has(name);// A link from before chats were kept apart goes, even when sharing fails below, so no new chat is written through it;// the person's own files behind it stay as they are.for (const name of readdirSync(own)) {diff --git a/src/components/EnginesSettings.codex-shared-setup.dom.test.ts b/src/components/EnginesSettings.codex-shared-setup.dom.test.tsindex 1b8900df68..0d24d5d8cb 100644--- a/src/components/EnginesSettings.codex-shared-setup.dom.test.ts+++ b/src/components/EnginesSettings.codex-shared-setup.dom.test.ts@@ -45,7 +45,7 @@ describe("Settings → Codex accounts", () => {const notes = container.querySelectorAll("[data-accounts='chatgpt'] ~ [data-codex-shared-setup]");expect(notes).toHaveLength(1);expect(notes[0]!.textContent).toContain("your own Codex setup");- expect(notes[0]!.textContent).toContain("OMB_CODEX_INHERIT_USER_CONFIG=1");+ expect(notes[0]!.textContent).toContain("not your own instructions (AGENTS.md)");});it("keeps the note off other engines' account cards", async () => {diff --git a/src/locales/en.json b/src/locales/en.jsonindex d4ffb88bb1..fa1c7d832e 100644--- a/src/locales/en.json+++ b/src/locales/en.json@@ -4795,7 +4795,7 @@"accounts.addClaude": "Add another Claude account","accounts.addChatgpt": "Add another ChatGPT account","accounts.addChatgptWorkspaceNote": "ChatGPT Business and Enterprise organizations can block adding an account here (OpenAI shows 3p_delegated_access_policy_denied).",- "accounts.chatgptSharedSetupNote": "Bots that use these accounts also share your own Codex setup: config.toml, skills and plugins. Your own AGENTS.md is not shared unless OMB_CODEX_INHERIT_USER_CONFIG=1 is set.",+ "accounts.chatgptSharedSetupNote": "Bots that use these accounts also share your own Codex setup: config.toml, skills and plugins, but not your own instructions (AGENTS.md).","accounts.nameLabel": "Account name","accounts.namePlaceholder": "Work","accounts.addSubmit": "Add and sign in",diff --git a/src/locales/pt-br.json b/src/locales/pt-br.jsonindex 6dade29f1e..b9d3de6a53 100644--- a/src/locales/pt-br.json+++ b/src/locales/pt-br.json@@ -4479,7 +4479,7 @@"accounts.addClaude": "Adicionar outra conta do Claude","accounts.addChatgpt": "Adicionar outra conta do ChatGPT","accounts.addChatgptWorkspaceNote": "Organizações do ChatGPT Business e Enterprise podem bloquear a adição de uma conta aqui (a OpenAI mostra 3p_delegated_access_policy_denied).",- "accounts.chatgptSharedSetupNote": "Os bots que usam essas contas também compartilham a sua configuração do Codex: config.toml, skills e plugins. Seu próprio AGENTS.md não é compartilhado, a menos que OMB_CODEX_INHERIT_USER_CONFIG=1 esteja definido.",+ "accounts.chatgptSharedSetupNote": "Os bots que usam essas contas também compartilham a sua configuração do Codex: config.toml, skills e plugins, mas não as suas próprias instruções (AGENTS.md).","accounts.nameLabel": "Nome da conta","accounts.namePlaceholder": "Trabalho","accounts.addSubmit": "Adicionar e entrar",diff --git a/src/locales/source-hashes.json b/src/locales/source-hashes.jsonindex f8d1677073..b9854a3145 100644--- a/src/locales/source-hashes.json+++ b/src/locales/source-hashes.json@@ -36419,7 +36419,7 @@"settings.experimental.usbPhoneTakeoverDetail": "5eb3537bc77eb35417bee4ba9fb4acc94c0bd2be31a30a5a8c7f8d6cd5e0395e","keys.vps.anyMachine": "b78ee82755fdf61c4b8dd59aa27228597dc91e620dd1b335b4179b2a701b6a45","botPanel.backups.otherSignIn": "2ea67dfafd1ec5e361a2cade739734c56329872f2fe37b4382face4ab0f33738",- "accounts.chatgptSharedSetupNote": "2694ea4fa4fb5eed88c871f9903d3e8545cff22556a724386c272e46cacde66a",+ "accounts.chatgptSharedSetupNote": "bb146d3438bb503b3a40ef8466827296e1c24b585806e0ae1270561696cf5588","computer.android.serverSubtitle": "92bf3cff78cf4fbacb83c5ae4e4da0f17392958bc39714fc22a434a6f1003911","computer.android.watching": "b5a811af9089c36d615953ae99d434d44a6995b31d0eb6f07d6841ab25381d46","computer.android.wake": "33a7e908344d7d3901a5fcfc60a6d528bf077050c78a1432da3f6422070aa01b",@@ -57375,7 +57375,7 @@"chat.peer.exchangeTitle": "fae710f53d65af25536e037a798b17dad5e103966059816852699abcfdb78e2a","keys.vps.anyMachine": "b78ee82755fdf61c4b8dd59aa27228597dc91e620dd1b335b4179b2a701b6a45","botPanel.backups.otherSignIn": "2ea67dfafd1ec5e361a2cade739734c56329872f2fe37b4382face4ab0f33738",- "accounts.chatgptSharedSetupNote": "2694ea4fa4fb5eed88c871f9903d3e8545cff22556a724386c272e46cacde66a",+ "accounts.chatgptSharedSetupNote": "bb146d3438bb503b3a40ef8466827296e1c24b585806e0ae1270561696cf5588","server.cloudComputer.replaced": "6cabc889e6fe9d72729014312e582a0e7b067dc052ce8407e56216c01627c461","server.cloudComputer.restarted": "8b12048037f59c3a7c918a3a972f72de37820fae7b5f814d07bcaa7a8721fbcb","server.cloudComputer.capped": "bc95d3e9ca8e89f53746d7d7f65cdcd1e5a5178bd3095a5947fd62714a0d9abb",diff --git a/src/locales/zh-tw.json b/src/locales/zh-tw.jsonindex 3d97485ead..4af7c3e654 100644--- a/src/locales/zh-tw.json+++ b/src/locales/zh-tw.json@@ -4280,7 +4280,7 @@"accounts.addClaude": "新增其他 Claude 帳號","accounts.addChatgpt": "新增其他 ChatGPT 帳號","accounts.addChatgptWorkspaceNote": "ChatGPT Business 和 Enterprise 組織可能會封鎖在這裡新增帳號(OpenAI 會顯示 3p_delegated_access_policy_denied)。",- "accounts.chatgptSharedSetupNote": "使用這些帳號的機器人也會共用你自己的 Codex 設定:config.toml、技能和外掛。除非設定 OMB_CODEX_INHERIT_USER_CONFIG=1,否則不會共用你自己的 AGENTS.md。",+ "accounts.chatgptSharedSetupNote": "使用這些帳號的機器人也會共用你自己的 Codex 設定:config.toml、技能和外掛,但不包括你自己的指示(AGENTS.md)。","accounts.nameLabel": "帳號名稱","accounts.namePlaceholder": "工作","accounts.addSubmit": "新增並登入",