From cd82751396ca6b911d1b3e58288f02e9f15bc684 Mon Sep 17 00:00:00 2001 From: lethalspam Date: Wed, 21 Jan 2026 13:31:34 -0500 Subject: [PATCH] fix: use exec env for startup command to fix WaitForCommand detection (#844) When starting agents with environment variables, the previous approach used 'export VAR=val && claude' which keeps bash as the pane command with the agent as a child process. WaitForCommand polls pane_current_command which returns 'bash', causing a 60-second timeout. Changed to 'exec env VAR=val claude' which replaces the shell with the agent process, making it detectable via pane_current_command. Fixes startup timeout on macOS: 'still running excluded command' --- internal/config/loader.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/internal/config/loader.go b/internal/config/loader.go index 2f56808d..612f6cae 100644 --- a/internal/config/loader.go +++ b/internal/config/loader.go @@ -1264,7 +1264,11 @@ func BuildStartupCommand(envVars map[string]string, rigPath, prompt string) stri var cmd string if len(exports) > 0 { - cmd = "export " + strings.Join(exports, " ") + " && " + // Use 'exec env' instead of 'export ... &&' so the agent process + // replaces the shell. This allows WaitForCommand to detect the + // running agent via pane_current_command (which shows the direct + // process, not child processes). + cmd = "exec env " + strings.Join(exports, " ") + " " } // Add runtime command @@ -1367,7 +1371,11 @@ func BuildStartupCommandWithAgentOverride(envVars map[string]string, rigPath, pr var cmd string if len(exports) > 0 { - cmd = "export " + strings.Join(exports, " ") + " && " + // Use 'exec env' instead of 'export ... &&' so the agent process + // replaces the shell. This allows WaitForCommand to detect the + // running agent via pane_current_command (which shows the direct + // process, not child processes). + cmd = "exec env " + strings.Join(exports, " ") + " " } if prompt != "" {