Centralize model-message resolution and rendering in codex-prompts (#46026)

## What changed

- Add `ResolvedModelMessages` to resolve catalog text and bundled defaults while preserving explicit empty overrides and their source.
- Move base-instruction rendering, Guardian prompt composition, multi-agent role rendering, and `update_plan` guidance filtering into `codex-prompts`; migrate consumers to the shared APIs.
- Separate permission-profile resolution from prompt composition, and annotate Guardian policy and classifier instructions with content kinds.

## Testing

Add and update coverage for missing versus empty templates, literal overrides, multi-agent role composition, Guardian policy substitution and truncation, and preservation of permission path spellings and order.

GitOrigin-RevId: 52335bb7acec0f432d5c57acb2accd5f0276056e
This commit is contained in:
rhan-oai authored and copyberry committed 2026-09-16 21:01:13 +00:00
1 parent 0d083092b4
commit a8c36ca6d2
94 files changed
+2345 -2000

No files matched your search

@@ -25,6 +25,7 @@ use codex_external_agent_migration::sessions::detect_imported_cla_session_connec
use codex_external_agent_migration::sessions::prepare_validated_session_import_with_metadata_mode;
use codex_external_agent_migration::sessions::record_completed_session_imports;
use codex_models_manager::manager::RefreshStrategy;
use codex_prompts::render_model_instructions;
use codex_protocol::ThreadId;
use codex_protocol::models::BaseInstructions;
use codex_protocol::models::BaseInstructionsProvenance;
@@ -467,7 +468,7 @@ impl ExternalAgentSessionImporter {
text: config
.base_instructions
.clone()
.unwrap_or_else(|| model_info.get_model_instructions(config.personality)),
.unwrap_or_else(|| render_model_instructions(&model_info)),
provenance: Some(config.base_instructions_provenance.clone().unwrap_or_else(
|| {
if config.base_instructions.is_some() {