mirror of
https://github.com/openai/codex.git
synced 2026-04-27 09:51:03 +03:00
Relax resumed snapshot invariant
Keep the local truncate invariant visible in debug builds, but fall back to forked history instead of panicking if a resumed history ever reaches snapshot_fork_history. Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
@@ -877,7 +877,23 @@ fn snapshot_fork_history(
|
||||
history.push(RolloutItem::ResponseItem(interrupted_turn_history_marker()));
|
||||
InitialHistory::Forked(history)
|
||||
}
|
||||
(InitialHistory::Resumed(_), _) => unreachable!("truncate_before_nth_user_message"),
|
||||
(InitialHistory::Resumed(resumed), ForkSnapshotMode::Committed) => {
|
||||
debug_assert!(
|
||||
false,
|
||||
"truncate_before_nth_user_message should not return InitialHistory::Resumed"
|
||||
);
|
||||
InitialHistory::Forked(resumed.history)
|
||||
}
|
||||
(InitialHistory::Resumed(mut resumed), ForkSnapshotMode::Interrupted) => {
|
||||
debug_assert!(
|
||||
false,
|
||||
"truncate_before_nth_user_message should not return InitialHistory::Resumed"
|
||||
);
|
||||
resumed
|
||||
.history
|
||||
.push(RolloutItem::ResponseItem(interrupted_turn_history_marker()));
|
||||
InitialHistory::Forked(resumed.history)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user