Simplify thread settings core helpers

This commit is contained in:
Eric Traut
2026-05-18 17:42:36 -07:00
parent 5dc813bd16
commit 0a2c9aa9d9
3 changed files with 18 additions and 34 deletions
@@ -482,7 +482,7 @@ impl TurnRequestProcessor {
// still queued together with the input below to preserve submission order.
if has_any_overrides {
thread
.validate_thread_settings_overrides(CodexThreadSettingsOverrides {
.preview_thread_settings_overrides(CodexThreadSettingsOverrides {
cwd: cwd.clone(),
workspace_roots: runtime_workspace_roots.clone(),
approval_policy,
-8
View File
@@ -266,14 +266,6 @@ impl CodexThread {
self.codex.session.preview_settings(&updates).await
}
pub async fn validate_thread_settings_overrides(
&self,
overrides: CodexThreadSettingsOverrides,
) -> ConstraintResult<()> {
self.preview_thread_settings_overrides(overrides).await?;
Ok(())
}
async fn thread_settings_update(
&self,
overrides: CodexThreadSettingsOverrides,
+17 -25
View File
@@ -189,32 +189,24 @@ pub(super) async fn user_input_or_turn_inner(
op: Op,
mirror_user_text_to_realtime: Option<()>,
) {
let (items, updates, responsesapi_client_metadata, emit_thread_settings_applied) = match op {
Op::UserInput {
items,
environments,
final_output_json_schema,
responsesapi_client_metadata,
thread_settings,
} => {
let emit_thread_settings_applied =
thread_settings != ThreadSettingsOverrides::default();
let mut updates = if emit_thread_settings_applied {
thread_settings_update(sess, thread_settings).await
} else {
SessionSettingsUpdate::default()
};
updates.final_output_json_schema = Some(final_output_json_schema);
updates.environments = environments;
(
items,
updates,
responsesapi_client_metadata,
emit_thread_settings_applied,
)
}
_ => unreachable!(),
let Op::UserInput {
items,
environments,
final_output_json_schema,
responsesapi_client_metadata,
thread_settings,
} = op
else {
unreachable!();
};
let emit_thread_settings_applied = thread_settings != ThreadSettingsOverrides::default();
let mut updates = if emit_thread_settings_applied {
thread_settings_update(sess, thread_settings).await
} else {
SessionSettingsUpdate::default()
};
updates.final_output_json_schema = Some(final_output_json_schema);
updates.environments = environments;
let Ok(current_context) = sess.new_turn_with_sub_id(sub_id.clone(), updates).await else {
// new_turn_with_sub_id already emits the error event.