mirror of
https://github.com/openai/codex.git
synced 2026-11-25 23:30:49 +00:00
Use lightweight settings for app-server thread metadata (#63990)
## Why Enriching loaded thread results builds a full configuration snapshot, including an execution permission profile, just to read display settings. ## What changed Read the configured model, reasoning effort, environment selections, and session source directly from the loaded thread when enriching results. The environment data still includes the working directory and runtime workspace roots. ## Testing Extend the core test to verify that reading display settings matches the configured snapshot's display fields without triggering a model lookup. Extend the app-server test to verify that thread reads and lists return explicit runtime workspace roots. GitOrigin-RevId: f7053554fdb0f02bebb51b4cafda2ef39e6e81a5
This commit is contained in:
@@ -105,6 +105,33 @@ use codex_rollout::state_db::StateDbHandle;
|
||||
|
||||
static LIVE_THREADS: Gauge = Gauge::new("core.threads.live");
|
||||
|
||||
/// The live settings needed to display a thread list or search result.
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub struct ThreadViewSettings {
|
||||
pub model: String,
|
||||
pub reasoning_effort: Option<ReasoningEffort>,
|
||||
pub environments: Vec<ThreadEnvironmentView>,
|
||||
pub session_source: SessionSource,
|
||||
}
|
||||
|
||||
/// The selected workspace for display, without the environment's execution config.
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub struct ThreadEnvironmentView {
|
||||
pub environment_id: String,
|
||||
pub cwd: PathUri,
|
||||
pub workspace_roots: Vec<PathUri>,
|
||||
}
|
||||
|
||||
impl From<&TurnEnvironmentSelection> for ThreadEnvironmentView {
|
||||
fn from(selection: &TurnEnvironmentSelection) -> Self {
|
||||
Self {
|
||||
environment_id: selection.environment_id.clone(),
|
||||
cwd: selection.cwd.clone(),
|
||||
workspace_roots: selection.workspace_roots.clone(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct ThreadConfigSnapshot {
|
||||
/// Trusted host country inherited by future turns.
|
||||
@@ -1500,6 +1527,11 @@ impl CodexThread {
|
||||
self.session.configured_snapshot().await
|
||||
}
|
||||
|
||||
/// Reads display settings without materializing an execution permission profile.
|
||||
pub async fn thread_view_settings(&self) -> ThreadViewSettings {
|
||||
self.session.thread_view_settings().await
|
||||
}
|
||||
|
||||
pub async fn config_snapshot(&self) -> ThreadConfigSnapshot {
|
||||
self.session.thread_config_snapshot().await
|
||||
}
|
||||
|
||||
@@ -65,6 +65,8 @@ pub use codex_thread::GuardianAuthorizationVersion;
|
||||
pub use codex_thread::GuardianRootMessage;
|
||||
pub use codex_thread::GuardianRootSnapshot;
|
||||
pub use codex_thread::ThreadConfigSnapshot;
|
||||
pub use codex_thread::ThreadEnvironmentView;
|
||||
pub use codex_thread::ThreadViewSettings;
|
||||
pub use codex_thread::TurnAdmissionState;
|
||||
pub use guardian::GuardianInferenceContext;
|
||||
pub use guardian::ScoreAuthorization as GuardianScoreAuthorization;
|
||||
|
||||
@@ -2405,6 +2405,18 @@ impl Session {
|
||||
configuration.thread_config_snapshot(configuration.environments.clone())
|
||||
}
|
||||
|
||||
pub(crate) async fn thread_view_settings(&self) -> crate::ThreadViewSettings {
|
||||
let state = self.state.lock().await;
|
||||
let configuration = &state.session_configuration;
|
||||
let collaboration = &configuration.step_settings.collaboration_mode;
|
||||
crate::ThreadViewSettings {
|
||||
model: collaboration.model().to_string(),
|
||||
reasoning_effort: collaboration.reasoning_effort(),
|
||||
environments: configuration.environments.iter().map(Into::into).collect(),
|
||||
session_source: configuration.session_source.clone(),
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) async fn thread_config_snapshot(&self) -> ThreadConfigSnapshot {
|
||||
self.resume_config_snapshot().await.0
|
||||
}
|
||||
|
||||
@@ -444,6 +444,24 @@ async fn thread_metadata_and_goal_recording_do_not_resolve_the_selected_model()
|
||||
assert_eq!(local.model, MODEL_B);
|
||||
assert_eq!(local.service_tier.as_deref(), Some("unsupported"));
|
||||
|
||||
let view = tokio::select! {
|
||||
settings = session.thread_view_settings() => settings,
|
||||
_ = lookup.started.notified() => panic!("list settings requested model info"),
|
||||
};
|
||||
assert_eq!(
|
||||
view,
|
||||
crate::ThreadViewSettings {
|
||||
model: local.model.clone(),
|
||||
reasoning_effort: local.reasoning_effort.clone(),
|
||||
environments: local
|
||||
.environment_selections()
|
||||
.iter()
|
||||
.map(Into::into)
|
||||
.collect(),
|
||||
session_source: local.session_source.clone(),
|
||||
},
|
||||
);
|
||||
|
||||
let update = UserGoalUpdate::Set {
|
||||
objective: Some("Keep the existing tests".into()),
|
||||
status: None,
|
||||
|
||||
Reference in New Issue
Block a user