Repository navigation
Turn off agent features with DATABRICKS_AGENT_FEATURES_DISABLED #8122
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
base: main
Are you sure you want to change the base?
Changes from all commits
01ddd66
7fc5350
b81b408
bcd98a6
ee9742b
33dc492
b130330
60366a6
26b23a6
24a093e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Cloud = false |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
|
|
||
| >>> [CLI] aitools auto-install enable | ||
| Automatic installation of Databricks AI tools is enabled. | ||
|
|
||
| === disabled: no install notice, no install or skills hint, nothing installed | ||
|
|
||
| >>> DATABRICKS_AGENT_FEATURES_DISABLED=1 CLAUDECODE=1 [CLI] jobs list | ||
|
|
||
| >>> print_telemetry | ||
|
|
||
| >>> cursor_skills | ||
| (no skills) | ||
|
|
||
| >>> auto_install_state | ||
| { | ||
| "consented": true, | ||
| "id": "treatment-machine" | ||
| } | ||
|
|
||
| === unset: the first run of this version installs, and no hint is printed | ||
|
|
||
| >>> env -u DATABRICKS_AGENT_FEATURES_DISABLED CLAUDECODE=1 [CLI] jobs list | ||
| 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 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| # DATABRICKS_AGENT_FEATURES_DISABLED turns off the aitools hint and auto-install, | ||
| # with the skills preview and hints on. The user agreed to auto-install, so the | ||
| # unset run after it installs for the same agent, and the quiet run is not | ||
| # quiet for lack of a gate or consent. | ||
| unset AGENT 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 | ||
| export DATABRICKS_SKILLS_PREVIEW=1 | ||
| export DATABRICKS_SKILLS_HINTS=1 | ||
|
|
||
| title "disabled: no install notice, no install or skills hint, nothing installed" | ||
| trace DATABRICKS_AGENT_FEATURES_DISABLED=1 CLAUDECODE=1 $CLI jobs list | ||
| trace print_telemetry | ||
| trace cursor_skills | ||
| trace auto_install_state | ||
|
|
||
| title "unset: the first run of this version installs, and no hint is printed" | ||
| trace env -u DATABRICKS_AGENT_FEATURES_DISABLED CLAUDECODE=1 $CLI jobs list | ||
| trace print_telemetry | ||
| trace cursor_skills |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Cloud = false |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
|
|
||
| >>> DATABRICKS_AGENT_FEATURES_DISABLED=1 CLAUDECODE=1 [CLI] skills list | ||
| Error: unknown command "skills" for "databricks" | ||
|
|
||
| >>> DATABRICKS_AGENT_FEATURES_DISABLED=1 CLAUDECODE=1 [CLI] --help | ||
|
|
||
| >>> DATABRICKS_AGENT_FEATURES_DISABLED=1 CLAUDECODE=1 [CLI] fs --help | ||
|
|
||
| >>> env -u DATABRICKS_AGENT_FEATURES_DISABLED [CLI] --help | ||
|
|
||
| >>> env -u DATABRICKS_AGENT_FEATURES_DISABLED [CLI] fs --help | ||
|
|
||
| >>> DATABRICKS_AGENT_FEATURES_DISABLED=1 CLAUDECODE=1 [CLI] quickstart | ||
|
|
||
| >>> env -u DATABRICKS_AGENT_FEATURES_DISABLED -u DATABRICKS_SKILLS_PREVIEW [CLI] quickstart |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| export DATABRICKS_SKILLS_DIR="$TESTDIR/../../../cmd/skills/release" | ||
|
|
||
| # DATABRICKS_AGENT_FEATURES_DISABLED is set, with the preview and the hints on | ||
| # and a coding agent calling: the skills group is not registered, so it is an | ||
| # unknown command. | ||
| musterr trace DATABRICKS_AGENT_FEATURES_DISABLED=1 CLAUDECODE=1 $CLI skills list | ||
|
|
||
| # Help shows no skills footer, on the root or on a group the fixture skill covers. | ||
| trace DATABRICKS_AGENT_FEATURES_DISABLED=1 CLAUDECODE=1 $CLI --help | contains.py "!databricks skills" > LOG.help | ||
| trace DATABRICKS_AGENT_FEATURES_DISABLED=1 CLAUDECODE=1 $CLI fs --help | contains.py "!databricks skills" > LOG.fs-help | ||
|
|
||
| # With the variable unset, the root and the same group get their footer, so the checks above can fail. | ||
| trace env -u DATABRICKS_AGENT_FEATURES_DISABLED $CLI --help | contains.py "databricks skills" > LOG.help-unset | ||
| trace env -u DATABRICKS_AGENT_FEATURES_DISABLED $CLI fs --help | contains.py "databricks skills read" > LOG.fs-help-unset | ||
|
|
||
| # The agent text drops its aitools block too, so it names no aitools install and keeps the shared text. | ||
| trace DATABRICKS_AGENT_FEATURES_DISABLED=1 CLAUDECODE=1 $CLI quickstart | contains.py "# Databricks Quickstart" "!aitools install" "!install the matching skill" "!databricks skills" > LOG.quickstart | ||
| # With the variable unset and the skills preview off, the agent text names the aitools install, so the check above can fail. | ||
| trace env -u DATABRICKS_AGENT_FEATURES_DISABLED -u DATABRICKS_SKILLS_PREVIEW $CLI quickstart | contains.py "databricks aitools install" > LOG.quickstart-unset | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Env.DATABRICKS_SKILLS_HINTS = "1" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,10 +3,12 @@ package aitools | |
| import ( | ||
| "context" | ||
| "fmt" | ||
| "strings" | ||
|
|
||
| "github.com/databricks/cli/cmd/root" | ||
| "github.com/databricks/cli/libs/aitools/autoinstall" | ||
| "github.com/databricks/cli/libs/cmdio" | ||
| "github.com/databricks/cli/libs/skills" | ||
| "github.com/spf13/cobra" | ||
| ) | ||
|
|
||
|
|
@@ -30,7 +32,9 @@ It stays off after 'databricks aitools auto-install disable', a global-scope | |
| 'databricks aitools uninstall', or a "no" to the skills prompt of 'databricks | ||
| apps init', until 'databricks aitools auto-install enable'. Setting | ||
| ` + autoinstall.EnvVar + ` to anything but a true value (true, 1, yes, on) turns | ||
| it off in that environment.`, | ||
| it off in that environment. Setting ` + skills.AgentFeaturesDisabledEnv + ` | ||
| to a true value (true, 1, yes, on) also turns it off, along with the skills and | ||
| the aitools hints.`, | ||
| RunE: root.ReportUnknownSubcommand, | ||
| } | ||
| cmd.AddCommand(newAutoInstallToggleCmd(true)) | ||
|
|
@@ -71,7 +75,20 @@ func printAutoInstallSetting(ctx context.Context, enabled bool) { | |
| return | ||
| } | ||
| cmdio.LogString(ctx, "Automatic installation of Databricks AI tools is enabled.") | ||
| // Both variables can be set. They share one warning, so unsetting only one | ||
| // is not mistaken for a fix. | ||
| var overrides []string | ||
| if autoinstall.EnvOptedOut(ctx) { | ||
| cmdio.LogString(ctx, cmdio.Yellow(ctx, autoinstall.EnvVar+" still disables it in this environment; unset it to let it run.")) | ||
| overrides = append(overrides, autoinstall.EnvVar) | ||
| } | ||
| if skills.AgentFeaturesDisabled(ctx) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [nice to have]
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in ee9742b. The auto-install help now names DATABRICKS_AGENT_FEATURES_DISABLED and says a true value turns auto-install off, along with the skills and the aitools hints. When both auto-install variables are set, enable now prints one warning that names both and says to unset both. With only one set, the message is the same as before. TestPrintAutoInstallSettingBothOverrides covers the two-variable case.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [nice to have] The new
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in b130330. The enable-disable acceptance script has two new cases next to the DATABRICKS_AITOOLS_AUTO_INSTALL=false one: DATABRICKS_AGENT_FEATURES_DISABLED=1 alone, which names that variable, and both variables together, which get the shared warning that says to unset both. Their lines are in the regenerated output.txt, and cmd/aitools acceptance passes. |
||
| overrides = append(overrides, skills.AgentFeaturesDisabledEnv) | ||
| } | ||
| switch len(overrides) { | ||
| case 0: | ||
| case 1: | ||
| cmdio.LogString(ctx, cmdio.Yellow(ctx, overrides[0]+" still disables it in this environment; unset it to let it run.")) | ||
| default: | ||
| cmdio.LogString(ctx, cmdio.Yellow(ctx, strings.Join(overrides, " and ")+" still disable it in this environment; unset both to let it run.")) | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| package aitools | ||
|
|
||
| import ( | ||
| "testing" | ||
|
|
||
| "github.com/databricks/cli/libs/aitools/autoinstall" | ||
| "github.com/databricks/cli/libs/cmdio" | ||
| "github.com/databricks/cli/libs/env" | ||
| "github.com/databricks/cli/libs/skills" | ||
| "github.com/stretchr/testify/assert" | ||
| ) | ||
|
|
||
| // enable says when DATABRICKS_AGENT_FEATURES_DISABLED still turns auto-install | ||
| // off, as it does for DATABRICKS_AITOOLS_AUTO_INSTALL; unset, it says nothing | ||
| // about it. | ||
| func TestPrintAutoInstallSettingAgentFeaturesDisabled(t *testing.T) { | ||
| const warning = "DATABRICKS_AGENT_FEATURES_DISABLED still disables it in this environment; unset it to let it run." | ||
|
|
||
| ctx, stderr := cmdio.NewTestContextWithStderr(t.Context()) | ||
| ctx = env.Set(ctx, skills.AgentFeaturesDisabledEnv, "") | ||
| printAutoInstallSetting(ctx, true) | ||
| assert.NotContains(t, stderr.String(), skills.AgentFeaturesDisabledEnv) | ||
|
|
||
| ctx, stderr = cmdio.NewTestContextWithStderr(t.Context()) | ||
| ctx = env.Set(ctx, skills.AgentFeaturesDisabledEnv, "1") | ||
| printAutoInstallSetting(ctx, true) | ||
| assert.Contains(t, stderr.String(), "Automatic installation of Databricks AI tools is enabled.") | ||
| assert.Contains(t, stderr.String(), warning) | ||
|
|
||
| // A disable says nothing about the environment. | ||
| ctx, stderr = cmdio.NewTestContextWithStderr(t.Context()) | ||
| ctx = env.Set(ctx, skills.AgentFeaturesDisabledEnv, "1") | ||
| printAutoInstallSetting(ctx, false) | ||
| assert.NotContains(t, stderr.String(), skills.AgentFeaturesDisabledEnv) | ||
| } | ||
|
|
||
| // With both variables set, one warning names both, so unsetting only one of | ||
| // them is not taken for a fix. | ||
| func TestPrintAutoInstallSettingBothOverrides(t *testing.T) { | ||
| ctx, stderr := cmdio.NewTestContextWithStderr(t.Context()) | ||
| ctx = env.Set(ctx, autoinstall.EnvVar, "false") | ||
| ctx = env.Set(ctx, skills.AgentFeaturesDisabledEnv, "1") | ||
| printAutoInstallSetting(ctx, true) | ||
| assert.Contains(t, stderr.String(), autoinstall.EnvVar+" and "+skills.AgentFeaturesDisabledEnv+ | ||
| " still disable it in this environment; unset both to let it run.") | ||
| assert.NotContains(t, stderr.String(), "unset it to let it run") | ||
| } |
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] The root
--helpcheck has no control run without the variable. If a later change removes the skills footer from root help, this check still passes and tests nothing. Add a run of root--helpwithenv -u DATABRICKS_AGENT_FEATURES_DISABLEDthat containsdatabricks skills, as line 13 does forfs --help.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.
Added in b130330. Root --help with DATABRICKS_AGENT_FEATURES_DISABLED unset now runs in the script and must contain "databricks skills", the control for the root footer check. It sits beside the fs --help control and writes to LOG.help-unset. The golden shows the run, and the acceptance test passes, so the root footer is checked with the variable set and unset.