Allow callers to set the thread source for sampling (#56364)

## What changed

Add optional `threadSource` to `thread/sample` requests and apply it to the ephemeral fork. Keep `thread_sample` as the default when omitted.

## Testing

Extend sampling tests to assert that turn metadata includes the supplied thread source and retains the default when no source is provided.

GitOrigin-RevId: 8ea941c932267e3bcb9e6b086764ac2795d6edef
This commit is contained in:
Keyan Zhang
2026-10-23 06:07:10 +00:00
committed by copyberry
parent 30587d7885
commit a96fa4f220
4 changed files with 13 additions and 1 deletions
@@ -1,5 +1,6 @@
//! One model response on an ephemeral fork that inherits the source's configuration and context.
use super::ThreadSource;
use crate::JsonSchema;
use crate::RequestId;
use crate::TS;
@@ -21,6 +22,8 @@ pub struct ThreadSampleParams {
#[ts(optional = nullable)]
pub effort: Option<ReasoningEffort>,
#[ts(optional = nullable)]
pub thread_source: Option<ThreadSource>,
#[ts(optional = nullable)]
pub turn_trigger: Option<String>,
/// Optional metadata to enrich Codex's ResponsesAPI turn metadata.
#[ts(optional = nullable)]