Skip to content

fix: respect managed approval requirements in modes and AIR failure titles (IJAI-7269) - #848

Merged
EugeneTheDev merged 2 commits into
mainfrom
IJAI-7269-auto-review-requirements
Dec 5, 2026
Merged

EugeneTheDev merged 2 commits into
mainfrom
IJAI-7269-auto-review-requirements

Conversation

@EugeneTheDev

Copy link
Copy Markdown
Collaborator

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 user as the approvals reviewer. Codex rejects every turn/start of the default Auto review mode (approvals_reviewer: auto_review) with invalid 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 setup (new, load, resume, fork) and session/options now also read configRequirements/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.
  • When Auto review is omitted, sessions start in workspace-write, then read-only. Selecting an omitted mode returns invalid params. An INITIAL_AGENT_MODE the requirements disallow falls back the same way.
  • Every mode stays offered when Codex reports no requirements, when the request fails, or when the requirements allow none of the modes.
  • allowedApprovalsReviewers belongs to Codex's experimental schema. The adapter declares it next to the other experimental fields.

AIR sessionFailure titles a rejected app-server request with its message

  • A prompt whose app-server request Codex rejects now gets a sessionFailure record titled with Codex's message. Before, the title was "Codex encountered an internal error." Category and actions are unchanged (service, retry and new_session).
  • An app-server exit still uses "Connection to Codex was lost.", and an unexpected adapter error still uses "Codex encountered an internal error." Raw adapter error text and process stderr are still never sent.
  • The record and the v2 prompt failure now take their text from one helper, so after insertion the v2 idle error.message and the record title match.

What a client gets for a rejected turn/start:

Client Before After
v1 -32603 "Internal error", Codex text in data.details unchanged
v1 + AIR sessionFailure (Air) end_turn, record titled "Codex encountered an internal error." end_turn, record titled with the Codex message
v2 -32603 "Internal error", Codex text in data.details unchanged
v2 + AIR, before insertion -32600 with the Codex message, no record unchanged
v2 + AIR, after insertion idle error.message is the Codex message, record title is generic both are the Codex message

Docs

  • 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 for sessionFailure clients 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.toml set to allowed_approvals_reviewers = ["user"]. Codex has no per-user location for these requirements.

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.
@EugeneTheDev
EugeneTheDev merged commit c2fa0a4 into main Dec 5, 2026
6 checks passed
@EugeneTheDev
EugeneTheDev deleted the IJAI-7269-auto-review-requirements branch December 5, 2026 00:02
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