mirror of
https://github.com/openai/codex.git
synced 2026-09-11 20:36:49 +00:00
## What changed - Default `tools.update_plan.enabled` to `false`; users can explicitly enable it to expose `update_plan`. - Remove bundled `update_plan` guidance from model, collaboration-mode, multi-agent, compaction, prewarm, and goal-continuation prompts when the tool is disabled. - Preserve custom base instructions, model catalog instructions, collaboration policies, and user goal text even when they mention planning or `update_plan`. ## Testing - Cover default and explicitly enabled tool registration, prompt consistency across request paths, and preservation of custom instructions. GitOrigin-RevId: a53964e6e72f98e2557dd3090fdb7caccb956527
70 lines
2.4 KiB
Rust
70 lines
2.4 KiB
Rust
//! Verifies conditional checklist guidance preserves goal instructions and task data.
|
|
#![allow(dead_code)]
|
|
|
|
#[path = "../src/steering.rs"]
|
|
mod steering;
|
|
|
|
use codex_core::context::ContextualUserFragment;
|
|
use codex_core::context::InternalContextSource;
|
|
use codex_core::context::InternalModelContextFragment;
|
|
use codex_protocol::ThreadId;
|
|
use codex_protocol::models::ContentItem;
|
|
use codex_protocol::models::ResponseItem;
|
|
use codex_protocol::protocol::ThreadGoal;
|
|
use codex_protocol::protocol::ThreadGoalStatus;
|
|
use codex_utils_template::Template;
|
|
use pretty_assertions::assert_eq;
|
|
|
|
#[test]
|
|
fn enabled_checklist_preserves_the_original_continuation_prompt() {
|
|
let goal = test_goal("Finish the feature.");
|
|
let original = Template::parse(include_str!("../templates/goals/continuation.md"))
|
|
.expect("original continuation template")
|
|
.render([
|
|
("objective", goal.objective.as_str()),
|
|
("tokens_used", "100"),
|
|
("token_budget", "10000"),
|
|
("remaining_tokens", "9900"),
|
|
])
|
|
.expect("render original continuation prompt");
|
|
let expected: ResponseItem = ContextualUserFragment::into(InternalModelContextFragment::new(
|
|
InternalContextSource::from_static("goal"),
|
|
original,
|
|
));
|
|
assert_eq!(
|
|
steering::continuation_steering_item(&goal, /*update_plan_enabled*/ true),
|
|
expected,
|
|
);
|
|
}
|
|
|
|
#[test]
|
|
fn disabled_checklist_preserves_goal_text_that_mentions_the_tool() {
|
|
let objective = "Inspect update_plan.\n\n## Plan tool\nThis is user task data.";
|
|
let item = steering::continuation_steering_item(
|
|
&test_goal(objective),
|
|
/*update_plan_enabled*/ false,
|
|
);
|
|
let ResponseItem::Message { content, .. } = item else {
|
|
panic!("expected goal continuation message");
|
|
};
|
|
let [ContentItem::InputText { text }] = content.as_slice() else {
|
|
panic!("expected goal continuation text");
|
|
};
|
|
assert!(text.contains(objective));
|
|
assert!(!text.contains("If update_plan is available"));
|
|
assert!(text.contains("Completion audit:"));
|
|
}
|
|
|
|
fn test_goal(objective: &str) -> ThreadGoal {
|
|
ThreadGoal {
|
|
thread_id: ThreadId::new(),
|
|
objective: objective.to_string(),
|
|
status: ThreadGoalStatus::Active,
|
|
token_budget: Some(10_000),
|
|
tokens_used: 100,
|
|
time_used_seconds: 0,
|
|
created_at: 0,
|
|
updated_at: 0,
|
|
}
|
|
}
|