fix(codex): default app-server approvals to on-request

This commit is contained in:
Lucenx9
2026-04-19 01:02:10 +02:00
committed by Peter Steinberger
parent 8c05043eca
commit d04f7e7ce7
5 changed files with 21 additions and 5 deletions

View File

@@ -263,7 +263,8 @@ By default, the plugin starts Codex locally with:
codex app-server --listen stdio://
```
You can keep that default and only tune Codex native policy:
By default, OpenClaw asks Codex to request native approvals. You can tune that
policy further:
```json5
{
@@ -317,7 +318,7 @@ Supported `appServer` fields:
| `authToken` | unset | Bearer token for WebSocket transport. |
| `headers` | `{}` | Extra WebSocket headers. |
| `requestTimeoutMs` | `60000` | Timeout for app-server control-plane calls. |
| `approvalPolicy` | `"never"` | Native Codex approval policy sent to thread start/resume/turn. |
| `approvalPolicy` | `"on-request"` | Native Codex approval policy sent to thread start/resume/turn. |
| `sandbox` | `"workspace-write"` | Native Codex sandbox mode sent to thread start/resume. |
| `approvalsReviewer` | `"user"` | Use `"guardian_subagent"` to let Codex guardian review native approvals. |
| `serviceTier` | unset | Optional Codex service tier, for example `"priority"`. |

View File

@@ -65,7 +65,7 @@
"approvalPolicy": {
"type": "string",
"enum": ["never", "on-request", "on-failure", "untrusted"],
"default": "never"
"default": "on-request"
},
"sandbox": {
"type": "string",

View File

@@ -60,6 +60,21 @@ describe("Codex app-server config", () => {
).toThrow("appServer.url is required");
});
it("defaults native Codex approvals to on-request", () => {
const runtime = resolveCodexAppServerRuntimeOptions({
pluginConfig: {},
env: {},
});
expect(runtime).toEqual(
expect.objectContaining({
approvalPolicy: "on-request",
sandbox: "workspace-write",
approvalsReviewer: "user",
}),
);
});
it("keeps runtime config keys aligned with manifest schema and UI hints", async () => {
const manifest = JSON.parse(
await fs.readFile(new URL("../../openclaw.plugin.json", import.meta.url), "utf8"),

View File

@@ -136,7 +136,7 @@ export function resolveCodexAppServerRuntimeOptions(
approvalPolicy:
resolveApprovalPolicy(config.approvalPolicy) ??
resolveApprovalPolicy(env.OPENCLAW_CODEX_APP_SERVER_APPROVAL_POLICY) ??
"never",
"on-request",
sandbox:
resolveSandbox(config.sandbox) ??
resolveSandbox(env.OPENCLAW_CODEX_APP_SERVER_SANDBOX) ??

View File

@@ -435,7 +435,7 @@ describe("runCodexAppServerAttempt", () => {
threadId: "thread-existing",
model: "gpt-5.4-codex",
modelProvider: "openai",
approvalPolicy: "never",
approvalPolicy: "on-request",
approvalsReviewer: "user",
sandbox: "workspace-write",
persistExtendedHistory: true,