Skip to content

Inherit approval policy from the user's Codex config - #806

Open
AzmainMahatab wants to merge 1 commit into
openai:mainfrom
AzmainMahatab:inherit-approval-policy
Open

AzmainMahatab wants to merge 1 commit into
openai:mainfrom
AzmainMahatab:inherit-approval-policy

Conversation

@AzmainMahatab

Copy link
Copy Markdown

Summary

buildThreadParams / buildResumeParams fall back to approvalPolicy: "never" whenever the caller passes nothing, and no caller passes one. That overrides approval_policy and approvals_reviewer from ~/.codex/config.toml, so Codex auto-review ("Approve for me", approvals_reviewer = "auto_review") can never run for plugin tasks or reviews: with never, Codex has nothing to escalate and nothing to review (#445).

Change

  • lib/codex.mjs: options.approvalPolicy ?? "never" → options.approvalPolicy ?? null in both builders, so the app-server resolves the approval policy and reviewer from config — the same mechanism the plugin already uses for model.
  • Sandbox selection is untouched; it composes with Resolve the task sandbox from config.toml and add task --read-only #646, which does the same for sandbox (Hardcoded sandbox values always override config.toml sandbox_mode #482).
  • Approval requests that still reach the plugin (approvals_reviewer = "user") keep hitting the existing handleServerRequest path, which answers -32601 Unsupported server request, so they are denied rather than left waiting. Users who never set an approval policy therefore see escalations denied instead of not attempted.

Verification

  • New tests/approval-policy.test.mjs: task, task --write, review and adversarial-review all send approvalPolicy: null (the fake fixture now records the value). All four fail on main with actual: 'never'.
  • Live run on Windows 11 with codex-cli 0.161.0 and sandbox_mode = "workspace-write", approval_policy = "on-request", approvals_reviewer = "auto_review": a plugin task wrote outside the workspace and reached the network after require_escalated requests that codex-auto-review approved; Codex logged the thread as approval_policy=OnRequest sandbox_policy=WorkspaceWrite. On main, the same task cannot escalate.

Related: #445, #482, #646, #494, #426

🤖 Generated with Claude Code

Thread start and resume sent `approvalPolicy: "never"` whenever the caller
passed nothing, which overrides `approval_policy` / `approvals_reviewer` in
~/.codex/config.toml and makes Codex auto-review unreachable from the plugin.
Send null instead so the app-server resolves both from config, matching how
`model: null` already falls back to the configured model.

Approval requests that do reach the plugin are still answered with the
existing unsupported-request error, so they are denied rather than left
waiting.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-08T21:53:22.971851Z 9f3318f PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant