mirror of
https://github.com/openai/codex.git
synced 2026-11-20 22:40:37 +00:00
## 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
22 lines
670 B
Rust
22 lines
670 B
Rust
//! Protocol fixtures and text assertions shared by test targets.
|
|
|
|
use codex_protocol::models::ContentItem;
|
|
|
|
/// Assertion helpers for tests that require text rather than media content.
|
|
/// Implementations should fail at the calling assertion for non-text content.
|
|
pub trait ContentItemTestExt {
|
|
/// Extracts text, panicking at the call site when the content is not text.
|
|
#[track_caller]
|
|
fn expect_text(self) -> String;
|
|
}
|
|
|
|
impl ContentItemTestExt for ContentItem {
|
|
#[track_caller]
|
|
fn expect_text(self) -> String {
|
|
match self.into_text() {
|
|
Some(text) => text,
|
|
None => panic!("expected text content"),
|
|
}
|
|
}
|
|
}
|