Skip to content

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

Merged
steipete merged 3 commits into
openclaw:mainfrom
Lucenx9:codex/fix-codex-harness-approvals
Apr 21, 2026
Merged

fix(codex): default app-server approvals to on-request#68721
steipete merged 3 commits into
openclaw:mainfrom
Lucenx9:codex/fix-codex-harness-approvals

Conversation

@Lucenx9

@Lucenx9 Lucenx9 commented Apr 18, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Problem: the Codex app-server harness defaulted native sessions to approvalPolicy: "never".
  • Why it matters: command-execution and file-change actions could proceed without surfacing the native approval bridge unless operators opted in manually.
  • What changed: changed the default app-server approval policy to on-request, kept explicit operator overrides intact, and updated tests plus plugin docs to match the secure-by-default behavior.
  • What did NOT change (scope boundary): explicit env/config overrides, sandbox selection, and the underlying approval bridge wiring outside the default-policy path.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor required for the fix
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

  • Closes #
  • Related #
  • This PR fixes a bug or regression

Root Cause (if applicable)

  • Root cause: the Codex harness already had an approval bridge, but resolveAppServerApprovalPolicy() defaulted to "never", which suppressed approval requests by default.
  • Missing detection / guardrail: there was no regression test asserting that the default harness configuration requests approvals instead of disabling them.
  • Contributing context (if known): the harness exposed an override env var for operators, but the documented and configured default chose the most permissive behavior.

Regression Test Plan (if applicable)

  • Coverage level that should have caught this:
    • Unit test
    • Seam / integration test
    • End-to-end test
    • Existing coverage already sufficient
  • Target test or file: extensions/codex/src/app-server/config.test.ts, extensions/codex/src/app-server/run-attempt.test.ts
  • Scenario the test should lock in: when operators do not override the setting, new Codex app-server sessions start with approvalPolicy: "on-request"; explicit overrides still pass through unchanged.
  • Why this is the smallest reliable guardrail: the regression is in the harness configuration and request payload assembly, which is fully observable in unit tests.
  • Existing test that already covers this (if any): none prior to this fix.
  • If no new test is added, why not: N/A

User-visible / Behavior Changes

  • Codex app-server sessions now request approvals by default for native command/file actions instead of silently disabling the approval path.

Diagram (if applicable)

Before:
[thread/start or turn/start] -> [approvalPolicy: never] -> [native action proceeds without approval request]

After:
[thread/start or turn/start] -> [approvalPolicy: on-request] -> [approval bridge can prompt]

Security Impact (required)

  • New permissions/capabilities? (Yes/No) No
  • Secrets/tokens handling changed? (Yes/No) No
  • New/changed network calls? (Yes/No) No
  • Command/tool execution surface changed? (Yes/No) Yes
  • Data access scope changed? (Yes/No) No
  • If any Yes, explain risk + mitigation: the default native action surface is now narrower because the harness requests approvals unless an operator explicitly opts out.

Repro + Verification

Environment

  • OS: Linux
  • Runtime/container: local repo checkout
  • Model/provider: Codex app-server harness tests
  • Integration/channel (if any): Codex extension app-server path
  • Relevant config (redacted): default Codex harness config with no OPENCLAW_CODEX_APP_SERVER_APPROVAL_POLICY override

Steps

  1. Start a Codex app-server thread or turn without setting the approval-policy override env var.
  2. Inspect the request payload sent by the harness.
  3. Repeat with an explicit override to verify it is preserved.

Expected

  • Default requests use approvalPolicy: "on-request", while explicit overrides still pass through.

Actual

  • Before this fix, the default requests used approvalPolicy: "never".

Evidence

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Human Verification (required)

  • Verified scenarios: targeted Codex app-server config/run-attempt tests, plus full pnpm check through the commit hook.
  • Edge cases checked: explicit operator overrides for the approval policy remain unchanged.
  • What you did not verify: a live Codex app-server session end-to-end against a running backend.

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

Compatibility / Migration

  • Backward compatible? (Yes/No) Yes
  • Config/env changes? (Yes/No) No
  • Migration needed? (Yes/No) No
  • If yes, exact upgrade steps: set OPENCLAW_CODEX_APP_SERVER_APPROVAL_POLICY=never if you intentionally want the previous approval-free default.

Risks and Mitigations

  • Risk: installs that depended on approval-free Codex native actions by default will now see approval prompts unless they opt out explicitly.
    • Mitigation: the override path is preserved unchanged, and the docs/tests now make the default explicit.

AI Assistance

  • AI-assisted: Codex
  • Testing degree: fully tested
  • I understand what the code does: Yes

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation extensions: codex size: XS labels Apr 18, 2026
@greptile-apps

greptile-apps Bot commented Apr 18, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR changes the default approvalPolicy for the Codex app-server harness from \"never\" to \"on-request\", making the secure approval flow active out-of-the-box. The change is applied consistently across the runtime resolver (config.ts), the JSON schema default (openclaw.plugin.json), documentation, and tests — all in sync with no drift between layers.

Confidence Score: 5/5

Safe to merge — the change is minimal, all layers (runtime, schema, docs, tests) are updated consistently, and explicit operator overrides remain intact.

The only finding is a P2 doc clarity nit (example snippet shows the default value rather than an actual override). No logic errors or security regressions introduced.

docs/plugins/codex-harness.md — minor doc example clarity issue only.

Comments Outside Diff (1)

  1. docs/plugins/codex-harness.md, line 269-286 (link)

    P2 Config example shows the default value redundantly

    The code block under "You can tune that policy further" still shows approvalPolicy: "on-request", which is now the implicit default. Readers may incorrectly infer they need to explicitly set it to get the secure default, or that this snippet demonstrates a customisation when it actually changes nothing. Consider replacing it with a snippet that shows an actual override (e.g. "never" or "untrusted") to make the "tune further" framing accurate.

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: docs/plugins/codex-harness.md
    Line: 269-286
    
    Comment:
    **Config example shows the default value redundantly**
    
    The code block under "You can tune that policy further" still shows `approvalPolicy: "on-request"`, which is now the implicit default. Readers may incorrectly infer they need to explicitly set it to get the secure default, or that this snippet demonstrates a customisation when it actually changes nothing. Consider replacing it with a snippet that shows an actual override (e.g. `"never"` or `"untrusted"`) to make the "tune further" framing accurate.
    
    How can I resolve this? If you propose a fix, please make it concise.
Prompt To Fix All With AI
This is a comment left during a code review.
Path: docs/plugins/codex-harness.md
Line: 269-286

Comment:
**Config example shows the default value redundantly**

The code block under "You can tune that policy further" still shows `approvalPolicy: "on-request"`, which is now the implicit default. Readers may incorrectly infer they need to explicitly set it to get the secure default, or that this snippet demonstrates a customisation when it actually changes nothing. Consider replacing it with a snippet that shows an actual override (e.g. `"never"` or `"untrusted"`) to make the "tune further" framing accurate.

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "fix(codex): default app-server approvals..." | Re-trigger Greptile

@steipete
steipete force-pushed the codex/fix-codex-harness-approvals branch from 4b8633e to ddbde20 Compare April 20, 2026 22:39
@steipete
steipete force-pushed the codex/fix-codex-harness-approvals branch from ddbde20 to ce39150 Compare April 20, 2026 23:33
@steipete
steipete force-pushed the codex/fix-codex-harness-approvals branch from ce39150 to ea7299c Compare April 20, 2026 23:51
@steipete
steipete merged commit 6c67339 into openclaw:main Apr 21, 2026
172 of 173 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Landed via rebase. Thanks @Lucenx9.\n\nSource head: ea7299c\nLanded on main: 6c67339\n\nVerified:\n- pnpm check\n- pnpm check:test-types\n- pnpm test extensions/codex/src/app-server/config.test.ts extensions/codex/src/app-server/run-attempt.test.ts\n- GitHub checks green after rerunning a wedged check-test-types runner\n\nLive tests were attempted separately; failures were in unrelated live provider/auth/model-profile lanes, not this Codex app-server change.

loongfay pushed a commit to YuanbaoTeam/openclaw that referenced this pull request Apr 21, 2026
@Lucenx9
Lucenx9 deleted the codex/fix-codex-harness-approvals branch April 22, 2026 18:07
lovewanwan pushed a commit to lovewanwan/openclaw that referenced this pull request Apr 28, 2026
ogt-redknie pushed a commit to ogt-redknie/OPENX that referenced this pull request May 2, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 9, 2026
globalcaos pushed a commit to globalcaos/tinkerclaw that referenced this pull request May 13, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
jameslcowan pushed a commit to jameslcowan/openclaw that referenced this pull request Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation extensions: codex size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants