From 7d531502d8e5c31d7b868fccaca195d0056b97c7 Mon Sep 17 00:00:00 2001 From: claude Date: Tue, 23 Jun 2026 09:04:35 +0000 Subject: [PATCH] fix(smolmachines): use sh -c not sh -lc in exec_agent MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The terminal-decoration wrapper script is invoked with sh -lc, which sources login-shell init files (/etc/profile, ~/.profile) rather than interactive-shell files (~/.zshrc). smolvm is typically installed via homebrew whose PATH setup lands in ~/.zprofile or ~/.zshrc — not picked up by sh -l — so pty_resize.py's Popen(["smolvm", ...]) raises FileNotFoundError, pty_resize exits non-zero, and the trailing reset- printf makes sh exit 0. The caller sees "session ended (exit 0)" immediately with no agent output. Use sh -c instead. The calling process (./cli.py) inherits the user's interactive shell PATH where smolvm is present, confirmed by the provision steps (machine_exec) succeeding before exec_agent is reached. --- bot_bottle/backend/smolmachines/bottle.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bot_bottle/backend/smolmachines/bottle.py b/bot_bottle/backend/smolmachines/bottle.py index ca3ff71..c278937 100644 --- a/bot_bottle/backend/smolmachines/bottle.py +++ b/bot_bottle/backend/smolmachines/bottle.py @@ -145,7 +145,12 @@ class SmolmachinesBottle(Bottle): script = exec_shell_script(agent_argv, self.terminal_title, self.terminal_color) if tty else None if script is None: return subprocess.run(agent_argv, check=False).returncode - return subprocess.run(["sh", "-lc", script], check=False).returncode + # Use sh -c (not -lc) so the script inherits PATH from the calling + # process. sh -l sources login-shell init files (e.g. /etc/profile) + # which may NOT include smolvm's location when it was installed via + # homebrew. The calling process (./cli.py) already has smolvm on PATH + # (provision steps succeed), so -c is sufficient. + return subprocess.run(["sh", "-c", script], check=False).returncode # smolvm/libkrun can SIGKILL an otherwise-normal exec during # early-VM provisioning. Retry once after a short settle so