Skip to content

cd into the workspace home folder on ssh connect - #5688

Merged
anton-107 merged 7 commits into
mainfrom
anekipelov/ssh-connect-cd-workspace-home
Jun 23, 2026
Merged

cd into the workspace home folder on ssh connect#5688
anton-107 merged 7 commits into
mainfrom
anekipelov/ssh-connect-cd-workspace-home

Conversation

@anton-107

@anton-107anton-107 commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Summary

For interactive databricks ssh connect sessions, the shell now changes into the user's workspace home folder (/Workspace/Users/<email>) before launching, instead of landing in the OS home (/root etc).

  • The cd is best-effort (cd '<wsHome>' 2>/dev/null;): if the folder isn't mounted/available the shell still launches from $HOME.
  • Non-interactive invocations (databricks ssh connect ... -- ls -la) are unaffected — no cd, command passed verbatim.
  • The workspace home path is derived from client.CurrentUser.Me (the same identity runIDE / vscode.LaunchIDE already use), and the lookup is skipped entirely when a remote command is supplied.
  • The IDE (VS Code/Cursor) path already opens /Workspace/Users/<email>/ as the remote folder (vscode.LaunchIDE), so no change is needed there.

Stacked on #5687 (bash-default-shell). This PR's base is anekipelov/ssh-connect-bash-shell-v2; it should be retargeted to main once #5687 merges. The cd composes onto the bash-launch mechanism introduced there.

Test plan

  • go test ./experimental/ssh/internal/client/TestBuildRemoteShellArgs covers the cd prefix, the no-cd (empty wsHome) case, and the non-interactive passthrough.
  • Manual: databricks ssh connect --cluster=<id> then pwd shows /Workspace/Users/<email>; databricks ssh connect --cluster=<id> -- pwd is unchanged.

Jira: DECO-27477

When `databricks ssh connect` is run without a trailing command, explicitly
launch a login bash over a PTY instead of relying on the compute image's
default login shell (which is /bin/sh on Databricks images). Falls back to
$SHELL or /bin/sh when bash is unavailable, so the connection never breaks.
Passing an explicit remote command (`-- <cmd>`) is unchanged.
This drops the prior server-side /etc/passwd approach (PR #5002), which could
not work: the repl user is not root and cannot edit /etc/passwd.
DECO-27476
Co-authored-by: Isaac
Co-authored-by: Isaac
For interactive `databricks ssh connect` sessions, change into the user's
workspace home folder (/Workspace/Users/<email>) before launching the shell,
instead of landing in the OS home (/root etc). The cd is best-effort: if the
folder is unavailable the shell still launches from $HOME. Non-interactive
invocations (`-- <cmd>`) are unaffected.
The IDE (VS Code/Cursor) path already opens /Workspace/Users/<email> as the
remote folder, so no change is needed there.
DECO-27477
Co-authored-by: Isaac
Co-authored-by: Isaac
@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator

Integration test report

Commit: 8748090

Run: 28038632467

Env🟨​KNOWN🔄​flaky✅​pass🙈​skipTime
🟨​aws linux112159911:25
🟨​aws windows1218973:01
🟨​aws-ucws linux1297183:46
🟨​aws-ucws windows1299163:37
🟨​azure linux1216983:36
🟨​azure windows1218962:38
🟨​azure-ucws linux1299154:25
🟨​azure-ucws windows1301133:28
🟨​gcp linux12151003:09
🟨​gcp windows1217982:40
Test Nameaws linuxaws windowsaws-ucws linuxaws-ucws windowsazure linuxazure windowsazure-ucws linuxazure-ucws windowsgcp linuxgcp windows
🟨​TestAccept🟨​K🟨​K🟨​K🟨​K🟨​K🟨​K🟨​K🟨​K🟨​K🟨​K
🔄​TestSecretsPutSecretBytesValue🔄​f✅​p🙈​s🙈​s✅​p✅​p✅​p✅​p✅​p✅​p
Top 1 slowest tests (at least 2 minutes):
durationenvtestname
7:53aws linuxTestSecretsPutSecretBytesValue

ssh stops parsing options at the destination host, so the `-t` that
buildRemoteShellArgs emitted *after* the hostname was treated as part of the
remote command rather than as ssh's force-PTY flag (this only happened to work
where getopt permutes args, e.g. glibc; on BSD/macOS getopt it would not).
Move `-t` into the option list before the destination by extracting buildSSHArgs,
and have buildRemoteShellArgs return only the remote command. Adds a regression
test asserting `-t` precedes the host.
Addresses review feedback on the PR.
Co-authored-by: Isaac
…sh-connect-cd-workspace-home
# Conflicts:
#	experimental/ssh/internal/client/client.go
#	experimental/ssh/internal/client/client_internal_test.go
Base automatically changed from anekipelov/ssh-connect-bash-shell-v2 to mainJune 23, 2026 15:35
…t-cd-workspace-home
# Conflicts:
#	NEXT_CHANGELOG.md
#	experimental/ssh/internal/client/client.go
#	experimental/ssh/internal/client/client_internal_test.go
@anton-107
anton-107 enabled auto-merge June 23, 2026 16:02
@anton-107
anton-107 added this pull request to the merge queueJun 23, 2026
Merged via the queue into main with commit 34f4b67Jun 23, 2026
25 checks passed
@anton-107
anton-107 deleted the anekipelov/ssh-connect-cd-workspace-home branch June 23, 2026 16:43
deco-sdk-taggingBot added a commit that referenced this pull request Jun 24, 2026
## Release v1.5.0
### CLI
* `workspace export-dir` no longer aborts when a workspace object's name is not a legal local filename (e.g. a notebook named `New Notebook 2026-05-04 13:54:24` whose `:` is illegal on Windows). Such files are now exported under a sanitized name with a warning and the export completes ([#5171](#5171)).
* `ssh connect` now opens an interactive `bash` login shell by default instead of the compute image's default `/bin/sh`, falling back gracefully when `bash` is unavailable. Passing an explicit remote command (`-- <cmd>`) is unaffected ([#5687](#5687)).
* `ssh connect` interactive sessions now start in the user's workspace home folder (`/Workspace/Users/<email>`) instead of the OS home directory, falling back to the OS home when that folder is unavailable ([#5688](#5688)).
### Bundles
* Add documentation for the common bundle resource fields `permissions`, `lifecycle`, and `grants` in the JSON schema, so they surface in editor completions and the docs.
* `bundle run` now prints the modern job run URL (`/jobs/<id>/runs/<id>`) so that non-admin users permitted to view the run are taken to the run instead of the workspace homepage.
* References to a registered model's `registered_model_id` now resolve under the direct engine, matching Terraform behavior ([#5621](#5621)).
* Fix missing field descriptions in the bundle JSON schema for fields whose upstream API docs arrived after the field was first annotated (e.g. `vector_search_endpoints.*.target_qps`); stale placeholder markers no longer hide them ([#5588](#5588)).
* Fix `bundle deploy --plan` dropping a `postgres_role`'s `role_id`, which caused the role to be recreated on the next deploy ([#5672](#5672)).
* direct: Fix spurious cluster recreate when `apply_policy_default_values: true` is set ([#5693](#5693)).
* direct: New 'deployment migrate' implementation that parses terraform state instead of fetching resources state from the backend ([#5399](#5399)).
### Dependency updates
* Bump `github.com/databricks/databricks-sdk-go` from v0.141.0 to v0.147.0 ([#5636](#5636)).
* Bump Terraform provider from v1.117.0 to v1.118.0 ([#5637](#5637)).
Sign up for freeto 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.

4 participants

@anton-107@eng-dev-ecosystem-bot@rugpanov@rclarey