Files
codex/codex-rs/thread-context-ids/tests/thread_context_ids_test.rs
T
Ruslan Nigmatullin 583ec348cf Centralize thread context ID allocation (#62633)
## Why

Response item IDs and context window IDs use separate generator callbacks.
A shared allocator gives history and inference a single API for both.

## What changed

Use `ThreadContextIds` to allocate response item IDs, retained-context
revisions, and compaction window IDs. Move initial window selection into
`InitialHistory` so resumed threads reuse a valid window ID from their
rollout. Give rollout reconstruction its own allocator.

Assign hook prompt IDs through the session's normal response item
recording path.

## Testing

Move the prefixed UUIDv7 item ID test to the allocator crate and add
coverage for JSON escaping in Guardian's item ID token budget.

GitOrigin-RevId: 31232f50648382033506d1f86815ce7c1de78378
2026-11-20 00:44:31 +00:00

16 lines
420 B
Rust

#![cfg(test)]
use codex_thread_context_ids_test_support::thread_context_ids;
use pretty_assertions::assert_eq;
use uuid::Uuid;
#[test]
fn creates_prefixed_uuid_v7_ids() {
let id = thread_context_ids().next_item("msg");
let uuid = id.strip_prefix("msg_").expect("message prefix");
assert_eq!(
Uuid::parse_str(uuid).expect("UUID suffix").get_version(),
Some(uuid::Version::SortRand)
);
}