Repository navigation
fix(acp): start Codex chats in the access mode Codex allows - #1457
Conversation
roborev: Combined Review (
|
roborev: Combined Review (
|
roborev: Combined Review (
|
roborev: Combined Review (
|
|
Reworking this to also catch npx and standalone codex-acp launches, and saved modes Codex does not offer. |
roborev: Combined Review (
|
4a68df3 to
eab439a
Compare
roborev: Combined Review (
|
roborev: Combined Review (
|
roborev: Combined Review (
|
Codex's workspace-write adapter default can reject the first prompt when the host permits only full access or read-only. Choose a matching mode after the adapter identifies itself, while preserving saved and explicit choices. Keep derived choices temporary so later chats re-read the host policy. Policy mismatches and derivation failures should leave a usable chat with a notice rather than prevent startup.
A launcher can choose read-only inside the adapter without exposing that choice in Forge's environment. Overriding it with full access defeats the user's explicit setting. Use the mode advertised by the adapter as the authority for whether an automatic default is appropriate. Saved choices still take precedence, and derived choices remain temporary.
An explicit agent mode can look identical to the adapter default. Replacing it with full access defeats the user's launch choice. Access probes must use the same launch context as the chat. Wrapper commands can supply settings that their CLI passthrough ignores, so deriving a mode from those probes can override the chat's actual policy. Bind executable lookup the same way as the session before probing.
Repeated assertions made one mode or request change fail several tests, while the first-prompt fixture asserted its own rejection rule. Keep coverage with the tests that own each startup decision, access mapping, and request contract so failures point to the behavior that changed.
Canned replies and resolver stubs cannot catch drift in how Codex loads access settings. Exercise the real CLI boundary with isolated config so global defaults, project overrides, and the adapter's bundled CLI remain covered without rewriting user settings.
A session-only trust override can make an untrusted project's settings appear to authorize Full access. That override must preserve restrictive project settings without turning project preferences into permission grants. Keep startup notices focused on access settings that prevent a matching mode. Workspace-write settings already use the adapter's default Agent mode.
Mode choices apply to the configured agent on its execution host across workspaces. The startup notice described a workspace-only choice and used a default-mode label that differs from the adapter's UI, which could mislead users about the mode and where their choice takes effect.
Overlapping cases obscured which access decision changed, while the mode restoration stub accepted incorrect launch inputs. Keep distinct behavior covered and verify the session context reaches the access probe. A missing sandbox field represents an older Codex reply more accurately than an empty sandbox type. The combined config case also checks that probing leaves the caller's settings intact.
11379d4 to
0d7b443
Compare
roborev: Combined Review (
|
A new Codex ACP chat now starts in a mode your Codex policy allows. If the policy permits only read-only and full access, the first prompt no longer fails with
WorkspaceWrite is not in the allowed set. Before, every chat started in codex-acp's default workspace-write mode.Forge asks Codex which sandbox and approvals it resolves, through a throwaway thread that leaves config and trust alone. Full access with
neverstarts inagent-full-access, but only when an untrusted project's config isn't what grants it. Read-only withon-requeststarts inread-only. Other pairs, or a failed lookup, keep the default and show a notice.A saved mode,
INITIAL_AGENT_MODE, or a launcher's own mode always wins, and the derived mode isn't saved. The lookup runs only forcodex-acp,npx, andbunxlaunches and can add a few seconds to chat start.Refs agentclientprotocol/codex-acp#310