mirror of
https://github.com/openai/codex.git
synced 2026-11-26 23:40:43 +00:00
Keep only the latest adjacent reasoning effort update in requests (#55293)
## Why Turn recovery and retries after a server overload can leave consecutive reasoning effort updates in history when settings change without an intervening message. Requests should use the latest update in each consecutive run. ## What changed Coalesce adjacent `configuration_update` items when building Responses requests with reasoning effort overrides enabled, retaining the latest update. Preserve saved history and updates separated by other input items. ## Testing Extend integration coverage for recovery with unchanged or changed effort, retries after a server overload, and WebSocket continuation and replay after coalescing. Verify that requests retain the latest adjacent update while saved history keeps all updates. GitOrigin-RevId: bcf97db4c93dac5f466bd276176ac9d238329ecd
This commit is contained in:
@@ -968,6 +968,18 @@ impl ModelClient {
|
||||
// Unsupported models and disabled overrides must also accept saved history.
|
||||
// Filter only the request copy; persisted history remains unchanged.
|
||||
input.retain(|item| !matches!(item, ResponseItem::ConfigurationUpdate { .. }));
|
||||
} else {
|
||||
input.dedup_by(|next, previous| {
|
||||
if matches!(next, ResponseItem::ConfigurationUpdate { .. })
|
||||
&& matches!(previous, ResponseItem::ConfigurationUpdate { .. })
|
||||
{
|
||||
// Keep the latest update; dedup_by removes `next`.
|
||||
std::mem::swap(previous, next);
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
});
|
||||
}
|
||||
let is_openai = self.state.provider.info().is_openai();
|
||||
// These prompt-only items are rebuilt on every request. Hash their visible payloads
|
||||
|
||||
Reference in New Issue
Block a user