Repository navigation
Add DATABRICKS_NOT_AN_AGENT to turn off agent detection #8126
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
22ec25a
66b69e1
b2cc539
fad4955
b167d41
8503762
1601cec
c3e2771
1077d97
7065dd4
4022fdb
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,54 @@ | ||
|
|
||
| === Claude Code is hinted, and its help and quickstart are the agent ones | ||
|
|
||
| >>> CLAUDECODE=1 [CLI] jobs list | ||
| Before you work with Databricks, run: databricks skills list | ||
|
|
||
| >>> CLAUDECODE=1 [CLI] fs --help | ||
|
|
||
| Coding agents: read the skills for this command group before you use it. | ||
| databricks skills read demo-skill | ||
|
|
||
| >>> CLAUDECODE=1 [CLI] --help | ||
|
|
||
| Coding agents: run `databricks skills list` to find skills for the commands you use. | ||
|
|
||
| >>> CLAUDECODE=1 [CLI] quickstart | ||
|
|
||
| === With the variable set, no hint is printed | ||
|
|
||
| >>> DATABRICKS_NOT_AN_AGENT=1 CLAUDECODE=1 [CLI] jobs list | ||
|
|
||
| === Without the variable, the hint still shows on the same session | ||
|
|
||
| >>> CLAUDECODE=1 [CLI] jobs list | ||
| Before you work with Databricks, run: databricks skills list | ||
|
|
||
| === With the variable set, the help has no skills footer | ||
|
|
||
| >>> DATABRICKS_NOT_AN_AGENT=1 CLAUDECODE=1 [CLI] fs --help | ||
| -t, --target string bundle target to use (if applicable) | ||
|
|
||
| Use "databricks fs [command] --help" for more information about a command. | ||
|
|
||
| >>> DATABRICKS_NOT_AN_AGENT=1 CLAUDECODE=1 [CLI] --help | ||
|
|
||
| Use "databricks [command] --help" for more information about a command. | ||
|
|
||
| === With the variable set, quickstart prints the human guide | ||
|
|
||
| >>> DATABRICKS_NOT_AN_AGENT=1 CLAUDECODE=1 [CLI] quickstart | ||
| # Welcome to Databricks | ||
|
|
||
| >>> DATABRICKS_NOT_AN_AGENT=1 CLAUDECODE=1 [CLI] quickstart | ||
|
|
||
| === With the variable set, auto-install enable says it is still stopped here | ||
|
|
||
| >>> DATABRICKS_NOT_AN_AGENT=1 CLAUDECODE=1 [CLI] aitools auto-install enable | ||
| Automatic installation of Databricks AI tools is enabled. | ||
| DATABRICKS_NOT_AN_AGENT still stops it in this environment; unset it to let it run. | ||
|
|
||
| === A false value leaves agent detection on | ||
|
|
||
| >>> DATABRICKS_NOT_AN_AGENT=0 CODEX_CI=1 CODEX_THREAD_ID=thread-1 [CLI] jobs list | ||
| Before you work with Databricks, run: databricks skills list |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| # DATABRICKS_NOT_AN_AGENT makes agent detection report no agent, so a run that | ||
| # has an agent variable set gets the human output. Claude Code's variable is set | ||
| # throughout; the skills catalog is the one cmd/skills fixture, which maps the fs group. | ||
| sethome ./home | ||
| export DATABRICKS_SKILLS_DIR="$TESTDIR/../../skills/release" | ||
| unset XDG_CONFIG_HOME | ||
| # Claude Code's per-session throttle keys the hint by this id. Without it a | ||
| # machine with no session id (CI) prints the hint on every call, so pin it. | ||
| export CLAUDE_CODE_SESSION_ID=session-1 | ||
|
|
||
| title "Claude Code is hinted, and its help and quickstart are the agent ones" | ||
| trace CLAUDECODE=1 $CLI jobs list | ||
| trace CLAUDECODE=1 $CLI fs --help | tail -n 3 | ||
| trace CLAUDECODE=1 $CLI --help | tail -n 2 | ||
| trace CLAUDECODE=1 $CLI quickstart | contains.py 'databricks skills list' > LOG.quickstart-agent | ||
|
|
||
| # The positive control above recorded session-1's hint throttle. The variable steps | ||
| # get a fresh session, so a build that ignored the variable would print the hint here. | ||
| export CLAUDE_CODE_SESSION_ID=session-2 | ||
|
|
||
| title "With the variable set, no hint is printed" | ||
| trace DATABRICKS_NOT_AN_AGENT=1 CLAUDECODE=1 $CLI jobs list | ||
|
|
||
| # The same session without the variable still gets the hint, so the run above wrote no throttle marker. | ||
| title "Without the variable, the hint still shows on the same session" | ||
| trace CLAUDECODE=1 $CLI jobs list | ||
|
|
||
| title "With the variable set, the help has no skills footer" | ||
| trace DATABRICKS_NOT_AN_AGENT=1 CLAUDECODE=1 $CLI fs --help | tail -n 3 | ||
| trace DATABRICKS_NOT_AN_AGENT=1 CLAUDECODE=1 $CLI --help | tail -n 2 | ||
|
|
||
| title "With the variable set, quickstart prints the human guide" | ||
| trace DATABRICKS_NOT_AN_AGENT=1 CLAUDECODE=1 $CLI quickstart | head -n 1 | ||
| trace DATABRICKS_NOT_AN_AGENT=1 CLAUDECODE=1 $CLI quickstart | contains.py '!databricks skills list' > LOG.quickstart-human | ||
|
|
||
| title "With the variable set, auto-install enable says it is still stopped here" | ||
| trace DATABRICKS_NOT_AN_AGENT=1 CLAUDECODE=1 $CLI aitools auto-install enable | ||
|
|
||
| title "A false value leaves agent detection on" | ||
| trace DATABRICKS_NOT_AN_AGENT=0 CODEX_CI=1 CODEX_THREAD_ID=thread-1 $CLI jobs list | ||
|
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. [nit] This control uses a new agent and thread (
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. Done in 1077d97, and the golden is regenerated. After the variable run on session-2, a step runs CLAUDECODE=1 jobs list with the variable unset, and the golden shows the hint there, so the variable run wrote no throttle marker. |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| Env.DATABRICKS_SKILLS_PREVIEW = "1" | ||
| Env.DATABRICKS_SKILLS_HINTS = "1" | ||
| # The throttle markers live in the file cache, which a host could disable. | ||
| Env.DATABRICKS_CACHE_ENABLED = "true" | ||
| Ignore = ["home"] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,6 +17,7 @@ import ( | |
| "strings" | ||
| "time" | ||
|
|
||
| "github.com/databricks/cli/libs/agent" | ||
| "github.com/databricks/cli/libs/aitools/agents" | ||
| "github.com/databricks/cli/libs/aitools/autoinstall" | ||
| "github.com/databricks/cli/libs/aitools/installer" | ||
|
|
@@ -29,7 +30,6 @@ import ( | |
| "github.com/databricks/cli/libs/telemetry" | ||
| "github.com/databricks/cli/libs/telemetry/protos" | ||
| "github.com/databricks/cli/libs/versioncheck" | ||
| "github.com/databricks/databricks-sdk-go/useragent" | ||
| "github.com/spf13/cobra" | ||
| ) | ||
|
|
||
|
|
@@ -114,6 +114,11 @@ func AutoInstall(cmd *cobra.Command) os.Signal { | |
| if sig := loginAnswerOf(ctx).sig; sig != nil { | ||
| return sig | ||
| } | ||
| // A run that does not notice agents (DATABRICKS_NOT_AN_AGENT) installs nothing and asks nothing, so an eval | ||
| // baseline keeps its machine as it is. | ||
| if agent.NotAnAgent(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] This skip sits outside
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. Took the warning route, not the |
||
| return nil | ||
| } | ||
| defer func() { | ||
| if r := recover(); r != nil { | ||
| log.Debugf(ctx, "auto-install: panic: %v", r) | ||
|
|
@@ -278,7 +283,7 @@ func autoInstallOnce(ctx context.Context, skippedCommand bool) (os.Signal, bool) | |
| version: version, | ||
| id: id, | ||
| arm: holdoutArm(in.Bucket), | ||
| interactive: cmdio.HasTerminal(ctx) && useragent.AgentProvider() == "", | ||
| interactive: cmdio.HasTerminal(ctx) && agent.Provider(ctx) == "", | ||
| now: in.Now, | ||
| } | ||
| if !reason.Due() { | ||
|
|
||
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.
[nice to have] Nothing in this script runs root
--helpwithout the variable. This step would still pass ifrootSkillsHintwere never printed for some other reason. Thefs --helpand quickstart steps do have a run without the variable. Can you addtrace CLAUDECODE=1 $CLI --help | tail -n 2to the first section, so the golden shows the line there and shows it missing here?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.
Done. The first section now runs
CLAUDECODE=1 $CLI --help | tail -n 2, so the golden shows the skills line there, and the variable section shows it missing.