Reject token-budget history notes for unsupported starting models (#44883)

## What changed

After resolving startup configuration and model defaults, reject `features.token_budget.use_history_notes_extension` when the starting model lacks `supports_experimental_context`. Return an error directing users to disable the option or select a compatible model.

## Testing

Add startup coverage for explicit configuration and model defaults, verifying rejection for unsupported models and successful activation for supported models and standalone token budgets. Update history-notes test fixtures to declare experimental context support.

GitOrigin-RevId: abf1a024efc5acf97cfc858fbb93821363769dc0
This commit is contained in:
jif
2026-09-11 17:55:03 +00:00
committed by copyberry
parent 33bdf976cc
commit 4dcce4f0c4
5 changed files with 102 additions and 0 deletions
+10
View File
@@ -707,6 +707,16 @@ impl Session {
&model_info,
)?;
token_budget::apply_model_defaults(Arc::make_mut(&mut config), &model_info);
if config
.token_budget
.as_ref()
.is_some_and(|token_budget| token_budget.use_history_notes_extension)
&& !model_info.supports_experimental_context
{
return Err(CodexErr::InvalidRequest(format!(
"features.token_budget.use_history_notes_extension is not supported by model `{model}`; disable it or select a model that supports experimental context"
)));
}
}
let configured_config = Arc::clone(&config);
let multi_agent_version = config.multi_agent_version_override().or_else(|| {