Commit Graph
2 Commits
Author SHA1 Message Date
Ruslan Nigmatullin 30607648d9 Centralize request and prefix ID handling in ThreadContextIds (#62635)
## What changed

Move ID derivation for base instructions and Responses Lite tool definitions
into `ThreadContextIds`. These items keep the same thread-scoped,
content-derived UUIDs when rebuilt for a request.

Invoke prefix ID assignment for newly rendered items during history
replacement and when publishing initial context into empty history.
The UUID allocator leaves these items to ordinary response item ID
allocation.

GitOrigin-RevId: f230a58e3264894bddfd5a250a4b6d1baeabecf0
2026-11-20 01:20:38 +00:00
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