feat(box): land interactive SSH/login shells in /workspace#124
Merged
Conversation
Adding a box as a remote host (Codex app, VS Code Remote-SSH, plain `ssh <box>`) opened the session in /home/vscode instead of the project at /workspace. SSH config has no start-directory directive, and the only client-side option (RemoteCommand) would break scp/sftp and VS Code's remote bootstrap on the same shared alias. So fix it server-side: make interactive login shells cd into /workspace via the existing /etc/profile.d/agentbox.sh shim every box installs. Guarded to interactive shells only (scp/sftp and `ssh box <cmd>` untouched) and only when still at $HOME (never overrides a caller-chosen dir, e.g. agentbox's own tmux `-c /workspace`). Applied to all provider shims for consistency: hetzner, vercel, e2b, and the canonical docker Dockerfile.box. Claude-Session: https://claude.ai/code/session_01An9tT8HqjQoGKKVWuYg4bb
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Adding a box as a remote host (Codex app, VS Code Remote-SSH, or plain
ssh <box>) opened the session in/home/vscodeinstead of the project at/workspace, forcing the user to navigate there every time.SSH config has no start-directory directive. The only client-side option —
RemoteCommand cd /workspace && exec $SHELL -l— would break the shared agentbox Host block for scp/sftp (agentbox opensshfs) and VS Code's remote bootstrap (agentbox code). So the fix is server-side.Change
Make interactive login shells
cd /workspacevia the existing/etc/profile.d/agentbox.shshim every box already installs:Guarded so it's safe:
case $- in *i*) → scp/sftp andssh box <cmd>are untouched$HOME→ never overrides a caller-chosen dir (agentbox's own tmux-c /workspacestays a no-op)-d /workspace→ never cd into a missing dirApplied to all provider login-shell shims for consistency:
hetzner(install-box.sh),vercel(provision.sh),e2b(build-template.sh), and the canonicaldockerDockerfile.box (regenerated runtime copy follows on build).E2E results (live Hetzner)
Re-baked the Hetzner snapshot with the updated
install-box.sh, created a real box (sshdir), and verified against the live VPS:ssh sshdir)/workspace— promptvscode@...:/workspace$,pwd->/workspacessh sshdir pwd/home/vscode— guard skips ($-=hBc, noi)scp file sshdir:/workspace/(sftp subsystem)Box destroyed and Hetzner VPS/firewall/SSH-alias cleanup confirmed (no orphans). Also syntax-checked the generated shim under both
bash -nandsh -n.https://claude.ai/code/session_01An9tT8HqjQoGKKVWuYg4bb
Note
Low Risk
Shell startup-only change with explicit interactive and PWD guards; no auth or application logic touched. Effect is limited to new image/template bakes until providers are refreshed.
Overview
Interactive login shells now
cd /workspacewhen the session still starts in$HOME, so Remote-SSH, Codex remote hosts, and plainssh <box>open in the project tree instead of/home/vscode.The behavior is added to the existing
/etc/profile.d/agentbox.shshim across docker, hetzner, vercel, and e2b bake/install paths. Guards keep it interactive-only (case $- in *i*)), requirePWD=$HOME, and[ -d /workspace ]soscp/sftp,ssh box <cmd>, and callers that already pick a working directory are unchanged.Existing boxes need a re-bake/rebuild of the base image or template for the shim update to apply.
Reviewed by Cursor Bugbot for commit e8c64f4. Configure here.