Gate experimental context by model capability at session startup (#43147)

## Why

Experimental context activation previously checked the provider and account eligibility without checking model support. Child sessions also inherited token-budget activation from their parent, even when starting fresh with a different model.

## What changed

- Add `ModelInfo.supports_experimental_context`, defaulting to `false`, and enable it for the bundled `gpt-6-astra` model. Require this capability when activating experimental context.
- Snapshot configured token-budget preferences before startup activation. Restore them for fresh child sessions before applying their starting model's defaults, while history forks retain their parent's activation.
- Pass unresolved token-budget preferences to child sessions so they can use their own model's prompts.

## Testing

Extend coverage for unsupported models, model-switch guidance under explicit and experimental activation, and child configuration from both active and inactive parents. Verify that omitted capability metadata defaults to `false`.

GitOrigin-RevId: 02df9e171682267232fa923d5ea3f7af36527808
This commit is contained in:
pmccrary-oai authored and copyberry committed 2026-09-06 02:28:38 +00:00
1 parent 1c40ffe427
commit 6af345407d
21 files changed
+128 -15

No files matched your search

+5
View File
@@ -470,6 +470,9 @@ pub struct ModelInfo {
pub used_fallback_model_metadata: bool,
#[serde(default)]
pub supports_search_tool: bool,
/// Whether experimental context management may be activated at session startup.
#[serde(default)]
pub supports_experimental_context: bool,
#[serde(default)]
pub use_responses_lite: bool,
#[serde(default)]
@@ -1011,6 +1014,7 @@ mod tests {
input_modalities: default_input_modalities(),
used_fallback_model_metadata: false,
supports_search_tool: false,
supports_experimental_context: false,
use_responses_lite: false,
guardian: None,
node_repl_auto_review_required: false,
@@ -1772,6 +1776,7 @@ mod tests {
assert!(!model.supports_image_detail_original);
assert_eq!(model.web_search_tool_type, WebSearchToolType::Text);
assert!(!model.supports_search_tool);
assert!(!model.supports_experimental_context);
assert!(!model.use_responses_lite);
assert!(!model.node_repl_auto_review_required);
assert!(!model.node_repl_disabled);