Files
codex/codex-rs/prompts/src/lib.rs
T
Dylan Hurd 358575465c Use model catalog approval messages (#31312)
## 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`
2026-07-07 10:52:38 -07:00

27 lines
901 B
Rust

mod apply_patch;
mod compact;
mod goals;
mod permissions_instructions;
mod realtime;
mod review_exit;
mod review_request;
pub use apply_patch::APPLY_PATCH_TOOL_INSTRUCTIONS;
pub use compact::SUMMARIZATION_PROMPT;
pub use compact::SUMMARY_PREFIX;
pub use goals::budget_limit_prompt;
pub use goals::continuation_prompt;
pub use goals::objective_updated_prompt;
pub use permissions_instructions::ApprovalPromptContext;
pub use permissions_instructions::PermissionsInstructions;
pub use realtime::BACKEND_PROMPT;
pub use realtime::END_INSTRUCTIONS;
pub use realtime::START_INSTRUCTIONS;
pub use review_exit::render_review_exit_interrupted;
pub use review_exit::render_review_exit_success;
pub use review_request::REVIEW_PROMPT;
pub use review_request::ResolvedReviewRequest;
pub use review_request::resolve_review_request;
pub use review_request::review_prompt;
pub use review_request::user_facing_hint;