mirror of
https://github.com/openai/codex.git
synced 2026-11-15 21:50:46 +00:00
Expose the model selected for a running turn's next step (#50128)
## What changed Add `CodexThread::current_turn_model` to return the model slug selected for the named running turn's next step, independently of settings for future turns. Return `None` when the turn ID does not match, the task is cancelled, or the turn is no longer running. ## Testing Extend the step-settings test to verify that the accessor ignores model changes for future turns, reflects active-turn model updates, and returns `None` for a mismatched ID or a completed turn. GitOrigin-RevId: 2cae7c07fa761ed4d64befaa3419a2f9bce4b161
This commit is contained in:
@@ -304,6 +304,17 @@ impl CodexThread {
|
||||
task.turn_context.extension_data.get::<T>()
|
||||
}
|
||||
|
||||
/// Returns the model selected for the named running turn's next step, not future turns.
|
||||
/// Returns `None` if that turn is no longer running.
|
||||
pub async fn current_turn_model(&self, expected_turn_id: &str) -> Option<String> {
|
||||
let active = self.session.active_turn.lock().await;
|
||||
let task = active.as_ref()?.task.as_ref()?;
|
||||
if task.turn_context.sub_id != expected_turn_id || task.cancellation_token.is_cancelled() {
|
||||
return None;
|
||||
}
|
||||
Some(task.turn_context.capture_current_model_info().slug.clone())
|
||||
}
|
||||
|
||||
pub async fn shutdown_and_wait(&self) -> CodexResult<()> {
|
||||
self.io.shutdown_and_wait().await
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user