mirror of
https://github.com/openai/codex.git
synced 2026-11-16 22:00:36 +00:00
## What changed - Initialize item and context-window ID generators per thread, reuse the stored window on resume, and give history reconstruction a separate item generator. - Recover item ordinals from checkpoint replacement history, guardian history, and retained context without lowering the cursor established by earlier records. - Stamp compaction resume metadata with the next item ordinal in append order, tracking the cursor in local and in-memory thread stores. ## Testing Extend the history ordinal test to verify that a checkpoint records the cursor at its position in a batch, excluding later allocations. GitOrigin-RevId: 7121b747a039dc5477235078702137d1ff74e789
13 lines
439 B
Rust
13 lines
439 B
Rust
//! Response item ID allocation for a thread and its consumers.
|
|
|
|
use crate::ResponseItemId;
|
|
use std::sync::Arc;
|
|
|
|
/// Generates IDs for an item kind. Clones share the owning thread's sequence.
|
|
pub type ItemIdGenerator = Arc<dyn Fn(&str) -> ResponseItemId + Send + Sync>;
|
|
|
|
#[cfg(test)]
|
|
pub(super) fn uuid_v7_item_id_generator_for_test() -> ItemIdGenerator {
|
|
Arc::new(|prefix| ResponseItemId::with_suffix(prefix, uuid::Uuid::now_v7()))
|
|
}
|