Repository navigation
Turn off agent features with DATABRICKS_AGENT_FEATURES_DISABLED - #8122
simonfaltum wants to merge 10 commits into
Conversation
…S_DISABLED Setting DATABRICKS_AGENT_FEATURES_DISABLED to a true value turns off the agent features in one switch: the skills command group and its hints, the aitools stderr hints, and aitools auto-install. It wins over DATABRICKS_SKILLS_PREVIEW and DATABRICKS_SKILLS_HINTS. Unset, or any value that is not true, behaves as before. The explicit `databricks aitools` commands still work. Co-authored-by: Isaac <no-reply@databricks.com>
Regression test report ✅Commit: Selected 3 changed tests (limit=20, 0 not selected) 3 tests: regression=3 unreleased=0 coverage=0 failing=0
TestAccept/cmd/aitools/auto-install/agent-features-disabled: branch ✅ | main (e6f3460) ❌ | latest (v1.28.0) ❌main (e6f3460): latest (v1.28.0): TestAccept/cmd/aitools/auto-install/enable-disable: branch ✅ | main (e6f3460) ❌ | latest (v1.28.0) ❌main (e6f3460): latest (v1.28.0): TestAccept/cmd/skills/agent-features-disabled: branch ✅ | main (e6f3460) ❌ | latest (v1.28.0) ❌main (e6f3460): latest (v1.28.0): |
✅ Integration test reportCommit: 24a093e
Top 6 slowest tests (at least 2 minutes):
|
…ricks-agent-features-disabled-turns
…S_DISABLED The switch already turned off skills and the aitools hints. The apps init tip and prompt, the version --check tip and the auto-install warning for an enable that the environment overrides did not check it. Now they do: with the switch set, RecommendSkillsInstall, PrintSkillsTip and MaybeVersionCheckTip print nothing, ask nothing, install nothing and store no consent, and printAutoInstallSetting says the switch still turns auto-install off. Unset, behaviour is unchanged. Co-authored-by: Isaac <no-reply@databricks.com>
Acceptance tests unset DATABRICKS_AGENT_FEATURES_DISABLED with the other agent variables, so an exported value no longer changes the goldens. The aitools tests set the switch to false explicitly instead of leaving it to the host environment, and AutoInstallsFor returns false when the switch is on, as autoInstall does, with a test case for it. The skills guard tests use AgentFeaturesDisabledEnv instead of the literal. Co-authored-by: Isaac <no-reply@databricks.com>
There was a problem hiding this comment.
Automated review at bcd98a6. Each finding was verified against the code.
No blocking issues found. 5 non-blocking comment(s) and 1 question(s) below.
This PR adds DATABRICKS_AGENT_FEATURES_DISABLED. Setting it to a true value turns off the skills group, the aitools hints, the apps init and version --check tips, and auto-install, and it overrides the skills preview and hints switches. I found no runtime defect in the gates themselves. What's left: the libs/skills unit tests aren't isolated from the new variable, the auto-install help text doesn't mention it, there's no changelog fragment, and there are a few small comment and test-output fixes.
Questions
- Should the new switch go into the shared auto-install decision instead of separate early returns?
autoInstallInputs/Decidealready carry theDATABRICKS_AITOOLS_AUTO_INSTALLopt-out for bothautoInstallandAutoInstallsFor, but the new check is copied intoAutoInstallandAutoInstallsFor. The same goes forPrintSkillsTip, whichRecommendSkillsInstallalready guards. One option is a not-due reason instateFreeSkipsthat leaves the version unsettled. The other is keeping the per-entry-point checks. (non-blocking)
Comments outside the changed lines
- [nice to have]
libs/skills/guard.go: This adds a user-facing env var: once it's set, the hints, theapps initprompt, theversion --checktip and auto-install all stop, andauto-install enableprints a new warning. The diff adds no file under.nextchanges/. Can you add a fragment under.nextchanges/cli/that namesDATABRICKS_AGENT_FEATURES_DISABLED?
| // DATABRICKS_AGENT_FEATURES_DISABLED is set. | ||
| func Enabled(ctx context.Context) bool { | ||
| return envTrue(ctx, previewEnv) | ||
| return !AgentFeaturesDisabled(ctx) && envTrue(ctx, previewEnv) |
There was a problem hiding this comment.
[nice to have] Enabled now also reads DATABRICKS_AGENT_FEATURES_DISABLED, but TestEnabled and TestHintsEnabled set only the preview and hints variables in the context. env.GetBool falls back to os.LookupEnv, so a developer who exports DATABRICKS_AGENT_FEATURES_DISABLED=1 sees the true/one cases fail. That breaks the promise in the comment at the top of guard_test.go that host values don't leak in. Can you set AgentFeaturesDisabledEnv to "" in those test contexts, and in any other test that relies on skills.Enabled, such as the quickstart environment tests?
There was a problem hiding this comment.
Fixed in ee9742b. TestEnabled and TestHintsEnabled now set DATABRICKS_AGENT_FEATURES_DISABLED to an empty value in their contexts, so an exported value cannot leak in. The other tests that turn the skills feature on got the same line: TestWriteGroupHint, the two quickstart tests (TestSkillFlagRegisteredOnlyWhenSkillsEnabled and TestQuickstartVariantSelectedByEnv), and TestHelpSkillsFooterForNestedGroup in cmd/air. With the variable exported, those six failed before the change; they pass now with it set and unset. The cmd/skills acceptance area also passes with it exported.
| if autoinstall.EnvOptedOut(ctx) { | ||
| cmdio.LogString(ctx, cmdio.Yellow(ctx, autoinstall.EnvVar+" still disables it in this environment; unset it to let it run.")) | ||
| } | ||
| if skills.AgentFeaturesDisabled(ctx) { |
There was a problem hiding this comment.
[nice to have] enable now warns that DATABRICKS_AGENT_FEATURES_DISABLED still turns auto-install off. The Long help of auto-install (lines 27-31) still names DATABRICKS_AITOOLS_AUTO_INSTALL as the only environment switch. Can you add the new variable there so databricks aitools auto-install --help matches the warning? Also, with both variables set, enable prints two warnings that each say "unset it to let it run", but unsetting just one of them isn't enough.
There was a problem hiding this comment.
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.
| // fetched, so it counts as installing for each of them. | ||
| // fetched, so it counts as installing for each of them. With | ||
| // DATABRICKS_AGENT_FEATURES_DISABLED set, nothing is installed, so it reports | ||
| // false, as autoInstall does. |
There was a problem hiding this comment.
[nit] The comment says this reports false "as autoInstall does", but the new check is in the exported AutoInstall, not in autoInstall. Can you change it to name AutoInstall?
There was a problem hiding this comment.
Fixed in ee9742b. The comment now names AutoInstall, where the check is.
| 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" > /dev/null |
There was a problem hiding this comment.
[nit] .agents/rules/testing.md says to route this output to LOG.<name> instead of /dev/null, and the sibling cmd/skills/disabled/script already writes the same kind of check to > LOG.help. As written, the help output is lost when a contains.py check fails. The same applies to lines 10 and 13. Can you send these to LOG.help and similar files?
There was a problem hiding this comment.
Fixed in ee9742b. The three help checks in the script now write to LOG.help, LOG.fs-help and LOG.fs-help-unset, so the output is kept when a contains.py check fails. The output.txt golden does not change, and the cmd/skills and cmd/aitools acceptance areas pass.
- Clear DATABRICKS_AGENT_FEATURES_DISABLED in the test contexts that expect the skills feature on, so an exported value does not fail them. - Name the switch in the auto-install help, and show one warning when both auto-install variables are set, so unsetting one is not taken for a fix. - Send the acceptance script's help checks to LOG files, as the testing rules ask. - Name AutoInstall, not autoInstall, in the AutoInstallsFor comment. Co-authored-by: Isaac <no-reply@databricks.com>
Resolve the guard_test.go conflict by keeping the base's test setup (testutil.CleanupEnvironment and conditional env sets) and the explicit empty DATABRICKS_AGENT_FEATURES_DISABLED in the context. Clear the process environment in the quickstart tests too, so an exported skills switch does not leak into the unset cases. Co-authored-by: Isaac <no-reply@databricks.com>
rugpanov
left a comment
There was a problem hiding this comment.
Review of the DATABRICKS_AGENT_FEATURES_DISABLED switch at 33dc492.
I found no runtime defect. Each gated path returns early only when the variable is true, so the default behavior does not change.
Not approved yet: two items from review-oss-bot are still open, with no reply.
- The PR adds no
.nextchanges/cli/fragment..agents/rules/changelog.mdasks for one for a user-visible change, andaitools auto-install --helpnow names the variable. - The bot asks if the skip can be one reason in
autoinstall.Decide(stateFreeSkips). If you make this change, keep the guard inPrintSkillsTip.cmd/apps/init.gocallsPrintSkillsTipdirectly in flags mode, not throughRecommendSkillsInstall.
[Question] cmd/quickstart/quickstart.go: with the switch set, skills.Enabled is false. Thus databricks quickstart shows the non-skills text of quickstart-agent.md, and its <!--aitools--> blocks still tell the agent to run databricks aitools install. Is this intended? An eval that sets the switch to stop agent nudges still gets this nudge from quickstart.
Risk: LOW. The variable is opt-in and off by default. The change adds only early returns on the hint, tip, auto-install and preview skills paths. Unset, false or invalid values keep the old behavior, and CI passes. A user rolls back by unsetting the variable.
| 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.
[nice to have] The new enable warnings, for this variable alone and for both variables, have only unit tests in cmd/aitools/autoinstall_test.go. .agents/rules/testing.md asks for acceptance tests for user-visible CLI output. A text change in these warnings does not show in a golden file. Add the two cases as trace lines to acceptance/cmd/aitools/auto-install/enable-disable/script, next to the DATABRICKS_AITOOLS_AUTO_INSTALL=false case.
There was a problem hiding this comment.
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.
| t.Run(c.name, func(t *testing.T) { | ||
| testutil.CleanupEnvironment(t) | ||
| ctx := t.Context() | ||
| ctx := env.Set(t.Context(), AgentFeaturesDisabledEnv, "") |
There was a problem hiding this comment.
[nit] This env.Set(ctx, AgentFeaturesDisabledEnv, "") has no effect. testutil.CleanupEnvironment(t) already runs os.Clearenv(), so a host value cannot reach this test. The same is true at line 133, and in cmd/quickstart/quickstart_test.go at lines 98 and 129. Remove these lines, or keep only CleanupEnvironment. Also, the helper comment in libs/aitools/agents/recommend_test.go (line 302) says the empty value guards against the host environment. hostenv.Isolate() in main_test.go already unsets all DATABRICKS_* variables, so correct that comment.
There was a problem hiding this comment.
Agreed, fixed in b130330. testutil.CleanupEnvironment already clears the process environment, so the empty settings did nothing. They are gone from TestEnabled and TestHintsEnabled in libs/skills/guard_test.go and from the two quickstart tests in cmd/quickstart/quickstart_test.go, and the file comment now names only CleanupEnvironment. The tests that do not clear the environment keep their explicit values (TestAgentFeaturesDisabled, TestAgentFeaturesDisabledOverridesSkillsSwitches, and hints_test.go), since libs/skills has no TestMain isolation and a value in the context is what masks a host value there. The recommend_test.go helper comment now names hostenv.Isolate, which TestMain in that package runs.
| 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 |
There was a problem hiding this comment.
[nit] The root --help check 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 --help with env -u DATABRICKS_AGENT_FEATURES_DISABLED that contains databricks skills, as line 13 does for fs --help.
There was a problem hiding this comment.
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.
Drop the empty DATABRICKS_AGENT_FEATURES_DISABLED settings in tests that already clear the process environment with testutil.CleanupEnvironment, and correct the recommend_test helper comment, since hostenv.Isolate unsets the DATABRICKS_* variables. The skills acceptance test now also checks root help with the variable unset, as a control for the footer check. The auto-install enable acceptance test covers both warnings. Co-authored-by: Isaac <no-reply@databricks.com>
… is set With DATABRICKS_AGENT_FEATURES_DISABLED set, databricks quickstart prints the agent text without its aitools block, so it names no aitools install. Unset, the output is unchanged. Co-authored-by: Isaac <no-reply@databricks.com>
|
Quickstart point, fixed in 60366a6. With DATABRICKS_AGENT_FEATURES_DISABLED set to a true value, Checks: a unit test in cmd/quickstart (set and not set), and an acceptance case in acceptance/cmd/skills/agent-features-disabled that shows the output with the switch set and with it unset. Only that case's golden was regenerated. |
Main removed the auto-install consent prompt (#8135). Keep main's side of the auto-install run, and keep only the early return for the agent features switch at the top of AutoInstall, before the state is read. The seeded state in the disabled case now keeps its consent, and the disabled acceptance case seeds consent first, so the disabled run is shown to install nothing even with consent given. Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Changes
Setting
DATABRICKS_AGENT_FEATURES_DISABLEDto a true value (true,1,yes,on) turns off the agent features whateverDATABRICKS_SKILLS_PREVIEWandDATABRICKS_SKILLS_HINTSsay:skillscommand group is not registered, and no skills hint, help footer or quickstart variant appears.databricks apps initskills tip and prompt, and the tip afterdatabricks version --check, print nothing, ask nothing, install nothing and store no consent.databricks aitools auto-install enablesays when the switch still turns auto-install off, as it does for the auto-install variable.The explicit
databricks aitoolscommands are not gated. Unset, or any value that is not true, behaves as before.Why
Three switches turn on the skills feature, and the aitools hints, the apps init and version tips, and auto-install had none. One variable that wins over all of them lets an eval turn the agent features off in one place.
The switch is read in
libs/skills, next to the skills gate, becauselibs/skillscannot importlibs/aitools. Only a true value turns the features off: an invalid value such asmaybeleaves them as they were, like the other switches, rather than failing closed.A disabled run does not settle the auto-install version, on purpose. The switch is a temporary off, so the first run after it is unset still installs for that version, as it would have without the switch.
Tests
libs/skills: empty, true, one, yes, false, zero and invalid values, and the precedence over the preview and hints switches.libs/aitools/agents: with the variable set,RecommendSkillsInstalldoes not prompt, install or log, andPrintSkillsTipandMaybeVersionCheckTipprint nothing. Unset, the tips print as before.cmd/aitools: with the variable set,AutoInstallsForreports no install, and the auto-install gate is not looked up;printAutoInstallSettingwarns only when the variable is set.cmd/skills/agent-features-disabledandcmd/aitools/auto-install/agent-features-disabled, plus twoenable-disablecases for the enable warnings. Thecmd/versionandcmd/appsareas pass with no golden change, andcmd/aitoolschanges only theenable-disablegolden.cmd/skillsandcmd/aitoolsalso pass with the variable exported../task --force fmt-q lint-qis clean.This pull request and its description were written by Isaac.