Use StartThreadOptions across thread fork APIs (#44043)

## What changed

Pass `StartThreadOptions` through rollout, loaded-history, and prepared forks instead of separate configuration and startup arguments. Replace `options.initial_history` with the fork snapshot while preserving the other supplied startup options, and update app-server and test callers.

Box the app-server's `thread_fork_inner` future to keep the large fork future out of the shared request dispatcher's stack frame.

GitOrigin-RevId: d54eb8b212dedabaf2c5d99d155637cefd7deb7a
This commit is contained in:
vkg-oai
2026-09-09 04:07:40 +00:00
committed by copyberry
parent ec512d2347
commit 283f34387b
14 changed files with 51 additions and 149 deletions
@@ -574,13 +574,14 @@ impl ThreadRequestProcessor {
app_server_client_version: Option<String>,
client_mcp_extensions: ClientMcpExtensions,
) -> Result<Option<ClientResponsePayload>, JSONRPCErrorError> {
self.thread_fork_inner(
// Keep the large fork future out of the shared request dispatcher's stack frame.
Box::pin(self.thread_fork_inner(
request_id,
params,
app_server_client_name,
app_server_client_version,
client_mcp_extensions,
)
))
.await
.map(|()| None)
}
@@ -5162,31 +5163,27 @@ impl ThreadRequestProcessor {
.await?
};
let fork_options = StartThreadOptions {
thread_source,
parent_trace,
client_mcp_extensions,
reserved_thread_id,
..StartThreadOptions::new(config)
};
let new_thread = if let Some(prepared_fork) = prepared_fork {
self.thread_manager
.fork_prepared_thread(
config,
prepared_fork,
thread_source,
parent_trace,
client_mcp_extensions,
reserved_thread_id,
)
.fork_prepared_thread(fork_options, prepared_fork)
.await
} else {
self.thread_manager
.fork_thread_from_history(
ForkSnapshot::Interrupted,
config,
fork_options,
InitialHistory::Resumed(ResumedHistory {
conversation_id: source_thread_id,
history: history_items,
rollout_path: source_thread.rollout_path.clone(),
}),
thread_source,
parent_trace,
client_mcp_extensions,
reserved_thread_id,
)
.await
};