mirror of
https://github.com/openai/codex.git
synced 2026-05-04 11:26:33 +00:00
Support SSH-backed exec-server routing
- add exec_server.command config plumbing and propagate it through codex exec session startup - fix remote shell path/cwd translation and preserve early stdout for short exec-server commands Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
@@ -940,10 +940,17 @@ fn thread_resume_params_from_config(config: &Config, path: Option<PathBuf>) -> T
|
||||
}
|
||||
|
||||
fn config_request_overrides_from_config(config: &Config) -> Option<HashMap<String, Value>> {
|
||||
config
|
||||
.active_profile
|
||||
.as_ref()
|
||||
.map(|profile| HashMap::from([("profile".to_string(), Value::String(profile.clone()))]))
|
||||
let mut overrides = HashMap::new();
|
||||
if let Some(profile) = config.active_profile.as_ref() {
|
||||
overrides.insert("profile".to_string(), Value::String(profile.clone()));
|
||||
}
|
||||
if let Some(command) = config.exec_server_command.as_ref() {
|
||||
overrides.insert(
|
||||
"exec_server.command".to_string(),
|
||||
serde_json::to_value(command).expect("exec_server.command should serialize"),
|
||||
);
|
||||
}
|
||||
(!overrides.is_empty()).then_some(overrides)
|
||||
}
|
||||
|
||||
fn approvals_reviewer_override_from_config(
|
||||
@@ -1630,6 +1637,52 @@ mod tests {
|
||||
assert_eq!(DEFAULT_ANALYTICS_ENABLED, true);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn thread_start_params_include_exec_server_command_override() {
|
||||
let mut config =
|
||||
Config::load_default_with_cli_overrides(Vec::new()).expect("default config loads");
|
||||
config.exec_server_command = Some(vec![
|
||||
"ssh".to_string(),
|
||||
"-T".to_string(),
|
||||
"dev".to_string(),
|
||||
"codex".to_string(),
|
||||
"exec-server".to_string(),
|
||||
]);
|
||||
|
||||
let params = thread_start_params_from_config(&config);
|
||||
|
||||
assert_eq!(
|
||||
params.config,
|
||||
Some(HashMap::from([(
|
||||
"exec_server.command".to_string(),
|
||||
serde_json::json!(["ssh", "-T", "dev", "codex", "exec-server"]),
|
||||
)]))
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn thread_resume_params_include_exec_server_command_override() {
|
||||
let mut config =
|
||||
Config::load_default_with_cli_overrides(Vec::new()).expect("default config loads");
|
||||
config.exec_server_command = Some(vec![
|
||||
"ssh".to_string(),
|
||||
"-T".to_string(),
|
||||
"dev".to_string(),
|
||||
"codex".to_string(),
|
||||
"exec-server".to_string(),
|
||||
]);
|
||||
|
||||
let params = thread_resume_params_from_config(&config, None);
|
||||
|
||||
assert_eq!(
|
||||
params.config,
|
||||
Some(HashMap::from([(
|
||||
"exec_server.command".to_string(),
|
||||
serde_json::json!(["ssh", "-T", "dev", "codex", "exec-server"]),
|
||||
)]))
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn exec_root_span_can_be_parented_from_trace_context() {
|
||||
let subscriber = test_tracing_subscriber();
|
||||
|
||||
Reference in New Issue
Block a user