Repository navigation
Description
Problem
Cursor GUI connected to a devcontainer via the devcontainer protocol cannot execute shell commands through the AI agent. The agent's shell tool fails to route commands into the container's remote execution context. This is a known Cursor IDE limitation — VS Code and Cursor CLI/terminal both work fine.
The solution is to connect Cursor via SSH remote instead of the devcontainer protocol. Tailscale SSH provides this: no jump hosts, no port forwarding — direct mesh access over the tailnet.
This was prototyped in vig-os/fd5 (see docs/tailscale-devcontainer.md in that repo for full design notes).
Proposed changes
New file: assets/workspace/.devcontainer/scripts/setup-tailscale.sh
Single script with two subcommands:
install— installs Tailscale via the official installer ifTAILSCALE_AUTHKEYis set and Tailscale isn't already present. Idempotent. Called frompost-create.sh.start— startstailscaled(userspace networking, no/dev/net/tunneeded) and callstailscale up --ssh --authkey=.... Called frompost-start.sh.
Opt-in: when TAILSCALE_AUTHKEY is unset, both subcommands are silent no-ops — zero impact on users who don't configure it.
Hostname defaults to <project>-devc-<hostname -s>, overridable via TAILSCALE_HOSTNAME env var.
Modified: assets/workspace/.devcontainer/scripts/post-create.sh
Add after the user-setup placeholder:
# Tailscale SSH (opt-in: no-op when TAILSCALE_AUTHKEY is unset)
"$SCRIPT_DIR/setup-tailscale.sh" installSCRIPT_DIR resolution needs to be added to this file if not already present.
Modified: assets/workspace/.devcontainer/scripts/post-start.sh (add if not present)
Add after dependency sync:
# Tailscale SSH (opt-in: no-op when TAILSCALE_AUTHKEY is unset)
"$SCRIPT_DIR/setup-tailscale.sh" startModified: assets/workspace/.devcontainer/docker-compose.local.yaml
Add a commented example block:
# Optional: Tailscale SSH for direct mesh access (e.g. Cursor GUI workaround)
# services:
# devcontainer:
# environment:
# - TAILSCALE_AUTHKEY=tskey-auth-XXXX
# - TAILSCALE_HOSTNAME=myproject-devc-mybox # optionalModified: assets/workspace/.devcontainer/README.md
Add a "Tailscale SSH" section with quick-start instructions (key generation, env var setup, rebuild, connect).
Architecture decisions
| Decision | Choice | Rationale |
|---|---|---|
| Networking | --tun=userspace-networking |
No /dev/net/tun device needed; works in any container runtime without extra device mounts |
| SSH server | Tailscale SSH (--ssh) |
No openssh-server needed; auth via Tailscale ACLs |
| Auth | TAILSCALE_AUTHKEY env var via docker-compose.local.yaml |
Git-ignored; ephemeral + reusable keys auto-expire stale containers |
| Opt-in | No-op when env var unset | Zero impact on existing users |
| Install | curl -fsSL https://tailscale.com/install.sh | sh |
Official installer, idempotent; ~10s on first create |
| Hostname default | <project>-devc-<hostname -s> |
Disambiguates same repo on multiple machines; should use project name from init-workspace.sh |
Open questions / known gaps
SCRIPT_DIRinpost-create.sh: The upstream template doesn't currently resolveSCRIPT_DIR— this needs to be added alongside the hook.- Git commit signing over Tailscale SSH: SSH agent forwarding doesn't work through Tailscale SSH by default. The
post-start.shscript should warn whenTAILSCALE_AUTHKEYis set but no SSH agent is available. Thecommit.gpgsign/gpg.formatgit config should be set in the init scripts so signing works automatically when a key is available. - Image baking: Consider pre-installing Tailscale in the container image to avoid the ~10s install-on-first-create latency. Trade-off: image size vs. cold-start time.
- ACL documentation: Users must configure a Tailscale SSH ACL rule in their tailnet admin console before SSH connections are accepted. This should be documented.
Acceptance Criteria
-
setup-tailscale.shadded to workspace template scripts directory -
post-create.shhookssetup-tailscale.sh install -
post-start.shhookssetup-tailscale.sh start -
docker-compose.local.yamltemplate includes commented Tailscale example -
.devcontainer/README.mdupdated with Tailscale SSH quick-start section - All hooks are no-ops when
TAILSCALE_AUTHKEYis unset - TDD compliance (see .cursor/rules/tdd.mdc)
References
- Prototype:
vig-os/fd5commit13797db(branchchore/158-tailscale-ssh-devcontainer) - Design doc:
docs/tailscale-devcontainer.mdinvig-os/fd5
Activity
gerchowl commentedon Feb 26, 2026
Design
Issue: #208
Branch: feature/208-tailscale-ssh-support
Overview
Add opt-in Tailscale SSH support to the devcontainer workspace template. When
TAILSCALE_AUTHKEYis set (viadocker-compose.local.yaml), Tailscale is installed at container creation and started on every container start. When unset, all hooks are silent no-ops — zero impact on existing users.Architecture
New file:
assets/workspace/.devcontainer/scripts/setup-tailscale.shSingle script with two subcommands:
Hostname defaults to `${SHORT_NAME}-devc-$(hostname -s)`, overridable via `TAILSCALE_HOSTNAME` env var. Since `SHORT_NAME` isn't available at runtime in the workspace template (it's replaced during init), we'll read the project name from `devcontainer.json`'s `name` field (which contains `-devc` after init). We strip the `-devc` suffix and use that as the project prefix. Fallback: `devc`.
Modified:
assets/workspace/.devcontainer/scripts/post-create.shAdd call to `setup-tailscale.sh install` after the user-setup placeholder section. The file already has `SCRIPT_DIR` defined, so no additional resolution needed.
Modified:
assets/workspace/.devcontainer/scripts/post-start.shAdd `SCRIPT_DIR` resolution (not yet present) and call to `setup-tailscale.sh start` after dependency sync.
Modified:
assets/workspace/.devcontainer/docker-compose.local.yamlAdd a commented example block showing how to set `TAILSCALE_AUTHKEY` and `TAILSCALE_HOSTNAME`.
Modified:
assets/workspace/.devcontainer/README.mdAdd a "Tailscale SSH" section with quick-start instructions: key generation, env var setup, rebuild, connect, ACL configuration.
Design Decisions
Error Handling
Testing Strategy
BATS tests (`tests/bats/setup-tailscale.bats`):
Existing integration tests (`test_integration.py`) are session-scoped and verify script presence/executability. The `setup-tailscale.sh` script will be picked up by `TestDevContainerScripts` automatically once added to the manifest.
No live Tailscale tests: Testing actual Tailscale install/start requires network access and a valid authkey. These are not suitable for CI. The BATS tests cover the opt-in gate logic (the most important behavior).
Files Changed
gerchowl commentedon Feb 26, 2026
Implementation Plan
Issue: #208
Branch: feature/208-tailscale-ssh-support
Tasks
setup-tailscale.shwith install and start subcommands —assets/workspace/.devcontainer/scripts/setup-tailscale.sh— verify:npx bats tests/bats/setup-tailscale.batssetup-tailscale.sh—tests/bats/setup-tailscale.bats— verify:npx bats tests/bats/setup-tailscale.batssetup-tailscale.sh installintopost-create.sh—assets/workspace/.devcontainer/scripts/post-create.sh— verify:grep 'setup-tailscale.sh install' assets/workspace/.devcontainer/scripts/post-create.shsetup-tailscale.sh startintopost-start.sh—assets/workspace/.devcontainer/scripts/post-start.sh— verify:grep 'setup-tailscale.sh start' assets/workspace/.devcontainer/scripts/post-start.shdocker-compose.local.yaml—assets/workspace/.devcontainer/docker-compose.local.yaml— verify:grep 'TAILSCALE_AUTHKEY' assets/workspace/.devcontainer/docker-compose.local.yamlREADME.md—assets/workspace/.devcontainer/README.md— verify:grep 'Tailscale SSH' assets/workspace/.devcontainer/README.mdCHANGELOG.mdwith unreleased entry —CHANGELOG.md— verify:grep 'Tailscale SSH' CHANGELOG.mdtest: add BATS tests for setup-tailscale.sh
feat: add setup-tailscale.sh with install and start subcommands
feat: hook setup-tailscale.sh install into post-create.sh
feat: hook setup-tailscale.sh start into post-start.sh
docs: add commented Tailscale example to docker-compose.local.yaml
docs: add Tailscale SSH section to devcontainer README
docs: add Tailscale SSH changelog entry
gerchowl commentedon Feb 26, 2026
Autonomous Run Complete
fix(image): daemonize 'tailscaled' to survive postStartCommand exit
docs: add Tailscale SSH design document
feat: add opt-in Tailscale SSH support to devcontainer (#208) (#211)
feat(remote): Tailscale key injection and --open/--yes flags (#233)