feat: pass through codex permission config#780
Open
Disaster-Terminator wants to merge 1 commit intochenhg5:mainfrom
Open
feat: pass through codex permission config#780Disaster-Terminator wants to merge 1 commit intochenhg5:mainfrom
Disaster-Terminator wants to merge 1 commit intochenhg5:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds support for passing through Codex native permission configuration from [projects.agent.options] to both codex exec and codex app-server, including partial overrides that preserve the non-overridden permission axis from the selected mode.
Changes:
- Parse and carry
approval_policy,approvals_reviewer, andsandbox_modethrough Codex agent/session lifecycles. - Apply shared “effective permission” merging (mode defaults + explicit overrides) for exec/app-server RPC params and app-server startup flags.
- Add unit tests for full/partial override behavior and document the new options in usage docs and example config.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
docs/usage.zh-CN.md |
Documents Codex native permission override keys and partial-override behavior (ZH-CN). |
docs/usage.md |
Documents Codex native permission override keys and partial-override behavior (EN). |
config.example.toml |
Adds commented examples and caveats for the new Codex permission override keys. |
agent/codex/session_test.go |
Adds tests for parsing/roundtripping options and for exec arg construction under full/partial overrides. |
agent/codex/session.go |
Routes exec permission handling through a helper that switches between mode flags vs native -c config args. |
agent/codex/codex.go |
Introduces codexPermissionOverrides, parses options, propagates them into sessions, and includes them in workspace options. |
agent/codex/appserver_session_test.go |
Adds tests for app-server startup args and thread/turn RPC params under full/partial overrides, including sandbox_mode validation. |
agent/codex/appserver_session.go |
Passes native -c args to app-server startup and maps thread/turn RPC permission params (including sandboxPolicy mapping). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
a4a02ae to
dd1a864
Compare
chenhg5
approved these changes
Apr 26, 2026
Owner
chenhg5
left a comment
There was a problem hiding this comment.
Review Summary
Clean, well-structured feature for passing Codex native permission settings through cc-connect config. Both exec and app-server paths updated consistently.
✅ Good:
codexPermissionOverridesstruct cleanly encapsulates the three permission axes (approval_policy, approvals_reviewer, sandbox_mode)effectiveForMode()correctly composes user overrides on top of mode defaults — partial overrides work correctlyappendPermissionArgspreserves backward compat: when no permission override is set, falls back to existing--full-auto/--dangerously-bypassflagsappServerSandboxPolicytranslates config strings to app-server structured types (read-only → readOnly, etc.)- Error handling: unknown sandbox_mode returns descriptive error
- Comprehensive tests: 7+ test functions covering full overrides, partial overrides, thread params, turn params, error cases
- Config, example TOML, and docs updated
WorkspaceAgentOptionspropagates permissions to workspace agents
LGTM. Architecture sound, comprehensive tests, CI green.
dd1a864 to
d9e282a
Compare
d9e282a to
af03ed1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
[projects.agent.options]approval_policy,approvals_reviewer, andsandbox_modefor bothcodex execandcodex app-serverDetails
execkeeps existing mode flags unlessapproval_policyorsandbox_modeis explicitly set.approvals_reviewercan be used by itself and supports bothauto_reviewand legacyguardian_subagentvalues.approvalPolicyand threadsandboxuse the Codex app-server schema values (on-request,untrusted,workspace-write, etc.); turnsandboxPolicyis mapped to the structured app-server policy shape.Review follow-up
codexsetup for theNew()options testeffectiveForModehelper used by exec and app-server pathssandboxvssandboxPolicy.typespelling difference in codeapproval_policyis described as forwarding additional Codex-supported values;sandbox_modeis documented as limited to the three mapped valuesValidation
go test ./agent/codex -count=1go test ./config -run "TestSaveProjectSettings_ExtraFields|TestSaveActiveProvider_PreservesCommentsAndUnknownFields|TestSaveAgentModel_PreservesCommentsAndUnknownFields" -count=1go test ./agent/codex -run "Test(WorkspaceAgentOptions|CodexPermission|CodexNewPreservesNativePermissionOptions|BuildExecArgs|AppServer)" -count=1git diff --checkcodex app-server -c approval_policy=... -c approvals_reviewer=... -c sandbox_mode=... --listen stdio://initialize on Windows with Codex CLI0.125.0-alpha.3thread/startwithapprovalPolicy="untrusted"andsandbox="workspace-write"; app-server accepted the params and returnedapprovalPolicy="untrusted"plus aworkspaceWritesandbox policy