Separate thread startup metadata from replay history (#46294)

## Why

`CodexThread` retained the full `SessionConfiguredEvent`, including initial replay messages, and cloned it even for callers that only needed thread or session IDs.

## What changed

Store `ThreadStartupMetadata` without replay history and expose it by reference through `startup_metadata()`. Update callers to read IDs from this metadata. When rejoining a running thread, rebuild the startup response using the supplied resume history for `initial_messages`.

## Testing

Extend the resume test to verify that rejoining reuses the loaded thread, preserves startup metadata, and still returns the original replay messages as a prefix.

GitOrigin-RevId: 9d656063088c28f091d29e5862e4b9d894b7642c
This commit is contained in:
Charlie Marsh
2026-09-17 19:55:20 +00:00
committed by copyberry
parent 47fc8d661e
commit 17baabd01b
11 changed files with 171 additions and 25 deletions
+1 -1
View File
@@ -371,7 +371,7 @@ impl QueuedItemService {
queued_item_id: Option<String>,
trace: Option<W3cTraceContext>,
) -> Result<StartIfIdleSubmission, QueueServiceError> {
let thread_id = thread.session_configured().thread_id;
let thread_id = thread.startup_metadata().thread_id;
let _dispatch_guard = self.dispatch_guard(thread_id).await;
let item = self
.list(thread_id)