fix: default codex-cli sandbox to workspace-write

Landed from contributor PR #39336 by @0xtangping.

Co-authored-by: john <john.j@min123.net>
This commit is contained in:
Peter Steinberger
2026-03-08 01:58:08 +00:00
parent 1b9e4800eb
commit 5b257c65d5
3 changed files with 36 additions and 2 deletions

View File

@@ -3,6 +3,31 @@ import type { OpenClawConfig } from "../config/config.js";
import { resolveCliBackendConfig } from "./cli-backends.js";
describe("resolveCliBackendConfig reliability merge", () => {
it("defaults codex-cli to workspace-write for fresh and resume runs", () => {
const resolved = resolveCliBackendConfig("codex-cli");
expect(resolved).not.toBeNull();
expect(resolved?.config.args).toEqual([
"exec",
"--json",
"--color",
"never",
"--sandbox",
"workspace-write",
"--skip-git-repo-check",
]);
expect(resolved?.config.resumeArgs).toEqual([
"exec",
"resume",
"{sessionId}",
"--color",
"never",
"--sandbox",
"workspace-write",
"--skip-git-repo-check",
]);
});
it("deep-merges reliability watchdog overrides for codex", () => {
const cfg = {
agents: {

View File

@@ -71,7 +71,15 @@ const DEFAULT_CLAUDE_BACKEND: CliBackendConfig = {
const DEFAULT_CODEX_BACKEND: CliBackendConfig = {
command: "codex",
args: ["exec", "--json", "--color", "never", "--sandbox", "read-only", "--skip-git-repo-check"],
args: [
"exec",
"--json",
"--color",
"never",
"--sandbox",
"workspace-write",
"--skip-git-repo-check",
],
resumeArgs: [
"exec",
"resume",
@@ -79,7 +87,7 @@ const DEFAULT_CODEX_BACKEND: CliBackendConfig = {
"--color",
"never",
"--sandbox",
"read-only",
"workspace-write",
"--skip-git-repo-check",
],
output: "jsonl",