Repository navigation
fix: respect managed approval requirements in modes and AIR failure titles (IJAI-7269) - #848
Merged
Merged
Conversation
Codex rejects every turn whose approval policy, approvals reviewer or sandbox mode the managed requirements forbid. With `allowed_approvals_reviewers = ["user"]`, e.g. from a ChatGPT workspace, the default Auto review mode failed every prompt. Session setup and session/options now read configRequirements/read and omit the modes that use a disallowed value. The default falls back from Auto review to Workspace access, then Read-only. Selecting an omitted mode returns invalid params. Without requirements, or when the read fails, every mode stays offered.
…I-7269) A prompt whose app-server request Codex rejects, such as turn/start with settings that managed requirements disallow, gave AIR clients a sessionFailure record titled "Codex encountered an internal error." and dropped the Codex message. The record now uses the same user-facing message as the v2 failure. Process exits and unexpected adapter errors keep their fixed titles. The AIR docs now state how a failed prompt reaches a sessionFailure client on ACP v1 and v2.
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.
Problem
IJAI-7269: in Air, every prompt of a new Codex session failed with "Codex encountered an internal error." The reporter's ChatGPT workspace has managed requirements that only allow
useras the approvals reviewer. Codex rejects everyturn/startof the default Auto review mode (approvals_reviewer: auto_review) withinvalid thread settings override: … AutoReview is not in the allowed set [User]. The adapter still offered that mode and started in it, so no prompt could succeed. Air then showed a generic title instead of Codex's message.Change
Modes follow managed requirements
session/optionsnow also readconfigRequirements/read. On ACP v1 and v2, the adapter omits every built-in or permission-profile mode whose approval policy, approvals reviewer or sandbox mode the requirements disallow. This matches how the Codex TUI disables such presets.workspace-write, thenread-only. Selecting an omitted mode returns invalid params. AnINITIAL_AGENT_MODEthe requirements disallow falls back the same way.allowedApprovalsReviewersbelongs to Codex's experimental schema. The adapter declares it next to the other experimental fields.AIR
sessionFailuretitles a rejected app-server request with its messagesessionFailurerecord titled with Codex's message. Before, the title was "Codex encountered an internal error." Category and actions are unchanged (service,retryandnew_session).idleerror.messageand the record title match.What a client gets for a rejected
turn/start:-32603 "Internal error", Codex text indata.detailssessionFailure(Air)end_turn, record titled "Codex encountered an internal error."end_turn, record titled with the Codex message-32603 "Internal error", Codex text indata.details-32600with the Codex message, no recordidleerror.messageis the Codex message, record title is genericDocs
docs/permission-profiles.md: how managed requirements limit the offered modes, and the new default fallback.docs/air-extensions.md: a new Prompt failures contract forsessionFailureclients on v1 and v2, and the title rule for rejected app-server requests.I reproduced the issue with real Codex 0.174.0 and verified both fixes in a Linux container with
/etc/codex/requirements.tomlset toallowed_approvals_reviewers = ["user"]. Codex has no per-user location for these requirements.