Filter saved reasoning overrides from requests when disabled (#46291)

## Why

Resuming a thread after disabling reasoning effort overrides still sent saved `configuration_update` items until compaction. Disabling the feature should also apply to requests built from existing history.

## What changed

Pass the `ReasoningEffortOverride` feature state into `ModelClient` and filter `configuration_update` items from request input when disabled. Preserve persisted history and other input items while using the request-level reasoning effort.

## Testing

Add regression coverage for resumed threads, compaction, and WebSocket warmup and turn requests. Verify that saved updates remain in history and `agent_message` items remain in request input.

GitOrigin-RevId: aac3257da1ca38a0744807c4f7cb12565bd7fe53
This commit is contained in:
felixxia-oai
2026-09-17 19:42:56 +00:00
committed by copyberry
parent 0fd1cd8d99
commit 47915cee7a
9 changed files with 136 additions and 15 deletions
+8
View File
@@ -203,6 +203,7 @@ struct ModelClientState {
originator: String,
model_verbosity: Option<VerbosityConfig>,
content_item_kinds_enabled: bool,
reasoning_effort_override_enabled: bool,
enable_request_compression: bool,
include_timing_metrics: bool,
beta_features_header: Option<String>,
@@ -476,6 +477,7 @@ impl ModelClient {
originator: String,
model_verbosity: Option<VerbosityConfig>,
content_item_kinds_enabled: bool,
reasoning_effort_override_enabled: bool,
enable_request_compression: bool,
include_timing_metrics: bool,
beta_features_header: Option<String>,
@@ -502,6 +504,7 @@ impl ModelClient {
originator,
model_verbosity,
content_item_kinds_enabled,
reasoning_effort_override_enabled,
enable_request_compression,
include_timing_metrics,
beta_features_header,
@@ -856,6 +859,11 @@ impl ModelClient {
responses_metadata: &CodexResponsesMetadata,
) -> Result<ResponsesApiRequest> {
let mut input = prompt.get_formatted_input_for_request(model_info);
if !self.state.reasoning_effort_override_enabled {
// Disabling overrides must also recover threads with saved updates.
// Filter only the request copy; persisted history remains unchanged.
input.retain(|item| !matches!(item, ResponseItem::ConfigurationUpdate { .. }));
}
let is_openai = self.state.provider.info().is_openai();
let (instructions, tools) = if model_info.use_responses_lite {
// These prompt-only items are rebuilt on every request. Hash their visible payloads