Skip to content

armgit / alook

Public Imported from GitHub
0

Multi-Agent Collaboration for Team and Friends

feat: enable network access in Codex workspace-write sandbox (#31)

Gener31b36d2be72d
diff --git a/src/cli/daemon/agent/__tests__/codex.test.ts b/src/cli/daemon/agent/__tests__/codex.test.ts
index 2612ad315..1cbf689e6 100644
--- a/src/cli/daemon/agent/__tests__/codex.test.ts
+++ b/src/cli/daemon/agent/__tests__/codex.test.ts
@@ -115,6 +115,19 @@ describe("CodexBackend", () => {
backend = new CodexBackend("/usr/bin/codex");
});
+ it("spawns codex with network_access config flag", async () => {
+ const { spawn } = await import("child_process");
+ const session = backend.execute("hello", { cwd: "/tmp" });
+ const mock = getMock();
+
+ const spawnCall = (spawn as any).mock.calls[0];
+ expect(spawnCall[1]).toContain("--config");
+ expect(spawnCall[1]).toContain("sandbox_workspace_write.network_access=true");
+
+ mock.proc.emit("close", 0);
+ await session.result;
+ });
+
it("sends structured initialize params", async () => {
const session = backend.execute("hello", { cwd: "/tmp" });
const mock = getMock();
diff --git a/src/cli/daemon/agent/codex.ts b/src/cli/daemon/agent/codex.ts
index f1e557f06..6c70f828c 100644
--- a/src/cli/daemon/agent/codex.ts
+++ b/src/cli/daemon/agent/codex.ts
@@ -46,7 +46,7 @@ export class CodexBackend implements AgentBackend {
constructor(private cliPath: string) {}
execute(prompt: string, options: ExecOptions): AgentSession {
- const proc = spawn(this.cliPath, ["app-server", "--listen", "stdio://"], {
+ const proc = spawn(this.cliPath, ["app-server", "--listen", "stdio://", "--config", "sandbox_workspace_write.network_access=true"], {
cwd: options.cwd,
stdio: ["pipe", "pipe", "pipe"],
env: { ...process.env, ...options.env },