An agentic browser harness: an AI side panel & orb in your own logged-in Chrome, Edge, Arc, Brave or even Firefox run by the agent/subscription you already use (Claude Code, Codex, Antigravity). Free, open source, no API key. Also an MCP server.
TypeScript agentic-browseragentic-browsingagy-cliaiai-agentai-browser-extensionai-toolsbrave-extensionbrowser-agentbrowser-automationbrowser-extensionbrowser-usebrowserskillchrome-extensionclaude-codecodexfirefox-addonmcp-servernanobrowserweb-automation
fix(codex): set the sandbox and approval policy through config, because exec and resume no longer take the flags
Shahriar98b5220a87b5
diff --git a/docs/guide/agents.md b/docs/guide/agents.mdindex d2024b9..8b80a0b 100644--- a/docs/guide/agents.md+++ b/docs/guide/agents.md@@ -41,7 +41,7 @@ agents cannot resume each other's sessions, so the next instruction starts a fre| Install | `npm i -g @anthropic-ai/claude-code` | `npm i -g @openai/codex` | [antigravity.google/docs/cli/install](https://antigravity.google/docs/cli/install) || Default model | `claude-sonnet-5` | the CLI's own | the CLI's own || Effort names | `low`…`max` | `minimal`…`high` | `low`…`high` |-| Kept off your machine by | a per-run tool allowlist plus an explicit deny list | `--sandbox read-only` | its own permission rules |+| Kept off your machine by | a per-run tool allowlist plus an explicit deny list | a read-only sandbox (`sandbox_mode="read-only"`) | its own permission rules |All three get the same system prompt, the same `browsentic` MCP server pointed back at the daemon,and the same [approval gate](approvals.md). What differs is how well each one can be fenced off fromdiff --git a/docs/internals/agent-runs.md b/docs/internals/agent-runs.mdindex d9ea622..b271251 100644--- a/docs/internals/agent-runs.md+++ b/docs/internals/agent-runs.md@@ -91,7 +91,7 @@ Every runner is given the same four things, by whichever mechanism its CLI suppo| MCP server | `--mcp-config` + `--strict-mcp-config` | `-c mcp_servers.browsentic.*` | `.agents/mcp_config.json` in its cwd || System prompt | `--append-system-prompt` | `-c developer_instructions` | `AGENTS.md` in its cwd || Follow-up turns | `--resume <session>` | `exec resume <thread>` | `--conversation <id>` |-| Kept off the machine by | `--allowedTools` + `--disallowedTools` | `--sandbox read-only`, `--ask-for-approval never` | its own permission rules |+| Kept off the machine by | `--allowedTools` + `--disallowedTools` | `-c sandbox_mode="read-only"`, `-c approval_policy="never"` | its own permission rules |**Conversation continuity** is what makes "now click the second one" work: the runner reportswhatever session id its CLI established (`session_id`, `thread_id`, `conversation_id`) and gets itdiff --git a/docs/internals/guardrails.md b/docs/internals/guardrails.mdindex 66ee5da..fd7eff1 100644--- a/docs/internals/guardrails.md+++ b/docs/internals/guardrails.md@@ -321,7 +321,8 @@ runner's real plan without spawning anything.It checks: required arguments present, `--flag value` pairs correct, every tool in the deny listactually named, required workspace files written, and no argument matching `FORBIDDEN` —`--dangerously*`, `--yolo`, `--full-auto`, `--no-sandbox`, `--allow-all`, `danger-full-access`,-`--sandbox=workspace-write`, `--permission-mode=bypassPermissions`, and friends. Every pattern is+`--sandbox=workspace-write`, a `sandbox_mode=` or `approval_policy=` override that is not `"read-only"` / `"never"`,+`--permission-mode=bypassPermissions`, and friends. Every pattern ischecked against every runner, not just the one that owns the flag: the cost is nothing and it coversthe runner nobody has written yet.diff --git a/scripts/check-security.mjs b/scripts/check-security.mjsindex 1428b4c..b9f82fb 100644--- a/scripts/check-security.mjs+++ b/scripts/check-security.mjs@@ -404,10 +404,13 @@ check('un-denying Read on a browser run is caught', vetPlan('claude', 'run', witcheck('--dangerously-skip-permissions is caught', vetPlan('claude', 'run', plus(claudeRun, '--dangerously-skip-permissions'), stateDir).length, 1);const codexRun = planOf('codex', 'run');-const unsandboxed = { ...codexRun, args: codexRun.args.map((a) => (a === 'read-only' ? 'danger-full-access' : a)) };+const swapped = (plan, from, to) => ({ ...plan, args: plan.args.map((a) => (a === from ? to : a)) });+const unsandboxed = swapped(codexRun, 'sandbox_mode="read-only"', 'sandbox_mode="danger-full-access"');check('losing the codex sandbox is caught', vetPlan('codex', 'run', unsandboxed, stateDir).length, 2);check('--full-auto is caught', vetPlan('codex', 'run', plus(codexRun, '--full-auto'), stateDir).length, 1);-check('approval prompts turning back on is caught', vetPlan('codex', 'run', without(codexRun, 'never'), stateDir).length, 1);+check('a writable codex sandbox is caught', vetPlan('codex', 'run', swapped(codexRun, 'sandbox_mode="read-only"', 'sandbox_mode="workspace-write"'), stateDir).length, 2);+check('approval prompts turning back on is caught', vetPlan('codex', 'run', swapped(codexRun, 'approval_policy="never"', 'approval_policy="on-request"'), stateDir).length, 2);+check('a later override of the codex sandbox is caught', vetPlan('codex', 'run', plus(codexRun, '-c', 'sandbox_mode="workspace-write"'), stateDir).length, 1);const agyRun = planOf('antigravity', 'run');check('losing the antigravity mcp config is caught', vetPlan('antigravity', 'run', { ...agyRun, files: [] }, stateDir).length, 2);diff --git a/src/daemon/agent/runners/codex.ts b/src/daemon/agent/runners/codex.tsindex 1232ce2..f1119aa 100644--- a/src/daemon/agent/runners/codex.ts+++ b/src/daemon/agent/runners/codex.ts@@ -6,8 +6,12 @@ import { MCP_SERVER_NAME } from './claude';import { effortOf, parseJsonLine } from './util';import type { JsonContext, Plan, Runner, StreamContext, StreamReader } from './types';-/** Codex has no per-run tool allowlist; the read-only sandbox is what keeps a run inside the browser. */-const SANDBOX = ['--sandbox', 'read-only', '--ask-for-approval', 'never', '--skip-git-repo-check'];+/**+ * Codex has no per-run tool allowlist; the read-only sandbox is what keeps a run inside the browser.+ * Set through `-c` because `exec resume` takes neither `--sandbox` nor `--ask-for-approval`, and+ * `exec` itself dropped the latter.+ */+const SANDBOX = ['-c', 'sandbox_mode="read-only"', '-c', 'approval_policy="never"', '--skip-git-repo-check'];const WEB_TOOL = 'web_search';diff --git a/src/daemon/guardrails/spawn.ts b/src/daemon/guardrails/spawn.tsindex b93edbe..a3f0479 100644--- a/src/daemon/guardrails/spawn.ts+++ b/src/daemon/guardrails/spawn.ts@@ -92,6 +92,8 @@ const FORBIDDEN: readonly RegExp[] = [/^--allow-all/i,/danger-full-access/i,/^--sandbox=?(workspace-write|danger-full-access)$/i,+ /^sandbox_mode=(?!"read-only"$)/i,+ /^approval_policy=(?!"never"$)/i,/^--permission-mode=?(bypassPermissions|acceptEdits)$/i,];@@ -130,19 +132,13 @@ export const CONTAINMENT: Record<AgentKind, Containment> = {keepsEnv: ['OPENAI_', 'CODEX_', 'AZURE_OPENAI_'],note: 'no per-run tool list; the read-only sandbox is the whole containment, so the agent can still read any file the user can',run: {- required: [],- pairs: [- ['--sandbox', 'read-only'],- ['--ask-for-approval', 'never'],- ],+ required: ['sandbox_mode="read-only"', 'approval_policy="never"'],+ pairs: [],files: [],},task: {- required: ['mcp_servers={}'],- pairs: [- ['--sandbox', 'read-only'],- ['--ask-for-approval', 'never'],- ],+ required: ['sandbox_mode="read-only"', 'approval_policy="never"', 'mcp_servers={}'],+ pairs: [],files: [],},},