Skip to content

Fix Databricks Connect run/debug interpreter split-brain#1912

Merged
rugpanov merged 2 commits into
mainfrom
improve/pr1-dbconnect-run-debug
Jun 19, 2026
Merged

Fix Databricks Connect run/debug interpreter split-brain#1912
rugpanov merged 2 commits into
mainfrom
improve/pr1-dbconnect-run-debug

Conversation

@rugpanov

Copy link
Copy Markdown
Contributor

Why

  • "Debug with Databricks Connect" used the wrong interpreter. It started a debugpy session without a pinned interpreter, so debugpy fell back to the Python extension's folder-level selection — which can differ from the environment used by "run" and by the verification checks. With e.g. a system Python 3.9 selected there, debug crashed with a raw ModuleNotFoundError: No module named 'databricks' while run worked fine.
  • Stale interpreter checks. The cached environment state can refer to a previously selected interpreter, because the Python extension doesn't always notify us when the interpreter changes — so a mismatch surfaced as a bootstrap traceback instead of the actionable setup flow.

What

  • Pin debugpy to the verified interpreter via the debug configuration's python attribute (DatabricksPythonDebugConfiguration.python).
  • Resolve the interpreter once in a shared run/debug preflight (resolveDbconnectLaunch), so run and debug provably use the same executable (removes the duplicated preamble).
  • Re-verify the environment before launch when the selected interpreter changed since the cached check — only while CONNECTED, since a re-check blocks on the connection.
  • After an in-flow environment setup, re-check and let the launch proceed instead of aborting and forcing the user to re-trigger.

Verification

  • New/updated unit tests in RunCommands.test.ts: debug-config pinning, stale-interpreter re-verification, no-reverify-while-disconnected, and proceed-after-setup. RunCommands suite passes (6 tests) in the VS Code test host.
  • eslint and prettier clean on the changed files.

Notes

This is the first of three slices carved out of #1905 (run/debug interpreter split-brain). The pip-less-venv and Python-version-requirement fixes follow in separate PRs.

This pull request and its description were written by Isaac.

*Why*:
* "Debug with Databricks Connect" started debugpy without a pinned interpreter, so it fell back to the Python extension's folder-level selection — which can differ from the environment used by "run" and by the verification checks — producing a raw ModuleNotFoundError instead of the actionable setup flow.
* The cached environment check can reference a previously selected interpreter, because the Python extension doesn't always notify us when the interpreter changes.

*What:*
* Pin debugpy to the verified interpreter via the debug configuration's `python` attribute.
* Resolve the interpreter once in a shared run/debug preflight, so both paths provably use the same executable.
* Re-verify the environment before launching when the selected interpreter changed since the cached check (only while connected, since a re-check blocks on the connection).
* After an in-flow environment setup, re-check and let the launch proceed instead of aborting and forcing the user to re-trigger.

*Verification:*
* Added/updated unit tests: debug-config pinning, stale-interpreter re-verification, and proceed-after-setup; RunCommands suite passes (6 tests) in the VS Code test host.
* Lint clean on the changed files.

Co-authored-by: Isaac
@rugpanov

Copy link
Copy Markdown
Contributor Author

1 similar comment
@rugpanov

Copy link
Copy Markdown
Contributor Author

@misha-db misha-db self-requested a review June 18, 2026 13:16
@github-actions

Copy link
Copy Markdown
Contributor

If integration tests don't run automatically, an authorized user can run them manually by following the instructions below:

Trigger:
go/deco-tests-run/vscode

Inputs:

  • PR number: 1912
  • Commit SHA: 61af5033bb4f9ba2af81a95271865bfc1e947d19

Checks will be approved automatically on success.

@rugpanov rugpanov merged commit 2bebf16 into main Jun 19, 2026
6 of 8 checks passed
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.

2 participants