Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .nextchanges/cli/aitools-auto-install-consent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* The automatic installation of Databricks AI tools now runs only after explicit consent or when an existing CLI-managed global installation is found. Explicit consent is `databricks aitools auto-install enable`, a global `databricks aitools install`, or a "yes" to the skills prompt of `databricks apps init`. If you ran `databricks aitools auto-install enable` with an earlier CLI version and have no global installation that the CLI made, run it again: before, it only undid `disable` and did not record an agreement. With such an installation, the CLI infers the consent automatically. It no longer asks anything after a command, and its notice now also names `databricks aitools uninstall`. ([#8135](https://github.com/databricks/cli/pull/8135))
13 changes: 11 additions & 2 deletions acceptance/cmd/aitools/auto-install/agent-hint/output.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@

>>> [CLI] aitools auto-install enable
Automatic installation of Databricks AI tools is enabled.

=== a failing command: no install, the hint once the command ends

>>> CLAUDECODE=1 [CLI] jobs get abc
Expand All @@ -13,7 +16,7 @@ Exit code: 1
=== first run of a new version: the install notice, no install hint

>>> CLAUDECODE=1 [CLI] jobs list
Installed Databricks AI tools for Claude Code, Cursor. Disable: databricks aitools auto-install disable
Installed Databricks AI tools for Claude Code, Cursor. Turn off: databricks aitools auto-install disable. Remove: databricks aitools uninstall

>>> print_telemetry
{"command":"jobs_list","exit_code":0,"aitools_install_event":{"agents":["CLAUDE_CODE","CURSOR"],"scope":"GLOBAL","error_category":"TYPE_UNSPECIFIED","agent_results":[{"agent":"CLAUDE_CODE","error_category":"CLI_NOT_ON_PATH"}],"trigger":"AUTO_FIRST_RUN"}}
Expand All @@ -27,6 +30,9 @@ Installed Databricks AI tools for Claude Code, Cursor. Disable: databricks aitoo

=== gate off: no install, the hint once the command ends, and on the next

>>> [CLI] aitools auto-install enable
Automatic installation of Databricks AI tools is enabled.

>>> CLAUDECODE=1 [CLI] jobs list
Databricks skills are not installed. To work with Databricks reliably, first run: databricks aitools install

Expand All @@ -41,9 +47,12 @@ Databricks skills are not installed. To work with Databricks reliably, first run

=== an agent the install skips is still hinted: Claude Code has no config dir

>>> [CLI] aitools auto-install enable
Automatic installation of Databricks AI tools is enabled.

>>> CLAUDECODE=1 [CLI] jobs list
Databricks skills are not installed. To work with Databricks reliably, first run: databricks aitools install
Installed Databricks AI tools for Cursor. Disable: databricks aitools auto-install disable
Installed Databricks AI tools for Cursor. Turn off: databricks aitools auto-install disable. Remove: databricks aitools uninstall

>>> print_telemetry
{"command":"jobs_list","exit_code":0,"aitools_hint_event":{"hint_kind":"INSTALL_TEXT"}}
Expand Down
12 changes: 8 additions & 4 deletions acceptance/cmd/aitools/auto-install/agent-hint/script
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# Claude Code calls the CLI: its config dir exists and its CLI is not on PATH,
# so auto-install gives it skill files. The install hint must not tell it to
# install what the same run installs.
unset AGENT CLAUDE_CODE_SESSION_ID CLAUDE_CODE_CHILD_SESSION
# Claude Code calls the CLI on a machine whose user agreed to auto-install:
# its config dir exists and its CLI is not on PATH, so auto-install gives it
# skill files. The install hint must not tell it to install what the same run
# installs. Without the consent, see no-consent.
unset CLAUDE_CODE_SESSION_ID CLAUDE_CODE_CHILD_SESSION
use_home home
"$mkdir_bin" -p "${USERPROFILE:-$HOME}/.claude"
gate true
trace $CLI aitools auto-install enable

title "a failing command: no install, the hint once the command ends"
errcode trace CLAUDECODE=1 $CLI jobs get abc
Expand All @@ -22,6 +24,7 @@ title "gate off: no install, the hint once the command ends, and on the next"
use_home no-agents-home
"$mkdir_bin" -p "${USERPROFILE:-$HOME}/.claude"
gate false
trace $CLI aitools auto-install enable
trace CLAUDECODE=1 $CLI jobs list
trace print_telemetry
trace CLAUDECODE=1 $CLI jobs list
Expand All @@ -30,5 +33,6 @@ trace print_telemetry
title "an agent the install skips is still hinted: Claude Code has no config dir"
use_home holdout-home
gate true
trace $CLI aitools auto-install enable
trace CLAUDECODE=1 $CLI jobs list
trace print_telemetry
13 changes: 6 additions & 7 deletions acceptance/cmd/aitools/auto-install/first-run/output.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@

>>> [CLI] aitools auto-install enable
Automatic installation of Databricks AI tools is enabled.

=== first run of a new version: installs for the detected agents, one stderr line

>>> [CLI] jobs list
Installed Databricks AI tools for Claude Code, Cursor. Disable: databricks aitools auto-install disable
Installed Databricks AI tools for Claude Code, Cursor. Turn off: databricks aitools auto-install disable. Remove: databricks aitools uninstall

>>> print_telemetry
{"command":"jobs_list","exit_code":0,"aitools_install_event":{"agents":["CLAUDE_CODE","CURSOR"],"scope":"GLOBAL","error_category":"TYPE_UNSPECIFIED","agent_results":[{"agent":"CLAUDE_CODE","error_category":"CLI_NOT_ON_PATH"}],"trigger":"AUTO_FIRST_RUN"}}
Expand All @@ -14,7 +17,7 @@ databricks-test
>>> auto_install_state
{
"last_version": "1.30.0",
"installed_without_consent": true,
"consented": true,
"id": "treatment-machine"
}

Expand Down Expand Up @@ -44,7 +47,6 @@ Uninstalled 1 skill.
>>> [CLI] jobs list

>>> auto_install_outcome
KEPT

>>> cursor_skills
databricks-test
Expand All @@ -57,19 +59,16 @@ SKILL.md
my own skill

>>> settled_version
{"last_version":"1.30.0","installed_without_consent":true}
{}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nice to have] use_home hand-placed-home and use_home own-skill-home start with no consent, and the script never runs auto-install enable for them, so both runs now stop at no_consent. The regenerated golden accepted that: no KEPT outcome, settled_version is {}, and the own-skill case (lines 66-71) prints no notice and installs no databricks-test. The titles still say "kept … not retried" and "installs", and the hand-placed refusal has no acceptance coverage left. Can you add trace $CLI aitools auto-install enable after each of those use_home calls, as agent-hint and skipped do, and regenerate?


=== first run with the user's own skill under another name in an agent's skills directory: installs

>>> [CLI] jobs list
Installed Databricks AI tools for Cursor. Disable: databricks aitools auto-install disable

>>> auto_install_outcome
INSTALLED

>>> cursor_skills
databricks-team-conventions
databricks-test

>>> cat [TEST_TMP_DIR]/own-skill-home/.cursor/skills/databricks-team-conventions/SKILL.md
my own skill
1 change: 1 addition & 0 deletions acceptance/cmd/aitools/auto-install/first-run/script
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use_home home
# install), so it gets skill files, as `aitools install` gives it.
"$mkdir_bin" -p "${USERPROFILE:-$HOME}/.claude"
gate true
trace $CLI aitools auto-install enable

title "first run of a new version: installs for the detected agents, one stderr line"
trace $CLI jobs list
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Cloud = false
36 changes: 36 additions & 0 deletions acceptance/cmd/aitools/auto-install/no-consent/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@

=== the user never answered: nothing installed, written or reported, the gate is not looked up, and the agent gets the install hint

>>> CLAUDECODE=1 [CLI] jobs list --log-file LOG.no-consent --log-level debug
Databricks skills are not installed. To work with Databricks reliably, first run: databricks aitools install

>>> print_telemetry
{"command":"jobs_list","exit_code":0,"aitools_hint_event":{"hint_kind":"INSTALL_TEXT"}}

>>> cursor_skills
(no skills)

>>> auto_install_state
{"id": "treatment-machine"}

=== the user agrees: the next command of the same version installs

>>> [CLI] aitools auto-install enable
Automatic installation of Databricks AI tools is enabled.

>>> CLAUDECODE=1 [CLI] jobs list --log-file LOG.consent --log-level debug
Installed Databricks AI tools for Claude Code, Cursor. Turn off: databricks aitools auto-install disable. Remove: databricks aitools uninstall

>>> print_telemetry
{"command":"jobs_list","exit_code":0,"aitools_install_event":{"agents":["CLAUDE_CODE","CURSOR"],"scope":"GLOBAL","error_category":"TYPE_UNSPECIFIED","agent_results":[{"agent":"CLAUDE_CODE","error_category":"CLI_NOT_ON_PATH"}],"trigger":"AUTO_FIRST_RUN"}}
{"command":"jobs_list","exit_code":0,"aitools_auto_install_event":{"outcome":"INSTALLED","holdout_arm":"TREATMENT","interactive":false}}

>>> cursor_skills
databricks-test

>>> auto_install_state
{
"last_version": "1.30.0",
"consented": true,
"id": "treatment-machine"
}
24 changes: 24 additions & 0 deletions acceptance/cmd/aitools/auto-install/no-consent/script
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Claude Code calls the CLI on a machine whose user never agreed to
# auto-install. Its config dir exists and its CLI is not on PATH, so an install
# would give it skill files.
unset CLAUDE_CODE_SESSION_ID CLAUDE_CODE_CHILD_SESSION
use_home home
"$mkdir_bin" -p "${USERPROFILE:-$HOME}/.claude"
# use_home wrote the state file by hand: a write by the CLI would indent it.
gate true

title "the user never answered: nothing installed, written or reported, the gate is not looked up, and the agent gets the install hint"
trace CLAUDECODE=1 $CLI jobs list --log-file LOG.no-consent --log-level debug
# The gate lookup would read the compatibility manifest from the cache.
contains.py "auto-install: skipped: no_consent" "!Using cached manifest" < LOG.no-consent > LOG.no-consent-checked
trace print_telemetry
trace cursor_skills
trace auto_install_state

title "the user agrees: the next command of the same version installs"
trace $CLI aitools auto-install enable
trace CLAUDECODE=1 $CLI jobs list --log-file LOG.consent --log-level debug
contains.py "Using cached manifest" < LOG.consent > LOG.consent-checked
trace print_telemetry
trace cursor_skills
trace auto_install_state
31 changes: 18 additions & 13 deletions acceptance/cmd/aitools/auto-install/no-terminal/output.txt
Original file line number Diff line number Diff line change
@@ -1,31 +1,36 @@

=== no terminal and no coding agent: cannot ask, so nothing is installed or reported, and the version is not settled
>>> [CLI] aitools auto-install enable
Automatic installation of Databricks AI tools is enabled.

=== no terminal and no coding agent: installs without asking

>>> [CLI] jobs list
Installed Databricks AI tools for Cursor. Turn off: databricks aitools auto-install disable. Remove: databricks aitools uninstall

>>> print_telemetry
{"command":"jobs_list","exit_code":0,"aitools_install_event":{"agents":["CURSOR"],"scope":"GLOBAL","error_category":"TYPE_UNSPECIFIED","trigger":"AUTO_FIRST_RUN"}}
{"command":"jobs_list","exit_code":0,"aitools_auto_install_event":{"outcome":"INSTALLED","holdout_arm":"TREATMENT","interactive":false}}

>>> cursor_skills
(no skills)
databricks-test

>>> auto_install_state
{"id": "treatment-machine"}
{
"last_version": "1.30.0",
"consented": true,
"id": "treatment-machine"
}

=== the version is still due: a coding agent's call installs without asking
=== a coding agent's call on the next version: the update runs without asking

>>> AGENT=test-agent [CLI] jobs list
Installed Databricks AI tools for Cursor. Disable: databricks aitools auto-install disable
>>> AGENT=test-agent DATABRICKS_AITOOLS_AUTO_INSTALL_CLI_VERSION=1.31.0 [CLI] jobs list

>>> print_telemetry
{"command":"jobs_list","exit_code":0,"aitools_install_event":{"agents":["CURSOR"],"scope":"GLOBAL","error_category":"TYPE_UNSPECIFIED","trigger":"AUTO_FIRST_RUN"}}
{"command":"jobs_list","exit_code":0,"aitools_auto_install_event":{"outcome":"INSTALLED","holdout_arm":"TREATMENT","interactive":false}}

>>> cursor_skills
databricks-test
{"command":"jobs_list","exit_code":0,"aitools_auto_install_event":{"outcome":"UP_TO_DATE","holdout_arm":"TREATMENT","interactive":false}}

>>> auto_install_state
{
"last_version": "1.30.0",
"installed_without_consent": true,
"last_version": "1.31.0",
"consented": true,
"id": "treatment-machine"
}
9 changes: 4 additions & 5 deletions acceptance/cmd/aitools/auto-install/no-terminal/script
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
use_home home
gate true
unset AGENT
trace $CLI aitools auto-install enable

title "no terminal and no coding agent: cannot ask, so nothing is installed or reported, and the version is not settled"
title "no terminal and no coding agent: installs without asking"
trace $CLI jobs list
trace print_telemetry
trace cursor_skills
trace auto_install_state

title "the version is still due: a coding agent's call installs without asking"
trace AGENT=test-agent $CLI jobs list
title "a coding agent's call on the next version: the update runs without asking"
trace AGENT=test-agent DATABRICKS_AITOOLS_AUTO_INSTALL_CLI_VERSION=1.31.0 $CLI jobs list
trace print_telemetry
trace cursor_skills
trace auto_install_state
9 changes: 6 additions & 3 deletions acceptance/cmd/aitools/auto-install/retries/output.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@

>>> [CLI] aitools auto-install enable
Automatic installation of Databricks AI tools is enabled.

=== a failed attempt is silent, and the commands right after it do not retry

>>> print_telemetry
Expand All @@ -14,8 +17,8 @@
"last_version": "1.30.0",
"attempts": 1,
"last_attempt": "[LAST_ATTEMPT]",
"consented": true,
"installing": true,
"installed_without_consent": true,
"id": "treatment-machine"
}

Expand Down Expand Up @@ -43,7 +46,7 @@
=== a new version starts over

>>> DATABRICKS_AITOOLS_AUTO_INSTALL_CLI_VERSION=1.31.0 [CLI] jobs list
Installed Databricks AI tools for Cursor. Disable: databricks aitools auto-install disable
Installed Databricks AI tools for Cursor. Turn off: databricks aitools auto-install disable. Remove: databricks aitools uninstall

>>> print_telemetry
{"command":"jobs_list","exit_code":0,"aitools_install_event":{"agents":["CURSOR"],"scope":"GLOBAL","error_category":"TYPE_UNSPECIFIED","trigger":"AUTO_FIRST_RUN"}}
Expand All @@ -52,6 +55,6 @@ Installed Databricks AI tools for Cursor. Disable: databricks aitools auto-insta
>>> auto_install_state
{
"last_version": "1.31.0",
"installed_without_consent": true,
"consented": true,
"id": "treatment-machine"
}
1 change: 1 addition & 0 deletions acceptance/cmd/aitools/auto-install/retries/script
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use_home home
gate true
trace $CLI aitools auto-install enable

# end_retry_wait moves the last failed attempt back in time, as if the wait
# before the next attempt were over.
Expand Down
8 changes: 1 addition & 7 deletions acceptance/cmd/aitools/auto-install/script.prepare
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@ unset CI DATABRICKS_AITOOLS_AUTO_INSTALL GITHUB_ACTIONS GITLAB_CI JENKINS_URL TF
# Telemetry is printed by print_telemetry.
unset DATABRICKS_CLI_DISABLE_TELEMETRY DATABRICKS_CLI_TELEMETRY_TIMEOUT

# Without a terminal, only a coding agent's call installs: any other run cannot
# ask first, so it skips (see no-terminal). The cases have no terminal, so they
# run as a coding agent's call. AGENT is the generic marker; this name gets no
# agent hint.
export AGENT=test-agent

# Test binaries are development builds, which never auto-install. Each case
# names the released version it simulates.
export DATABRICKS_AITOOLS_AUTO_INSTALL_CLI_VERSION=1.30.0
Expand All @@ -28,7 +22,7 @@ ls_bin=$(command -v ls)
# use_home HOME [ID] isolates HOME with Cursor's config dir present, and stores
# the machine id ID (default: treatment-machine, whose holdout bucket is in the
# treatment arm; holdout-machine is in the holdout), so the arm does not
# depend on a random id.
# depend on a random id. The user has not agreed to auto-install yet.
#
# Auto-install acts only on agents whose config directory exists, and installs
# plugins through agent CLIs found on PATH. Keep both inside the test: point
Expand Down
22 changes: 21 additions & 1 deletion acceptance/cmd/aitools/auto-install/skipped/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,20 @@ Automatic installation of Databricks AI tools is disabled.
>>> [CLI] aitools auto-install enable
Automatic installation of Databricks AI tools is enabled.

=== DATABRICKS_AITOOLS_AUTO_INSTALL=false wins over the consent

>>> DATABRICKS_AITOOLS_AUTO_INSTALL=false [CLI] jobs list

>>> print_telemetry
{"command":"jobs_list","exit_code":0,"aitools_auto_install_event":{"outcome":"SKIPPED_OPTOUT","holdout_arm":"TREATMENT","interactive":false}}

>>> auto_install_state
{
"last_version": "1.32.1",
"consented": true,
"id": "treatment-machine"
}

=== commands that never trigger it

>>> [CLI] version
Expand All @@ -52,7 +66,7 @@ Automatic installation of Databricks AI tools is enabled.

>>> auto_install_state
{
"last_version": "1.32.0",
"last_version": "1.32.1",
"consented": true,
"id": "treatment-machine"
}
Expand Down Expand Up @@ -82,6 +96,9 @@ Automatic installation of Databricks AI tools is enabled.

=== a machine in the holdout: not installed

>>> [CLI] aitools auto-install enable
Automatic installation of Databricks AI tools is enabled.

>>> [CLI] jobs list

>>> print_telemetry
Expand All @@ -92,6 +109,9 @@ Automatic installation of Databricks AI tools is enabled.

=== no agent config directory: nothing to install

>>> [CLI] aitools auto-install enable
Automatic installation of Databricks AI tools is enabled.

>>> [CLI] jobs list

>>> print_telemetry
Loading
Loading