Files
codex/codex-rs/prompts/src/update_plan_instructions_tests.rs
T
rhan-oai a8c36ca6d2 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
2026-09-16 21:01:13 +00:00

32 lines
1.7 KiB
Rust

//! Checks that filtering omits only the known checklist sections.
use super::without_update_plan_instructions;
use pretty_assertions::assert_eq;
#[test]
fn disabled_omits_checklist_sections_and_preserves_other_planning() {
let instructions = "Before.\n\n## Planning\nYou have access to an `update_plan` tool which tracks steps.\n\n### Examples\nKeep steps current.\n\n## Work\nImplement.\n\n## `update_plan`\nUpdate the checklist.\n\n# Next\n## Planning\nDiscuss architecture and inspect update_plan before editing.\n";
assert_eq!(
without_update_plan_instructions(instructions),
"Before.\n\n## Work\nImplement.\n\n# Next\n## Planning\nDiscuss architecture and inspect update_plan before editing.\n",
);
}
#[test]
fn disabled_omits_legacy_tool_and_plan_mode_cross_reference_sections() {
let instructions = "# Plan Mode\nKeep planning.\n\n## Plan Mode vs update_plan tool\nThe tools are separate.\n\n## Execution\nDo not edit.\n\n## Plan tool\nWhen using the planning tool:\n- Update steps.\n";
assert_eq!(
without_update_plan_instructions(instructions),
"# Plan Mode\nKeep planning.\n\n## Execution\nDo not edit.\n\n",
);
}
#[test]
fn disabled_omits_only_checklist_list_items_and_goal_guidance() {
let instructions = "Keep working.\n- Use the plan tool to explain the work\n - Skip simple tasks.\n - Keep steps current.\n- Explain discoveries.\n- If you create a checklist or task list, update its statuses.\n\nProgress visibility:\nIf update_plan is available, use it for complex work.\n\nCompletion:\nVerify the result.\n";
assert_eq!(
without_update_plan_instructions(instructions),
"Keep working.\n- Explain discoveries.\n\nCompletion:\nVerify the result.\n",
);
}