Repository navigation
aitools: install AI tools after the first command of a new CLI version #7702
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
c5eef9c
aitools: store the auto-install state and opt-out, gate it in cli-compat
anton-107 e5662ad
aitools: install AI tools after the first command of a new CLI version
anton-107 8926e09
aitools: address review on the auto-install opt-out
anton-107 879027f
aitools: address review of the first-run auto-install
anton-107 15cf94d
Merge branch 'aitools/auto-install-state-opt-out' into aitools/auto-i…
anton-107 eafb251
aitools: unset CI provider variables in the auto-install acceptance t…
anton-107 3344168
Merge main into aitools/auto-install-first-run
anton-107 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Cloud = false |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
|
|
||
| === 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 | ||
|
|
||
| >>> 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", | ||
| "id": "treatment-machine" | ||
| } | ||
|
|
||
| === second run of the same version: nothing | ||
|
|
||
| >>> [CLI] jobs list | ||
|
|
||
| >>> print_telemetry | ||
|
|
||
| === uninstall turns it off: the next version installs nothing | ||
|
|
||
| >>> [CLI] aitools uninstall | ||
| Uninstalled 1 skill. | ||
|
|
||
| >>> DATABRICKS_AITOOLS_AUTO_INSTALL_CLI_VERSION=1.31.0 [CLI] jobs list | ||
|
|
||
| >>> print_telemetry | ||
| {"command":"aitools_uninstall","exit_code":0,"aitools_command_event":{"command":"UNINSTALL","stage":"STARTED","interactive":false}} | ||
| {"command":"aitools_uninstall","exit_code":0,"aitools_command_event":{"command":"UNINSTALL","stage":"FINISHED","outcome":"SUCCESS","interactive":false,"scope":"GLOBAL"}} | ||
| {"command":"jobs_list","exit_code":0,"aitools_auto_install_event":{"outcome":"SKIPPED_OPTOUT","holdout_arm":"TREATMENT","interactive":false}} | ||
|
|
||
| >>> cursor_skills | ||
| (no skills) |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| use_home home | ||
| # Claude Code's config dir exists but its CLI is not on PATH (a desktop or IDE | ||
| # install), so it gets skill files, as `aitools install` gives it. | ||
| "$mkdir_bin" -p "${USERPROFILE:-$HOME}/.claude" | ||
| gate true | ||
|
|
||
| title "first run of a new version: installs for the detected agents, one stderr line" | ||
| trace $CLI jobs list | ||
| trace print_telemetry | ||
| trace cursor_skills | ||
| trace auto_install_state | ||
|
|
||
| title "second run of the same version: nothing" | ||
| trace $CLI jobs list | ||
| trace print_telemetry | ||
|
|
||
| title "uninstall turns it off: the next version installs nothing" | ||
| trace $CLI aitools uninstall | ||
| trace DATABRICKS_AITOOLS_AUTO_INSTALL_CLI_VERSION=1.31.0 $CLI jobs list | ||
| trace print_telemetry | ||
| trace cursor_skills |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Cloud = false |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
|
|
||
| === a failed attempt is silent and retried on the next run, up to 10 attempts | ||
|
|
||
| >>> print_telemetry | ||
| 9 {"command":"jobs_list","exit_code":0,"aitools_auto_install_event":{"outcome":"FAILED","holdout_arm":"TREATMENT","interactive":false,"error_category":"SKILLS_FETCH_FAILED"}} | ||
| 9 {"command":"jobs_list","exit_code":0,"aitools_install_event":{"agents":["CURSOR"],"scope":"GLOBAL","error_category":"SKILLS_FETCH_FAILED","trigger":"AUTO_FIRST_RUN"}} | ||
|
|
||
| >>> auto_install_state | ||
| { | ||
| "last_version": "1.30.0", | ||
| "attempts": 9, | ||
| "installing": true, | ||
| "id": "treatment-machine" | ||
| } | ||
|
|
||
| >>> DATABRICKS_SKILLS_REF=broken-ref [CLI] jobs list | ||
|
|
||
| >>> print_telemetry | ||
| {"command":"jobs_list","exit_code":0,"aitools_install_event":{"agents":["CURSOR"],"scope":"GLOBAL","error_category":"SKILLS_FETCH_FAILED","trigger":"AUTO_FIRST_RUN"}} | ||
| {"command":"jobs_list","exit_code":0,"aitools_auto_install_event":{"outcome":"RETRIES_EXHAUSTED","holdout_arm":"TREATMENT","interactive":false,"error_category":"SKILLS_FETCH_FAILED"}} | ||
|
|
||
| === after 10 attempts the version gets no more | ||
|
|
||
| >>> [CLI] jobs list | ||
|
|
||
| >>> print_telemetry | ||
|
|
||
| >>> cursor_skills | ||
| (no skills) | ||
|
|
||
| === 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 | ||
|
|
||
| >>> 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}} | ||
|
|
||
| >>> auto_install_state | ||
| { | ||
| "last_version": "1.31.0", | ||
| "id": "treatment-machine" | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| use_home home | ||
| gate true | ||
|
|
||
| title "a failed attempt is silent and retried on the next run, up to 10 attempts" | ||
| for i in 1 2 3 4 5 6 7 8 9; do | ||
| DATABRICKS_SKILLS_REF=broken-ref $CLI jobs list | ||
| done | ||
| # One line per distinct event with its count (uniq -c pads differently by platform). | ||
| trace print_telemetry | sort | uniq -c | sed 's/^ *//' | ||
| trace auto_install_state | ||
| trace DATABRICKS_SKILLS_REF=broken-ref $CLI jobs list | ||
| trace print_telemetry | ||
|
|
||
| title "after 10 attempts the version gets no more" | ||
| trace $CLI jobs list | ||
| trace print_telemetry | ||
| trace cursor_skills | ||
|
|
||
| title "a new version starts over" | ||
| trace DATABRICKS_AITOOLS_AUTO_INSTALL_CLI_VERSION=1.31.0 $CLI jobs list | ||
| trace print_telemetry | ||
| trace auto_install_state |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Cloud = false |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
|
|
||
| === CI: not installed, reported once for the version | ||
|
|
||
| >>> CI=true [CLI] jobs list | ||
|
|
||
| >>> print_telemetry | ||
| {"command":"jobs_list","exit_code":0,"aitools_auto_install_event":{"outcome":"SKIPPED_CI","holdout_arm":"TREATMENT","interactive":false}} | ||
|
|
||
| >>> CI=true [CLI] jobs list | ||
|
|
||
| >>> print_telemetry | ||
|
|
||
| >>> cursor_skills | ||
| (no skills) | ||
|
|
||
| === DATABRICKS_AITOOLS_AUTO_INSTALL=false: not installed | ||
|
|
||
| >>> 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 disable: not installed | ||
|
|
||
| >>> [CLI] aitools auto-install disable | ||
| Automatic installation of Databricks AI tools is disabled. | ||
|
|
||
| >>> [CLI] jobs list | ||
|
|
||
| >>> print_telemetry | ||
| {"command":"jobs_list","exit_code":0,"aitools_auto_install_event":{"outcome":"SKIPPED_OPTOUT","holdout_arm":"TREATMENT","interactive":false}} | ||
|
|
||
| >>> cursor_skills | ||
| (no skills) | ||
|
|
||
| >>> [CLI] aitools auto-install enable | ||
| Automatic installation of Databricks AI tools is enabled. | ||
|
|
||
| === commands that never trigger it | ||
|
|
||
| >>> [CLI] version | ||
| Databricks CLI v[CLI_VERSION] | ||
|
|
||
| >>> [CLI] aitools auto-install enable | ||
| Automatic installation of Databricks AI tools is enabled. | ||
|
|
||
| >>> print_telemetry | ||
|
|
||
| >>> DATABRICKS_CACHE_ENABLED=false [CLI] jobs list | ||
|
|
||
| >>> print_telemetry | ||
|
|
||
| >>> auto_install_state | ||
| { | ||
| "last_version": "1.32.0", | ||
| "id": "treatment-machine" | ||
| } | ||
|
|
||
| >>> cursor_skills | ||
| (no skills) | ||
|
|
||
| === the gate is off: nothing printed or reported, and the version is settled | ||
|
|
||
| >>> [CLI] jobs list | ||
|
|
||
| >>> print_telemetry | ||
|
|
||
| >>> auto_install_state | ||
| { | ||
| "last_version": "1.33.0", | ||
| "id": "treatment-machine" | ||
| } | ||
|
|
||
| >>> [CLI] jobs list | ||
|
|
||
| >>> print_telemetry | ||
|
|
||
| >>> cursor_skills | ||
| (no skills) | ||
|
|
||
| === a machine in the holdout: not installed | ||
|
|
||
| >>> [CLI] jobs list | ||
|
|
||
| >>> print_telemetry | ||
| {"command":"jobs_list","exit_code":0,"aitools_auto_install_event":{"outcome":"SKIPPED_HOLDOUT","holdout_arm":"HOLDOUT","interactive":false}} | ||
|
|
||
| >>> cursor_skills | ||
| (no skills) | ||
|
|
||
| === no agent config directory: nothing to install | ||
|
|
||
| >>> [CLI] jobs list | ||
|
|
||
| >>> print_telemetry | ||
| {"command":"jobs_list","exit_code":0,"aitools_auto_install_event":{"outcome":"SKIPPED_NO_AGENTS","holdout_arm":"TREATMENT","interactive":false}} |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| use_home home | ||
| gate true | ||
|
|
||
| title "CI: not installed, reported once for the version" | ||
| trace CI=true $CLI jobs list | ||
| trace print_telemetry | ||
| trace CI=true $CLI jobs list | ||
| trace print_telemetry | ||
| trace cursor_skills | ||
|
|
||
| export DATABRICKS_AITOOLS_AUTO_INSTALL_CLI_VERSION=1.31.0 | ||
| title "DATABRICKS_AITOOLS_AUTO_INSTALL=false: not installed" | ||
| trace DATABRICKS_AITOOLS_AUTO_INSTALL=false $CLI jobs list | ||
| trace print_telemetry | ||
|
|
||
| export DATABRICKS_AITOOLS_AUTO_INSTALL_CLI_VERSION=1.32.0 | ||
| title "auto-install disable: not installed" | ||
| trace $CLI aitools auto-install disable | ||
| trace $CLI jobs list | ||
| trace print_telemetry | ||
| trace cursor_skills | ||
| trace $CLI aitools auto-install enable | ||
|
|
||
| export DATABRICKS_AITOOLS_AUTO_INSTALL_CLI_VERSION=1.33.0 | ||
| title "commands that never trigger it" | ||
| trace $CLI version | ||
| trace $CLI aitools auto-install enable | ||
| $CLI completion bash &> LOG.completion | ||
| $CLI __complete jobs &> LOG.complete | ||
| $CLI help jobs &> LOG.help | ||
| trace print_telemetry | ||
| trace DATABRICKS_CACHE_ENABLED=false $CLI jobs list | ||
| trace print_telemetry | ||
| trace auto_install_state | ||
| trace cursor_skills | ||
|
|
||
| title "the gate is off: nothing printed or reported, and the version is settled" | ||
| gate false | ||
| trace $CLI jobs list | ||
| trace print_telemetry | ||
| trace auto_install_state | ||
| # Turning the gate on reaches this machine on its next new version. | ||
| gate true | ||
| trace $CLI jobs list | ||
| trace print_telemetry | ||
| trace cursor_skills | ||
|
|
||
| title "a machine in the holdout: not installed" | ||
| use_home holdout-home holdout-machine | ||
| trace $CLI jobs list | ||
| trace print_telemetry | ||
| trace cursor_skills | ||
|
|
||
| title "no agent config directory: nothing to install" | ||
| use_home no-agents-home | ||
| "$rm_bin" -r "${USERPROFILE:-$HOME}/.cursor" | ||
| trace $CLI jobs list | ||
| trace print_telemetry |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Cloud = false |
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nit]
use_homedrops every PATH directory that holds an agent CLI, butprint_telemetryneedsjq(andprint_requests.pyneedspython3) from PATH. On a machine wherejqcomes only from the same directory as an agent CLI, every auto-install case fails. An example is Homebrew's/opt/homebrew/binwith an npm-installedclaude. Resolve these first, as is done formkdir/rm/ls. Line 9 also has a run of spaces betweenCIRCLECIandTRAVIS.