Preserve prewarmed reasoning effort across replay and early rollback (#44285)

## Why

Initial history replay and rollback before the first turn could clear the reasoning-effort baseline established by startup prewarm, preventing the first request from preserving that baseline when the selected effort changes.

## What changed

Preserve the reasoning-effort pin during history reconstruction. Clear it on rollback only after startup prewarm has been consumed. With reasoning-effort overrides enabled, a prewarmed `medium` baseline remains on the request while a subsequent `high` selection is sent as a `configuration_update`.

## Testing

Add regression coverage for prewarm completing before initial replay on resume and fork. Expand WebSocket tests to cover resumed and forked threads with overrides enabled and disabled, plus rollback before the first turn.

GitOrigin-RevId: 2e2d0e8a06b24f01b717458ca0576d63107c7697
This commit is contained in:
felixxia-oai authored and copyberry committed 2026-09-09 19:38:24 +00:00
1 parent bb71d758cd
commit 5d3f8752fc
6 files changed
+163 -22

No files matched your search

+3 -2
View File
@@ -30,8 +30,9 @@ use codex_protocol::protocol::TurnContextItem;
use codex_utils_output_truncation::TruncationPolicy;
use tokio_util::task::AbortOnDropHandle;
/// Runtime request effort. A successful compaction can establish a fresh baseline, while
/// startup and replay must explicitly re-establish the selected effort in surviving history.
/// Runtime request effort, initially unset and established by prewarm or sampling.
/// Rollback clears it after startup prewarm is consumed; successful compaction allows
/// a fresh baseline without an override.
pub(crate) enum ReasoningEffortPin {
Unset,
Compacted,