Expose model metadata from each thread's catalog and settings (#59958)

## What changed

- Add `ThreadManager::models_manager_for_startup` to obtain the model catalog used when starting or cold-resuming a root thread, including its effective originator.
- Add `CodexThread::selected_model_info` to resolve the model for future turns using the thread's current settings, catalog, and model overrides.
- Share catalog selection logic between startup lookup and thread creation.

## Testing

Add coverage verifying that startup and thread lookups use the thread-specific catalog, preserve the configured context window, and reflect model selection updates.

GitOrigin-RevId: d7976caebb7459e1e9ca55f3c6f6bb2af92cf3de
This commit is contained in:
Sean Huang
2026-11-06 19:16:53 +00:00
committed by copyberry
parent ebe94e25c5
commit 12dc86beb3
4 changed files with 146 additions and 13 deletions
+6
View File
@@ -41,6 +41,7 @@ use codex_protocol::models::ActivePermissionProfile;
use codex_protocol::models::PermissionProfile;
use codex_protocol::models::ProfileWorkspaceRoot;
use codex_protocol::models::ResponseItem;
use codex_protocol::openai_models::ModelInfo;
use codex_protocol::openai_models::ReasoningEffort;
use codex_protocol::protocol::AskForApproval;
use codex_protocol::protocol::EnvironmentConfig;
@@ -1146,6 +1147,11 @@ impl CodexThread {
self.session.state_db()
}
/// Resolves the model selected for future turns using this thread's catalog and settings.
pub async fn selected_model_info(&self) -> Arc<ModelInfo> {
self.session.selected_model_info().await
}
pub async fn config_snapshot(&self) -> ThreadConfigSnapshot {
self.session.thread_config_snapshot().await
}