Allow ThreadManager to customize thread ID generation (#37350)

## What changed

- Add `ThreadManager::with_thread_id_generator` to configure ID allocation for new root, child, and forked threads.
- Keep the standard UUIDv7 generator as the default and preserve stored IDs when resuming threads.
- Add `ThreadId::from_u128` for constructing identifiers from UUID-compatible values.

## Testing

- Cover default allocation, custom IDs across roots, child agents, and forks, and ID preservation on resume.

GitOrigin-RevId: 6c38c862e30a50bad944a994bcbccf7d1e7ada24
This commit is contained in:
keith thornhill authored and copyberry committed 2026-08-07 01:36:22 +00:00
1 parent 912524d6fe
commit 9457f8f734
5 files changed
+211 -5

No files matched your search

+1 -1
View File
@@ -569,7 +569,7 @@ impl Session {
let thread_id = match &initial_history {
InitialHistory::New | InitialHistory::Cleared | InitialHistory::Forked(_) => {
ThreadId::default()
agent_control.generate_thread_id()
}
InitialHistory::Resumed(resumed_history) => resumed_history.conversation_id,
};