Repository navigation
fix: start sessions in the mode Codex resolved from config - #762
Open
LufeiCheng wants to merge 1 commit into
Open
LufeiCheng wants to merge 1 commit into
LufeiCheng wants to merge 1 commit into
Conversation
session/new, session/load, session/resume and session/fork always started in the `agent` preset, ignoring the sandbox and approval policy Codex resolved from config.toml for the thread. Match the resolved policy from the adapter's own thread/start, thread/resume and thread/fork response to the built-in mode that represents it: danger-full-access with `never` selects agent-full-access, read-only with on-request selects read-only, and workspace-write with on-request keeps agent. Clients no longer need a second Codex process and session/set_mode to recover the starting mode. INITIAL_AGENT_MODE and an active custom permission profile still take precedence. A resolved pair that no built-in mode represents keeps the previous `agent` default. Fixes agentclientprotocol#702 Co-Authored-By: Claude Code <noreply@anthropic.com>
This branch has not been deployed
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
Fixes #702.
session/new,session/load,session/resume, andsession/forknow start in the built-in mode that matches the sandbox and approval policy Codex resolved for the thread, instead of always starting inagent.dangerFullAccess+never→agent-full-access;readOnly+on-request→read-only;workspaceWrite+on-request→agent.thread/start,thread/resume, andthread/forkresponse (sandboxandapprovalPolicy), so clients no longer need a second Codex process plussession/set_modeto recover the mode.INITIAL_AGENT_MODEstill takes precedence, and an active custom permission profile still takes precedence over the resolved policy.agentdefault.This is scoped to the starting mode. Reusing the resolved permissions for every
turn/startis the separate #477/#310 issue.Tests
npm run typechecknpm test: relevant suites pass. The full run still reports the same 4 failures as unmodifiedmainin this environment (JsonSnapshotdeep nesting and threestandard-subagent-livesnapshots), so they are unrelated to this change.session-config-options.test.tsCodexAcpClientsession/new, bothsession/resumevariants, andsession/fork🤖 Generated with Claude Code