Skip to content

fix(core) Persist approvals reviewer in turn context#31309

Closed
dylan-hurd-oai wants to merge 1 commit into
mainfrom
fix/persist-approvals-reviewer
Closed

fix(core) Persist approvals reviewer in turn context#31309
dylan-hurd-oai wants to merge 1 commit into
mainfrom
fix/persist-approvals-reviewer

Conversation

@dylan-hurd-oai

@dylan-hurd-oai dylan-hurd-oai commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

Why

Turn-context rollout items did not persist the active approvals reviewer. After a reviewer change, resume, or fork, Codex could therefore retain stale user-review or auto-review permission instructions in model history.

Legacy rollout items need a distinct unknown state: treating a missing reviewer as User would suppress the refresh when an older auto-review session resumes with user review.

What changed

  • persist the active reviewer as Some(ApprovalsReviewer) on newly written turn-context items
  • deserialize missing legacy values as None
  • re-emit permissions instructions whenever the durable reviewer baseline is absent or differs from the active reviewer
  • add integration coverage for reviewer changes and protocol coverage for legacy deserialization

Testing

  • just test -p codex-protocol
  • just test -p codex-core permissions_messages

@dylan-hurd-oai dylan-hurd-oai requested a review from a team as a code owner July 6, 2026 22:46
@dylan-hurd-oai dylan-hurd-oai changed the title Persist approvals reviewer in turn context fix(core) Persist approvals reviewer in turn context Jul 6, 2026
dylan-hurd-oai added a commit that referenced this pull request Jul 7, 2026
## Why

Approval guidance is currently assembled entirely by the client. Model
Messages V2 needs model catalogs to provide model-specific `on_request`
guidance for both user-reviewed and auto-reviewed approval flows while
retaining the existing generated prompt as a compatibility fallback.

## What changed

- add nullable `on_request` and `on_request_auto_review` catalog
messages
- select the message matching the active approvals reviewer for
`on_request` policies
- replace the complete legacy approval section when the selected catalog
value exists, including support for an empty string that suppresses the
section
- retain legacy rendering when the object or selected key is absent, and
for non-`on_request` policies
- preserve approval messages when base-instruction or personality
overrides clear instruction templates
- refresh permissions instructions when the active model changes
- pass catalog messages through initial and incremental permissions
construction

## Relationship to reviewer persistence

PR #31309 independently persists the approvals reviewer in turn context
and refreshes permissions when that reviewer changes. This PR is based
directly on `main` and does not duplicate that rollout migration; once
both land, reviewer switches will also select and append the new catalog
variant.

## Testing

- `just test -p codex-protocol`
- `just test -p codex-prompts`
- `just test -p codex-models-manager`
- `just test -p codex-core permissions_messages`
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.

2 participants