Gate Apps usage instructions by model capability (#37145)

## What changed

- Add `include_apps_usage_instructions` to model metadata, defaulting to true for compatibility with existing metadata.
- Emit generic Apps guidance only when apps are available and the selected model enables it.
- Enable the capability for interactive model presets while leaving `codex-auto-review` and local models opted out.

## Testing

- Verify that missing metadata defaults to enabled and an explicit opt-out survives serialization.

GitOrigin-RevId: 6a20573cddfd3b80083d2b4b015829b49e6cc283
This commit is contained in:
rhan-oai
2026-08-05 20:03:13 +00:00
committed by copyberry
parent 72d937ed4d
commit 2b915a2eed
15 changed files with 43 additions and 1 deletions
@@ -44,6 +44,7 @@ fn preset_to_info(preset: &ModelPreset, priority: i32) -> ModelInfo {
}),
include_skills_usage_instructions: false,
include_plugin_usage_instructions: false,
include_apps_usage_instructions: false,
supports_reasoning_summary_parameter: true,
default_reasoning_summary: ReasoningSummary::Auto,
support_verbosity: false,
@@ -82,6 +82,7 @@ async fn models_client_hits_models_endpoint() {
model_messages: None,
include_skills_usage_instructions: false,
include_plugin_usage_instructions: false,
include_apps_usage_instructions: false,
supports_reasoning_summary_parameter: true,
default_reasoning_summary: ReasoningSummary::Auto,
support_verbosity: false,
+5 -1
View File
@@ -204,7 +204,11 @@ impl Session {
} else {
false
};
world_state.add_section(AppsInstructionsState::new(apps_available));
let apps_usage_instructions_available =
apps_available && turn_context.model_info.include_apps_usage_instructions;
world_state.add_section(AppsInstructionsState::new(
apps_usage_instructions_available,
));
let plugins_usage_instructions_available = step_context.mcp.plugins_available()
&& turn_context.model_info.include_plugin_usage_instructions;
world_state.add_section(PluginsInstructionsState::new(
+1
View File
@@ -272,6 +272,7 @@ fn remote_model_with_auto_review_override(slug: &str, review_model: &str) -> Mod
model_messages: None,
include_skills_usage_instructions: false,
include_plugin_usage_instructions: false,
include_apps_usage_instructions: false,
supports_reasoning_summary_parameter: true,
default_reasoning_summary: ReasoningSummary::Auto,
support_verbosity: false,
@@ -101,6 +101,7 @@ fn test_model_info(
model_messages: None,
include_skills_usage_instructions: false,
include_plugin_usage_instructions: false,
include_apps_usage_instructions: false,
supports_reasoning_summary_parameter: true,
default_reasoning_summary: ReasoningSummary::Auto,
support_verbosity: false,
@@ -966,6 +967,7 @@ async fn model_switch_to_smaller_model_updates_token_context_window() -> Result<
model_messages: None,
include_skills_usage_instructions: false,
include_plugin_usage_instructions: false,
include_apps_usage_instructions: false,
supports_reasoning_summary_parameter: true,
default_reasoning_summary: ReasoningSummary::Auto,
support_verbosity: false,
@@ -513,6 +513,7 @@ fn test_remote_model(slug: &str, priority: i32) -> ModelInfo {
}),
include_skills_usage_instructions: false,
include_plugin_usage_instructions: false,
include_apps_usage_instructions: false,
supports_reasoning_summary_parameter: true,
default_reasoning_summary: ReasoningSummary::Auto,
support_verbosity: false,
+2
View File
@@ -648,6 +648,7 @@ async fn remote_model_friendly_personality_instructions_with_feature() -> anyhow
}),
include_skills_usage_instructions: false,
include_plugin_usage_instructions: false,
include_apps_usage_instructions: false,
supports_reasoning_summary_parameter: true,
default_reasoning_summary: ReasoningSummary::Auto,
support_verbosity: false,
@@ -770,6 +771,7 @@ async fn user_turn_personality_remote_model_template_includes_update_message() -
}),
include_skills_usage_instructions: false,
include_plugin_usage_instructions: false,
include_apps_usage_instructions: false,
supports_reasoning_summary_parameter: true,
default_reasoning_summary: ReasoningSummary::Auto,
support_verbosity: false,
@@ -539,6 +539,7 @@ async fn remote_models_remote_model_uses_unified_exec() -> Result<()> {
model_messages: None,
include_skills_usage_instructions: false,
include_plugin_usage_instructions: false,
include_apps_usage_instructions: false,
supports_reasoning_summary_parameter: true,
default_reasoning_summary: ReasoningSummary::Auto,
support_verbosity: false,
@@ -802,6 +803,7 @@ async fn remote_models_apply_legacy_instructions() -> Result<()> {
}),
include_skills_usage_instructions: false,
include_plugin_usage_instructions: false,
include_apps_usage_instructions: false,
supports_reasoning_summary_parameter: true,
default_reasoning_summary: ReasoningSummary::Auto,
support_verbosity: false,
@@ -1378,6 +1380,7 @@ fn test_remote_model_with_policy(
model_messages: None,
include_skills_usage_instructions: false,
include_plugin_usage_instructions: false,
include_apps_usage_instructions: false,
supports_reasoning_summary_parameter: true,
default_reasoning_summary: ReasoningSummary::Auto,
support_verbosity: false,
+1
View File
@@ -2210,6 +2210,7 @@ async fn stdio_image_responses_are_sanitized_for_text_only_model() -> anyhow::Re
model_messages: None,
include_skills_usage_instructions: false,
include_plugin_usage_instructions: false,
include_apps_usage_instructions: false,
supports_reasoning_summary_parameter: true,
default_reasoning_summary: ReasoningSummary::Auto,
support_verbosity: false,
@@ -82,6 +82,7 @@ fn test_model_info(
model_messages: None,
include_skills_usage_instructions: false,
include_plugin_usage_instructions: false,
include_apps_usage_instructions: false,
supports_reasoning_summary_parameter: true,
default_reasoning_summary: ReasoningSummary::Auto,
support_verbosity: false,
+1
View File
@@ -1481,6 +1481,7 @@ async fn view_image_tool_returns_unsupported_message_for_text_only_model() -> an
model_messages: None,
include_skills_usage_instructions: false,
include_plugin_usage_instructions: false,
include_apps_usage_instructions: false,
supports_reasoning_summary_parameter: true,
default_reasoning_summary: ReasoningSummary::Auto,
support_verbosity: false,
+8
View File
@@ -22,6 +22,7 @@
"use_responses_lite": true,
"include_skills_usage_instructions": false,
"include_plugin_usage_instructions": true,
"include_apps_usage_instructions": true,
"auto_review_model_override": null,
"context_window": 272000,
"max_context_window": 272000,
@@ -136,6 +137,7 @@
"use_responses_lite": true,
"include_skills_usage_instructions": false,
"include_plugin_usage_instructions": true,
"include_apps_usage_instructions": true,
"auto_review_model_override": null,
"context_window": 272000,
"max_context_window": 272000,
@@ -248,6 +250,7 @@
"use_responses_lite": true,
"include_skills_usage_instructions": false,
"include_plugin_usage_instructions": true,
"include_apps_usage_instructions": true,
"auto_review_model_override": null,
"context_window": 272000,
"max_context_window": 272000,
@@ -356,6 +359,7 @@
"use_responses_lite": false,
"include_skills_usage_instructions": true,
"include_plugin_usage_instructions": true,
"include_apps_usage_instructions": true,
"auto_review_model_override": null,
"context_window": 272000,
"max_context_window": 272000,
@@ -462,6 +466,7 @@
"use_responses_lite": false,
"include_skills_usage_instructions": true,
"include_plugin_usage_instructions": true,
"include_apps_usage_instructions": true,
"auto_review_model_override": null,
"context_window": 272000,
"max_context_window": 1000000,
@@ -566,6 +571,7 @@
"use_responses_lite": false,
"include_skills_usage_instructions": true,
"include_plugin_usage_instructions": true,
"include_apps_usage_instructions": true,
"auto_review_model_override": null,
"context_window": 272000,
"max_context_window": 272000,
@@ -665,6 +671,7 @@
"use_responses_lite": false,
"include_skills_usage_instructions": true,
"include_plugin_usage_instructions": true,
"include_apps_usage_instructions": true,
"auto_review_model_override": null,
"context_window": 272000,
"max_context_window": 272000,
@@ -761,6 +768,7 @@
"use_responses_lite": false,
"include_skills_usage_instructions": true,
"include_plugin_usage_instructions": false,
"include_apps_usage_instructions": false,
"auto_review_model_override": null,
"context_window": 272000,
"max_context_window": 1000000,
@@ -155,6 +155,7 @@ pub fn model_info_from_slug(slug: &str) -> ModelInfo {
model_messages: Some(local_model_messages_for_slug(slug)),
include_skills_usage_instructions: false,
include_plugin_usage_instructions: false,
include_apps_usage_instructions: false,
supports_reasoning_summary_parameter: true,
default_reasoning_summary: ReasoningSummary::Auto,
support_verbosity: false,
+14
View File
@@ -394,6 +394,8 @@ pub struct ModelInfo {
pub include_skills_usage_instructions: bool,
#[serde(default)]
pub include_plugin_usage_instructions: bool,
#[serde(default = "default_true")]
pub include_apps_usage_instructions: bool,
/// Whether the model accepts the Responses API `reasoning.summary` parameter.
#[serde(default = "default_true", skip_serializing_if = "is_true")]
pub supports_reasoning_summary_parameter: bool,
@@ -831,6 +833,7 @@ mod tests {
model_messages: spec,
include_skills_usage_instructions: false,
include_plugin_usage_instructions: false,
include_apps_usage_instructions: false,
supports_reasoning_summary_parameter: true,
default_reasoning_summary: ReasoningSummary::Auto,
support_verbosity: false,
@@ -1424,6 +1427,7 @@ mod tests {
);
assert!(!model.include_skills_usage_instructions);
assert!(!model.include_plugin_usage_instructions);
assert!(model.include_apps_usage_instructions);
assert!(model.supports_reasoning_summary_parameter);
assert!(!model.supports_image_detail_original);
assert_eq!(model.web_search_tool_type, WebSearchToolType::Text);
@@ -1434,6 +1438,16 @@ mod tests {
assert_eq!(model.tool_mode, None);
}
#[test]
fn model_info_preserves_explicit_apps_guidance_opt_out() {
let value = serde_json::to_value(test_model(/*spec*/ None))
.expect("serialize model info with explicit apps guidance opt-out");
assert_eq!(value["include_apps_usage_instructions"], false);
let model = serde_json::from_value::<ModelInfo>(value).expect("deserialize model info");
assert!(!model.include_apps_usage_instructions);
}
#[test]
fn model_info_deserializes_known_tool_mode() {
let mut value =
+1
View File
@@ -28,6 +28,7 @@ fn model_with_shell_type(shell_type: ConfigShellToolType) -> ModelInfo {
model_messages: None,
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,