Files
codex/codex-rs/core/src/user_shell_command.rs
joeflorencio-openai 68301fa45f Snapshot resolved settings for each model step (#40651)
## Why

Thread settings can change while a turn is running, and delegated review or
compaction steps can select a different model. Each request needs a consistent
set of settings resolved against the model that will execute it.

## What changed

- Capture immutable resolved settings for each model step, including model
  metadata, reasoning options, service tier, approvals, and personality.
- Keep in-flight steps on their captured settings while applying thread updates
  to subsequent work.
- Resolve inherited reasoning summaries and filter service tiers against the
  selected model and feature configuration for review and compaction steps.

## Testing

Added coverage for settings updates during paused turns, model changes,
previous-model compaction, review-model defaults, and service-tier filtering.

GitOrigin-RevId: fca4b3b305379f1bf26a5cac75ee0dd1747ac1f6
2026-08-25 17:41:22 +00:00

45 lines
1.2 KiB
Rust

use codex_protocol::exec_output::ExecToolCallOutput;
use codex_protocol::models::ResponseItem;
use crate::context::ContextualUserFragment;
use crate::context::UserShellCommand;
use crate::session::turn_context::TurnContext;
use crate::tools::format_exec_output_str;
fn user_shell_command_fragment(
command: &str,
exec_output: &ExecToolCallOutput,
turn_context: &TurnContext,
) -> UserShellCommand {
let output = format_exec_output_str(
exec_output,
turn_context.model_info().truncation_policy.into(),
);
UserShellCommand::new(command, exec_output.exit_code, exec_output.duration, output)
}
#[cfg(test)]
pub fn format_user_shell_command_record(
command: &str,
exec_output: &ExecToolCallOutput,
turn_context: &TurnContext,
) -> String {
user_shell_command_fragment(command, exec_output, turn_context).render()
}
pub fn user_shell_command_record_item(
command: &str,
exec_output: &ExecToolCallOutput,
turn_context: &TurnContext,
) -> ResponseItem {
ContextualUserFragment::into(user_shell_command_fragment(
command,
exec_output,
turn_context,
))
}
#[cfg(test)]
#[path = "user_shell_command_tests.rs"]
mod tests;