feat(tui): add managed worktree flow

This commit is contained in:
Felipe Coury
2026-05-12 12:34:45 -03:00
parent e5d022297d
commit 7a113fc7e9
54 changed files with 5585 additions and 34 deletions
@@ -94,7 +94,8 @@ impl CommandExecRequestProcessor {
}
let CommandExecParams {
command,
mut command,
use_codex_self_exe,
process_id,
tty,
stream_stdin,
@@ -115,6 +116,13 @@ impl CommandExecRequestProcessor {
));
}
if use_codex_self_exe {
let codex_self_exe = self.arg0_paths.codex_self_exe.as_ref().ok_or_else(|| {
internal_error("app-server does not know its Codex executable path")
})?;
command[0] = codex_self_exe.to_string_lossy().into_owned();
}
if size.is_some() && !tty {
return Err(invalid_params("command/exec size requires tty: true"));
}
@@ -53,6 +53,7 @@ async fn command_exec_without_streams_can_be_terminated() -> Result<()> {
let command_request_id = mcp
.send_command_exec_request(CommandExecParams {
command: vec!["sh".to_string(), "-lc".to_string(), "sleep 30".to_string()],
use_codex_self_exe: false,
process_id: Some(process_id.clone()),
tty: false,
stream_stdin: false,
@@ -106,6 +107,7 @@ async fn command_exec_without_process_id_keeps_buffered_compatibility() -> Resul
"-lc".to_string(),
"printf 'legacy-out'; printf 'legacy-err' >&2".to_string(),
],
use_codex_self_exe: false,
process_id: None,
tty: false,
stream_stdin: false,
@@ -158,6 +160,7 @@ async fn command_exec_env_overrides_merge_with_server_environment_and_support_un
"-lc".to_string(),
"printf '%s|%s|%s|%s' \"$COMMAND_EXEC_BASELINE\" \"$COMMAND_EXEC_EXTRA\" \"${RUST_LOG-unset}\" \"$CODEX_HOME\"".to_string(),
],
use_codex_self_exe: false,
process_id: None,
tty: false,
stream_stdin: false,
@@ -212,6 +215,7 @@ async fn command_exec_accepts_permission_profile() -> Result<()> {
"-lc".to_string(),
"printf 'profile'".to_string(),
],
use_codex_self_exe: false,
process_id: None,
tty: false,
stream_stdin: false,
@@ -276,6 +280,7 @@ async fn command_exec_permission_profile_project_roots_use_command_cwd() -> Resu
"-lc".to_string(),
"printf child > child.txt && ! printf parent > ../parent.txt".to_string(),
],
use_codex_self_exe: false,
process_id: None,
tty: false,
stream_stdin: false,
@@ -323,6 +328,7 @@ async fn command_exec_rejects_sandbox_policy_with_permission_profile() -> Result
let command_request_id = mcp
.send_command_exec_request(CommandExecParams {
command: vec!["sh".to_string(), "-lc".to_string(), "true".to_string()],
use_codex_self_exe: false,
process_id: None,
tty: false,
stream_stdin: false,
@@ -361,6 +367,7 @@ async fn command_exec_rejects_disable_timeout_with_timeout_ms() -> Result<()> {
let command_request_id = mcp
.send_command_exec_request(CommandExecParams {
command: vec!["sh".to_string(), "-lc".to_string(), "sleep 1".to_string()],
use_codex_self_exe: false,
process_id: Some("invalid-timeout-1".to_string()),
tty: false,
stream_stdin: false,
@@ -399,6 +406,7 @@ async fn command_exec_rejects_disable_output_cap_with_output_bytes_cap() -> Resu
let command_request_id = mcp
.send_command_exec_request(CommandExecParams {
command: vec!["sh".to_string(), "-lc".to_string(), "sleep 1".to_string()],
use_codex_self_exe: false,
process_id: Some("invalid-cap-1".to_string()),
tty: false,
stream_stdin: false,
@@ -437,6 +445,7 @@ async fn command_exec_rejects_negative_timeout_ms() -> Result<()> {
let command_request_id = mcp
.send_command_exec_request(CommandExecParams {
command: vec!["sh".to_string(), "-lc".to_string(), "sleep 1".to_string()],
use_codex_self_exe: false,
process_id: Some("negative-timeout-1".to_string()),
tty: false,
stream_stdin: false,
@@ -475,6 +484,7 @@ async fn command_exec_without_process_id_rejects_streaming() -> Result<()> {
let command_request_id = mcp
.send_command_exec_request(CommandExecParams {
command: vec!["sh".to_string(), "-lc".to_string(), "cat".to_string()],
use_codex_self_exe: false,
process_id: None,
tty: false,
stream_stdin: false,
@@ -517,6 +527,7 @@ async fn command_exec_non_streaming_respects_output_cap() -> Result<()> {
"-lc".to_string(),
"printf 'abcdef'; printf 'uvwxyz' >&2".to_string(),
],
use_codex_self_exe: false,
process_id: Some("cap-1".to_string()),
tty: false,
stream_stdin: false,
@@ -565,6 +576,7 @@ async fn command_exec_streaming_does_not_buffer_output() -> Result<()> {
"-lc".to_string(),
"printf 'abcdefghij'; sleep 30".to_string(),
],
use_codex_self_exe: false,
process_id: Some(process_id.clone()),
tty: false,
stream_stdin: false,
@@ -629,6 +641,7 @@ async fn command_exec_pipe_streams_output_and_accepts_write() -> Result<()> {
"-lc".to_string(),
"printf 'out-start\\n'; printf 'err-start\\n' >&2; IFS= read line; printf 'out:%s\\n' \"$line\"; printf 'err:%s\\n' \"$line\" >&2".to_string(),
],
use_codex_self_exe: false,
process_id: Some(process_id.clone()),
tty: false,
stream_stdin: true,
@@ -705,6 +718,7 @@ async fn command_exec_tty_implies_streaming_and_reports_pty_output() -> Result<(
"-lc".to_string(),
"stty -echo; if [ -t 0 ]; then printf 'tty\\n'; else printf 'notty\\n'; fi; IFS= read line; printf 'echo:%s\\n' \"$line\"".to_string(),
],
use_codex_self_exe: false,
process_id: Some(process_id.clone()),
tty: true,
stream_stdin: false,
@@ -776,6 +790,7 @@ async fn command_exec_tty_supports_initial_size_and_resize() -> Result<()> {
"-lc".to_string(),
"stty -echo; printf 'start:%s\\n' \"$(stty size)\"; IFS= read _line; printf 'after:%s\\n' \"$(stty size)\"".to_string(),
],
use_codex_self_exe: false,
process_id: Some(process_id.clone()),
tty: true,
stream_stdin: false,