mirror of
https://github.com/openai/codex.git
synced 2026-11-18 22:20:48 +00:00
## Why Using Responses Lite does not establish whether a model accepts reasoning-effort `configuration_update` items. Unsupported models need to use the selected request-level effort, including when resuming history containing saved updates. ## What changed - Add `supports_reasoning_effort_updates` model metadata, defaulting to `false`. - Require the override feature, an OpenAI provider, and explicit model support for reasoning effort updates, independently of `use_responses_lite`. - Filter saved configuration updates from unsupported requests without changing persisted history. - Clear the pinned effort baseline when sampling with an unsupported model so returning to a supported model establishes a fresh baseline. Compaction uses the selected effort without clearing the pin. ## Testing Add coverage for supported models with either Responses mode, unsupported-model history filtering over HTTP and WebSocket, switching to an unsupported model and back, and compaction versus sampling pin behavior. Verify missing capability metadata defaults to `false`. GitOrigin-RevId: 8a0fbc141964bd854dbcdd6f31e1c8e97697cf22
107 lines
3.7 KiB
Rust
107 lines
3.7 KiB
Rust
//! Covers literal instruction templates and missing-versus-empty inputs.
|
|
|
|
use super::*;
|
|
use codex_protocol::openai_models::ConfigShellToolType;
|
|
use codex_protocol::openai_models::ModelInstructionsVariables;
|
|
use codex_protocol::openai_models::ModelMessages;
|
|
use codex_protocol::openai_models::ModelVisibility;
|
|
use codex_protocol::openai_models::TruncationPolicyConfig;
|
|
use pretty_assertions::assert_eq;
|
|
|
|
fn test_model(model_messages: Option<ModelMessages>) -> ModelInfo {
|
|
ModelInfo {
|
|
slug: "test-model".to_string(),
|
|
display_name: "Test Model".to_string(),
|
|
description: None,
|
|
default_reasoning_level: None,
|
|
supported_reasoning_levels: vec![],
|
|
shell_type: ConfigShellToolType::UnifiedExec,
|
|
visibility: ModelVisibility::List,
|
|
supported_in_api: true,
|
|
priority: 1,
|
|
additional_speed_tiers: vec![],
|
|
service_tiers: vec![],
|
|
default_service_tier: None,
|
|
available_access_programs: None,
|
|
availability_nux: None,
|
|
upgrade: None,
|
|
model_messages,
|
|
include_skills_usage_instructions: false,
|
|
include_plugin_usage_instructions: false,
|
|
include_apps_usage_instructions: false,
|
|
supports_reasoning_summary_parameter: true,
|
|
default_reasoning_summary: Default::default(),
|
|
support_verbosity: false,
|
|
default_verbosity: None,
|
|
apply_patch_tool_type: None,
|
|
web_search_tool_type: Default::default(),
|
|
truncation_policy: TruncationPolicyConfig::bytes(/*limit*/ 10_000),
|
|
supports_image_detail_original: false,
|
|
context_window: None,
|
|
max_context_window: None,
|
|
auto_compact_token_limit: None,
|
|
comp_hash: None,
|
|
effective_context_window_percent: 95,
|
|
experimental_supported_tools: vec![],
|
|
input_modalities: vec![],
|
|
used_fallback_model_metadata: false,
|
|
supports_search_tool: false,
|
|
supports_experimental_context: false,
|
|
use_responses_lite: false,
|
|
supports_reasoning_effort_updates: false,
|
|
guardian: None,
|
|
node_repl_auto_review_required: false,
|
|
node_repl_disabled: false,
|
|
auto_review_model_override: None,
|
|
model_specialty: None,
|
|
tool_mode: None,
|
|
multi_agent_version: None,
|
|
multi_agent_reasoning_effort: None,
|
|
}
|
|
}
|
|
|
|
#[test]
|
|
fn renders_literal_templates_with_legacy_personality_inputs() {
|
|
let template = "Hello {{ personality }}\n\n# Personality\n\nFixed instructions";
|
|
let model = test_model(Some(ModelMessages {
|
|
instructions_template: Some(template.to_string()),
|
|
instructions_variables: Some(ModelInstructionsVariables {
|
|
personality_default: Some("default".to_string()),
|
|
personality_friendly: Some("friendly".to_string()),
|
|
personality_pragmatic: Some("pragmatic".to_string()),
|
|
}),
|
|
..Default::default()
|
|
}));
|
|
assert_eq!(
|
|
(
|
|
ResolvedModelMessages::from_model(&model).instructions_template(),
|
|
render_model_instructions(&model)
|
|
),
|
|
(Some(template), template.to_string()),
|
|
);
|
|
}
|
|
|
|
#[test]
|
|
fn missing_and_empty_templates_render_empty_but_retain_presence() {
|
|
for (messages, template) in [
|
|
(None, None),
|
|
(Some(ModelMessages::default()), None),
|
|
(
|
|
Some(ModelMessages {
|
|
instructions_template: Some(String::new()),
|
|
..Default::default()
|
|
}),
|
|
Some(""),
|
|
),
|
|
] {
|
|
let model = test_model(messages);
|
|
assert_eq!(
|
|
(
|
|
render_model_instructions(&model),
|
|
ResolvedModelMessages::from_model(&model).instructions_template()
|
|
),
|
|
(String::new(), template),
|
|
);
|
|
}
|
|
}
|