Skip to content

feat: add sandbox remote-run (rr)#175

Open
Mukil Loganathan (langchain-infra) wants to merge 1 commit into
mainfrom
feat/sandbox-remote-run
Open

feat: add sandbox remote-run (rr)#175
Mukil Loganathan (langchain-infra) wants to merge 1 commit into
mainfrom
feat/sandbox-remote-run

Conversation

@langchain-infra

Copy link
Copy Markdown
Contributor

Summary

Adds langsmith sandbox remote-run (alias rr): mirror the current git worktree into a LangSmith sandbox and run a command there.

  • Creates or starts a deterministic per-user sandbox (dev-<git user.email> by default; --sandbox / --worktree-sandbox to override).
  • Provisions sshd + rsync in the box, opens an SSH tunnel to it.
  • Syncs committed HEAD (pushed into the box over SSH) plus uncommitted changes (rsync), then runs the command from the mirrored checkout (through mise unless --no-mise).
  • --tunnel forwards every port in .env.ports.override to localhost while the command runs.
  • Requires local git, ssh, rsync, and GitHub CLI auth (or GH_TOKEN/GITHUB_TOKEN) for private-repo cloning inside the box.

Provenance

Prototyped in the downstream monorepo mirror (langchain-ai/langchainplus PR #29607) and moved here to the source-of-truth CLI repo. It will flow back into langchainplus/sdks/cli via the usual resync.

Test plan

  • go build ./..., go test ./internal/cmd/..., gofmt — all green (5 rr unit tests + existing sandbox tests).
  • Verified end-to-end against a real AWS LangSmith sandbox:
    • sandbox rr --sandbox <box> -- … — committed HEAD and an untracked file both landed in the mirrored worktree on the box.
    • sandbox rr --tunnel -- <server> — a port from .env.ports.override was forwarded to localhost; reached the in-box server through it and pulled synced files back; forward closed cleanly on exit.

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

Adds `langsmith sandbox remote-run` (alias `rr`): mirror the current git
worktree into a LangSmith sandbox and run a command there. It creates or starts
a deterministic per-user sandbox, provisions SSH/rsync inside it, syncs committed
(HEAD) plus uncommitted local changes, and runs the command from the mirrored
checkout. Supports named sandboxes, snapshot selection, opt-in secrets sync, and
port tunneling (`--tunnel` forwards every port in `.env.ports.override` to
localhost while the command runs).

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 new potential issue.

Open in Devin Review

cmd.Flags().BoolVar(&in.WorktreeSandbox, "worktree-sandbox", in.WorktreeSandbox, "Use a sandbox name derived from the current worktree instead of git user.email")
cmd.Flags().BoolVar(&in.NoSync, "no-sync", in.NoSync, "Skip pushing and rsyncing the repo; run against the sandbox's existing checkout")
cmd.Flags().BoolVar(&in.NoMise, "no-mise", in.NoMise, "Run the command directly instead of through mise")
cmd.Flags().BoolVar(&in.Tunnel, "tunnel", in.Tunnel, "Forward every port in .env.ports.override to localhost and keep running after the command")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 Tunnel flag description implies persistent forwarding with commands, but forwards close when command exits

The --tunnel flag description at line 108 says 'keep running after the command', but when both --tunnel and a command are provided, the port forwards are attached to the SSH session running the command (internal/cmd/sandbox_remote_run.go:462). When the command exits, SSH exits and forwards close. Persistent forwarding only happens when --tunnel is used without a command (lines 455-459, which calls rrSSHTunnelConn). The flag description could be clarified to distinguish these two modes.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant