Repository navigation
[agentbricks] Keep an active VIRTUAL_ENV out of agentbricks dev's run-local - #714
Merged
elainewang-db merged 3 commits intoOct 9, 2026
Merged
Conversation
…-local Co-authored-by: Isaac <no-reply@databricks.com>
elainewang-db
marked this pull request as ready for review
October 9, 2026 00:31
jamesbxwu
reviewed
Oct 9, 2026
jamesbxwu
left a comment
Contributor
There was a problem hiding this comment.
can you resolve merge conflict since my refactor changes have now landed?
…alenv # Conflicts: # integrations/agentbricks/src/databricks_agentbricks/cli/dev.py
jamesbxwu
approved these changes
Oct 9, 2026
Co-authored-by: Isaac <no-reply@databricks.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When a virtualenv is active,
agentbricks devinstalls the agent app's dependencies into that venv instead of the project's own.venv. The app's dependencies include older versions of packages, so this can silently downgrade whatever is installed there.Cause: on a first run,
agentbricks devcallsdatabricks apps run-local --prepare-environment..venv.uv pip.uv pipinstalls into the active venv ($VIRTUAL_ENV) whenever one is set, and only falls back to the project's.venvotherwise.The run-local log shows it:
run-localhas no option to choose the target venv.Fix:
agentbricks devnow runsrun-localwithVIRTUAL_ENVremoved from its environment, so dependencies go into the project's.venv. To make that possible, the shared_databrickshelper gains an optionalenvargument. Its other callers don't pass it and are unchanged.How we found it: the E2E suite in #706 runs under
uv run pytest, which setsVIRTUAL_ENVto the test environment. Eachagentbricks devstart downgraded the test environment's own packages mid-run, and the CLI under test then failed on import.The underlying behavior is in
databricks apps run-local, which should install into the venv it just created. That's worth raising with the Databricks CLI / Apps team separately.Testing
test_dev_hides_active_venv_from_run_local: withVIRTUAL_ENVset,run-localis called without it, and the rest of the environment is passed through.pytest tests/unit_testspasses: 1536 passed, 81 skipped.ruff checkandruff format --checkare clean.ty checkreports the same 38 diagnostics asmain.This pull request and its description were written by Isaac.