diff --git a/packages/sandbox-docker/Dockerfile.box b/packages/sandbox-docker/Dockerfile.box index 98e87ac..e41a5f8 100644 --- a/packages/sandbox-docker/Dockerfile.box +++ b/packages/sandbox-docker/Dockerfile.box @@ -510,6 +510,15 @@ RUN printf '%s\n' \ ' . /etc/agentbox/box.env' \ ' set +a' \ 'fi' \ + '# Land interactive login shells in the workspace (remote-host integrations,' \ + '# plain `ssh `); interactive-only and only when still at $HOME.' \ + 'case $- in' \ + ' *i*)' \ + ' if [ "$PWD" = "$HOME" ] && [ -d /workspace ]; then' \ + ' cd /workspace' \ + ' fi' \ + ' ;;' \ + 'esac' \ > /etc/profile.d/agentbox.sh \ && chmod 0644 /etc/profile.d/agentbox.sh diff --git a/packages/sandbox-e2b/scripts/build-template.sh b/packages/sandbox-e2b/scripts/build-template.sh index d1c3852..57a8e94 100755 --- a/packages/sandbox-e2b/scripts/build-template.sh +++ b/packages/sandbox-e2b/scripts/build-template.sh @@ -244,6 +244,18 @@ export DISABLE_AUTOUPDATER=${DISABLE_AUTOUPDATER:-1} export DISPLAY=${DISPLAY:-:1} export AGENT_BROWSER_EXECUTABLE_PATH=${AGENT_BROWSER_EXECUTABLE_PATH:-/usr/local/bin/chromium} export BROWSER=${BROWSER:-/usr/local/bin/agentbox-open} +# Land interactive login shells in the workspace, so remote-host integrations +# (Codex app, VS Code Remote-SSH, plain `ssh `) open in the project instead +# of $HOME. Interactive-only so scp/sftp and `ssh box ` are untouched; only +# when still at $HOME so a caller-chosen dir (e.g. agentbox's tmux `-c /workspace`) +# is never overridden. +case $- in + *i*) + if [ "$PWD" = "$HOME" ] && [ -d /workspace ]; then + cd /workspace + fi + ;; +esac PROFILE chmod 0644 /etc/profile.d/agentbox.sh done_ "login-shell shim (/etc/profile.d/agentbox.sh)" diff --git a/packages/sandbox-hetzner/scripts/install-box.sh b/packages/sandbox-hetzner/scripts/install-box.sh index ee9ddbc..17aaa3e 100644 --- a/packages/sandbox-hetzner/scripts/install-box.sh +++ b/packages/sandbox-hetzner/scripts/install-box.sh @@ -290,6 +290,18 @@ export LC_ALL=${LC_ALL:-en_US.UTF-8} export DISPLAY=${DISPLAY:-:1} export AGENT_BROWSER_EXECUTABLE_PATH=${AGENT_BROWSER_EXECUTABLE_PATH:-/usr/local/bin/chromium} export BROWSER=${BROWSER:-/usr/local/bin/agentbox-open} +# Land interactive login shells in the workspace, so remote-host integrations +# (Codex app, VS Code Remote-SSH, plain `ssh `) open in the project instead +# of $HOME. Interactive-only so scp/sftp and `ssh box ` are untouched; only +# when still at $HOME so a caller-chosen dir (e.g. agentbox's tmux `-c /workspace`) +# is never overridden. +case $- in + *i*) + if [ "$PWD" = "$HOME" ] && [ -d /workspace ]; then + cd /workspace + fi + ;; +esac PROFILE chmod 0644 /etc/profile.d/agentbox.sh done_ "login-shell shim (/etc/profile.d/agentbox.sh)" diff --git a/packages/sandbox-vercel/scripts/provision.sh b/packages/sandbox-vercel/scripts/provision.sh index b87cb45..ed0e3f6 100644 --- a/packages/sandbox-vercel/scripts/provision.sh +++ b/packages/sandbox-vercel/scripts/provision.sh @@ -269,6 +269,18 @@ export DISABLE_AUTOUPDATER=${DISABLE_AUTOUPDATER:-1} export DISPLAY=${DISPLAY:-:1} export AGENT_BROWSER_EXECUTABLE_PATH=${AGENT_BROWSER_EXECUTABLE_PATH:-/usr/local/bin/chromium} export BROWSER=${BROWSER:-/usr/local/bin/agentbox-open} +# Land interactive login shells in the workspace, so remote-host integrations +# (Codex app, VS Code Remote-SSH, plain `ssh `) open in the project instead +# of $HOME. Interactive-only so scp/sftp and `ssh box ` are untouched; only +# when still at $HOME so a caller-chosen dir (e.g. agentbox's tmux `-c /workspace`) +# is never overridden. +case $- in + *i*) + if [ "$PWD" = "$HOME" ] && [ -d /workspace ]; then + cd /workspace + fi + ;; +esac PROFILE chmod 0644 /etc/profile.d/agentbox.sh done_ "login-shell shim (/etc/profile.d/agentbox.sh)"