Skip to content

Install AI Tools once per agent for users who previously configured ucode#231

Open
lennartkats-db wants to merge 4 commits into
databricks:mainfrom
lennartkats-db:add-ai-tools-marker
Open

Install AI Tools once per agent for users who previously configured ucode#231
lennartkats-db wants to merge 4 commits into
databricks:mainfrom
lennartkats-db:add-ai-tools-marker

Conversation

@lennartkats-db

Copy link
Copy Markdown

Stacked on #230. #230 installs Databricks AI Tools when an agent is configured, but users who already set up ucode before it shipped won't get them, since their agents are configured and configuration won't re-run. This backfills them: a persisted ai_tools_installed marker means any already-configured agent gets a one-time install on its next ucode launch, then is skipped without shelling out again.

  • target branch of this stacked PR must be set to main before merging

Tests

Unit tests for the marker (recorded on success, skipped when marked, retried on failure), plus end-to-end: an already-configured user's first ucode claude installs AI Tools and the second launch skips it.

`ucode configure` now runs `databricks aitools install` for each coding
agent it sets up (claude-code, codex, opencode, copilot), so agents work
with Databricks out of the box. Best-effort: a failure only warns with the
CLI's own error, since AI Tools aren't required to launch an agent.

Co-authored-by: Isaac
v1.0.0 is the release that ships `databricks aitools install --agents
... --scope`, so bump MIN_DATABRICKS_CLI_VERSION to (1, 0, 0) and drop the
decorative AITOOLS_MIN_CLI_VERSION. `ensure_databricks_cli_version` already
runs (and auto-upgrades) before every path that reaches install_ai_tools,
so the install no longer guesses a version cause on failure: it just
surfaces the CLI's own error.

Co-authored-by: Isaac
subprocess.TimeoutExpired.stderr is bytes even when the call used text=True
(a CPython quirk), so a timed-out `databricks aitools install` rendered its
warning as `b'...'`. Decode bytes before building the reason string, and
cover the timeout-with-stderr path with a test.

Co-authored-by: Isaac
Records an `ai_tools_installed` marker in state so `databricks aitools
install` runs at most once per agent. `install_ai_tools` returns the agents
it installed; `install_ai_tools_for_agents` skips already-marked agents
(no subprocess) and records successes, and the launch path calls it so an
agent configured before AI Tools existed gets a one-time install on its
next `ucode <agent>`.

Builds on databricks#230 (install AI Tools during configuration).

Co-authored-by: Isaac
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.

1 participant