Replay thread rollback from rollout history#13615
Conversation
|
@codex review this |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3f44378f13
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
codex-rs/core/src/codex.rs
Outdated
| sess.flush_rollout().await; | ||
|
|
||
| let initial_history = | ||
| match RolloutRecorder::get_rollout_history(rollout_path.as_path()).await { |
There was a problem hiding this comment.
Abort rollback if rollout flush fails before replay
thread_rollback replays from disk right after sess.flush_rollout().await, but flush_rollout only logs errors. If flush fails (writer task closed or I/O failure), rollback reads stale rollout data and then replaces in-memory history from that stale snapshot, producing incorrect rollback results. Treat flush failure as a hard rollback error before loading history.
Useful? React with 👍 / 👎.
| let Some(recorder) = recorder else { | ||
| sess.send_event_raw(Event { | ||
| id: turn_context.sub_id.clone(), | ||
| msg: EventMsg::Error(ErrorEvent { | ||
| message: "thread rollback requires a persisted rollout path".to_string(), | ||
| codex_error_info: Some(CodexErrorInfo::ThreadRollbackFailed), |
There was a problem hiding this comment.
Keep rollback working when persistence is unavailable
This change makes rollback fail whenever services.rollout is None. Previously rollback still pruned the active in-memory context; now non-persisted sessions cannot rollback at all despite having valid history. This is a functional regression for ephemeral/no-persistence runs and contradicts rollback’s in-memory behavior.
Useful? React with 👍 / 👎.
Uh oh!
There was an error while loading. Please reload this page.