the runtime your coding agents live on
Rust agentagent-orchestrationaiai-agentsclaude-codeclicodexcoding-agentsdeveloper-toolsdevtoolsmultiplexerrustterminalterminal-multiplexerterminal-uitmuxtuiworkspace-manager
fix: preserve child argv flags after separator
Ogulcan Celikdaf636fef7fd
diff --git a/src/remote.rs b/src/remote.rsindex cd53344b4..ce56ba8a6 100644--- a/src/remote.rs+++ b/src/remote.rs@@ -72,6 +72,10 @@ pub(crate) fn extract_remote_args(let mut index = 1;while index < args.len() {let arg = &args[index];+ if arg == "--" {+ cleaned.extend_from_slice(&args[index..]);+ break;+ }if arg == "--handoff" {live_handoff = true;index += 1;@@ -1843,6 +1847,27 @@ mod tests {assert!(remote.live_handoff);}+ #[test]+ fn extract_remote_args_preserves_child_remote_options_after_separator() {+ let args = vec![+ "herdr".into(),+ "agent".into(),+ "start".into(),+ "repro".into(),+ "--".into(),+ "child".into(),+ "--remote".into(),+ "dev".into(),+ "--remote-keybindings=server".into(),+ "--handoff".into(),+ ];++ let (cleaned, remote) = extract_remote_args(&args).unwrap();++ assert_eq!(cleaned, args);+ assert!(remote.is_none());+ }+#[test]fn extract_remote_args_preserves_handoff_without_remote() {let args = vec!["herdr".into(), "update".into(), "--handoff".into()];diff --git a/src/session.rs b/src/session.rsindex a4daf5e42..67b77dc0e 100644--- a/src/session.rs+++ b/src/session.rs@@ -52,6 +52,10 @@ pub fn configure_from_args(args: &[String]) -> Result<Vec<String>, String> {let mut index = 1;while index < args.len() {let arg = &args[index];+ if arg == "--" {+ cleaned.extend_from_slice(&args[index..]);+ break;+ }if arg == "--session" {let Some(value) = args.get(index + 1) else {return Err("missing value for --session".to_string());@@ -568,6 +572,51 @@ mod tests {clear_explicit_session_for_test();}+ #[test]+ fn configure_from_args_preserves_child_session_option_after_separator() {+ let _guard = env_lock().lock().unwrap();+ std::env::remove_var(SESSION_ENV_VAR);+ clear_explicit_session_for_test();+ let args = vec![+ "herdr".to_string(),+ "agent".to_string(),+ "start".to_string(),+ "repro".to_string(),+ "--".to_string(),+ "/bin/echo".to_string(),+ "--session".to_string(),+ "child-session".to_string(),+ ];++ let cleaned = configure_from_args(&args).unwrap();++ assert_eq!(cleaned, args);+ assert!(std::env::var(SESSION_ENV_VAR).is_err());+ assert!(!explicit_session_requested());+ }++ #[test]+ fn configure_from_args_preserves_child_session_equals_option_after_separator() {+ let _guard = env_lock().lock().unwrap();+ std::env::remove_var(SESSION_ENV_VAR);+ clear_explicit_session_for_test();+ let args = vec![+ "herdr".to_string(),+ "agent".to_string(),+ "start".to_string(),+ "repro".to_string(),+ "--".to_string(),+ "/bin/echo".to_string(),+ "--session=child-session".to_string(),+ ];++ let cleaned = configure_from_args(&args).unwrap();++ assert_eq!(cleaned, args);+ assert!(std::env::var(SESSION_ENV_VAR).is_err());+ assert!(!explicit_session_requested());+ }+#[test]fn configure_from_args_rewrites_session_attach_to_default_launch() {let _guard = env_lock().lock().unwrap();diff --git a/tests/cli_wrapper.rs b/tests/cli_wrapper.rsindex 871cba649..bbe053a7b 100644--- a/tests/cli_wrapper.rs+++ b/tests/cli_wrapper.rs@@ -2117,11 +2117,15 @@ fn agent_start_command_works() {"/bin/sh","-c","printf cli-agent-start-ok; sleep 2",+ "--session",+ "child-session",],);assert_eq!(started["result"]["type"], "agent_started");assert_eq!(started["result"]["agent"]["name"], "main");assert_eq!(started["result"]["argv"][0], "/bin/sh");+ assert_eq!(started["result"]["argv"][3], "--session");+ assert_eq!(started["result"]["argv"][4], "child-session");let terminal_id = started["result"]["agent"]["terminal_id"].as_str().unwrap()