To debug a failing step in Depot CI, you can connect to the sandbox running your job using SSH. There are two ways to do this depending on what you need:
actions/checkout or dependency installation might not have run yet, or might land in a different working directory.depot login.depot/workflows/<name>.ymlThe --ssh-after-step flag injects a tmate (mxschmitt/action-tmate@v3) debug step after a specific step in your job. When the run reaches that step, the job pauses and the CLI automatically connects you to the tmate session.
When you end the session, the tmate step completes and the remaining workflow steps continue normally.
Note on access control: The step is injected with limit-access-to-actor: false. Anyone who can see the connection string in the logs can connect, not just the user who triggered the run. Keep logs private during active sessions.
Count the steps in your job definition, starting at 1. For example:
jobs:
build-and-test: # the job to reference in --job flag
runs-on: depot-ubuntu-latest
steps:
- uses: actions/checkout@v4 # step 1
- name: Set up Node # step 2
uses: actions/setup-node@v4
- name: Install dependencies # step 3
run: npm ci
- name: Build # step 4
run: npm run build
- name: Test # step 5 (failing step)
run: npm testTo inspect the environment right before the failing step, use --ssh-after-step 4.
From the root of your repository, run:
depot ci run \
--workflow .depot/workflows/<name>.yml \
--job <job> \
--ssh-after-step <n>The CLI starts the run, waits for the job to reach the tmate step, and then automatically connects you via SSH. In a non-interactive context (scripts, CI), it prints the SSH command to stdout instead.
Constraints:
--job<n> must be less than or equal to the total number of steps--ssh--org is required if you belong to more than one Depot organizationExample output:
Repo: depot-demo-org/habits-demo-app
Jobs: lint_typecheck
Inserting tmate step after step 4
Org: <org-id>
Run: hbdc14bcbk
Waiting for tmate session to start...
Waiting for job to be created...
Waiting for tmate session in logs...
Connecting: ssh GPB7Xs4TJj6WEpjNGuuyjUA5R@nyc1.tmate.ioDirect SSH connects you to the Depot sandbox environment over api.depot.dev using your Depot API token. This gives you a shell on the sandbox, but the workflow environment (checked-out code, installed dependencies, and so on) is not available. You're connecting to the raw sandbox, not to a paused workflow step.
You can connect two ways: when you start a new run, or by attaching to a job that's already running.
Use --ssh on depot ci run to start the workflow and automatically connect once the sandbox is ready:
depot ci run \
--workflow .depot/workflows/<name>.yml \
--job <job> \
--sshThe CLI waits for the sandbox to be provisioned and then opens an interactive terminal session. Constraints:
--job--ssh-after-step--org is required if you belong to more than one Depot organizationUse depot ci ssh to connect to a job that's already in progress:
depot ci ssh <run-id> --job <job>Or, if the run has only one job:
depot ci ssh <run-id>You can also pass a job ID directly:
depot ci ssh <job-id>If the job hasn't started yet, the command waits up to 5 minutes for the sandbox to be provisioned. Once a sandbox has been provisioned for a running attempt, depot ci status shows the exact depot ci ssh command to use. For queued jobs or attempts that haven't yet received a sandbox, the SSH hint won't appear in the status output, but you can still run depot ci ssh <run-id> --job <job> directly and it will wait for provisioning. For single-job runs, --job can be omitted.
To print the SSH connection string instead of connecting interactively, use --info. This is useful for scripting or if you want to connect from a different terminal:
depot ci ssh <run-id> --info
depot ci ssh <run-id> --info --output jsonWhether you connect via direct SSH or tmate, you're in a shell on the Depot CI sandbox as the runner user, with root privileges. For tmate sessions, you're in the job's workspace with the full workflow environment. For direct SSH, you're in the sandbox and the working directory and environment depends on what steps have run.
Some examples of tasks you can do in the sandbox environment over SSH:
npm testenv | grep MY_VARls -la or cat /etc/os-release$GITHUB_ENV, $GITHUB_PATHTo end the session, press CTRL + D or type exit.
For tmate sessions, the tmate step completes and the remaining workflow steps resume running after you exit.