Repository navigation
aitools: skip the install hint on auth, lookup, and completion commands - #7452
Conversation
The install hint fires on every command Claude Code runs without the Databricks tooling, including one-shot lookups such as `current-user me`, auth checks, help, and shell completion, where it never converts. Widen the aitools-only exemption into a shared list behind IsHintExemptCommand. Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
|
Commit: Regression test reportSelected 4 changed tests (limit=20, 0 not selected) 4 tests: regression=2 unreleased=2 coverage=0 failing=0
TestAccept/cmd/aitools/agent-hints: branch ✅ | main (479098f) ✅ | latest (v1.26.0) ❌latest (v1.26.0): TestAccept/cmd/aitools/claude-config-dir: branch ✅ | main (479098f) ❌ | latest (v1.26.0) ❌main (479098f): latest (v1.26.0): TestAccept/cmd/aitools/telemetry/hint: branch ✅ | main (479098f) ✅ | latest (v1.26.0) ❌latest (v1.26.0): TestAccept/cmd/version: branch ✅ | main (479098f) ❌ | latest (v1.26.0) ❌main (479098f): latest (v1.26.0): |
Only the agents tests build command trees, so a shared helper in internal/testutil is not needed. Co-authored-by: Isaac <no-reply@databricks.com>
✅ Integration test reportCommit: 6d9ae47
Top 7 slowest tests (at least 2 minutes):
|
Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
left a comment
There was a problem hiding this comment.
🤖 Automated review from simonfaltum's review agent (pr-review skill) at 3d91441. Each finding was verified against the code; simonfaltum may follow up.
Not approving yet: 3 open design questions.
This PR replaces the aitools-only hint check with a root-relative exempt list, so Claude Code no longer sees the install hint on auth, configure, current-user me, help, and completion commands. I traced the root pre-run hook and cobra's help and completion handling and found no blocking defects: exempt commands don't use up the per-session hint, both aitools subtrees stay exempt, and CI is green. What remains are three design questions (the speculative export, a second exempt list next to versioncheck, and keeping version hintable), two test-robustness suggestions, and a few small test and comment cleanups.
Questions
IsHintExemptCommandis exported, but nothing outsidelibs/aitools/agentscalls it at this head. The follow-up inlibs/aitools/installercould export it when it needs it, since installer already imports agents and no cycle would result. Would you rather keep the export in this PR or move it to the follow-up?libs/versioncheck/notice.goisExemptCommandalready listscompletion,help, and__complete, matching on any ancestor name. This PR adds a second list that matches on root-relative paths. Are the two lists meant to stay separate, given that they legitimately differ onversion, or should both use one shared predicate for plumbing commands?versionis the same kind of one-shot lookup ascurrent-user me, and versioncheck exempts it. Yetdatabricks versionstill hints, whiledatabricks --versionnever does because cobra returns before the hook. Is keepingversionhintable a product decision, or mainly a way to keep the acceptance tests' hint coverage? If the latter, could those tests use another command so thatversioncan be exempt too?
| // checks, "who am I", help, shell completion): the agent has no task to apply | ||
| // the skills to. Evaluations showed that conversion on these commands is low, | ||
| // so a hint on them wastes the prompt. | ||
| var hintExemptCommands = []string{ |
There was a problem hiding this comment.
[nice to have] The entries in hintExemptCommands are hard-coded path strings, and TestIsHintExemptCommand builds fake trees with commandAt. Nothing checks that each path exists in the real CLI. If codegen renames current-user/me, or an aitools command moves, the exemption silently stops matching and the unit tests still pass; only the single current-user me acceptance step would catch it. Consider adding a test in an external package (or under cmd/) that builds cmd.New(ctx), resolves each entry with Find(strings.Fields(p)), and asserts an exact match.
There was a problem hiding this comment.
I'd rather not add this one. current-user me is the only generated entry, and the claude-config-dir step already runs it against the real tree; the rest are hand-written commands or cobra constants. The test would also need special cases for cobra's lazily registered help and __complete, and with the predicate now package-private it would have to live in the agents test binary and pull in cmd. Happy to revisit if you feel strongly.
|
|
||
| // commandPath returns cmd's path below the root command, e.g. "current-user me", | ||
| // so hintExemptCommands holds whatever the root is named. | ||
| func commandPath(cmd *cobra.Command) string { |
There was a problem hiding this comment.
[nit] commandPath re-implements the parent walk that cobra already provides; the walk also exists as commandString in cmd/root. strings.TrimPrefix(cmd.CommandPath(), cmd.Root().CommandPath()+" ") returns the same root-relative path, and cmd/air/air.go:51-52 already uses this pattern. Using it removes the helper and the slices import.
There was a problem hiding this comment.
Done in 3238771. I matched against Root().CommandPath() + " " + exempt rather than TrimPrefix, so the root itself never matches an entry.
| return cmd | ||
| } | ||
|
|
||
| func TestIsHintExemptCommand(t *testing.T) { |
There was a problem hiding this comment.
[nit] If strings.HasPrefix(path, exempt+" ") is changed to strings.HasPrefix(path, exempt), every case in TestIsHintExemptCommand still passes. A future top-level command like authz or helpers would then be exempted by mistake. Add a negative case such as {"authz", false} or {"current-user meh", false}.
| parent.AddCommand(child) | ||
|
|
||
| MaybeHint(ctx, child) | ||
| MaybeHint(ctx, commandAt("aitools install")) |
There was a problem hiding this comment.
[nit] regularCmd() (line 64) returns a parentless current-user command, so under the new path logic its path is "". The tests that expect a hint pass because the path is empty, not because a real non-exempt command is used. Now that commandAt exists, have regularCmd() return something like commandAt("clusters list") so those tests exercise a realistic non-exempt path.
There was a problem hiding this comment.
Done in 3238771, it is commandAt("clusters list") now.
Build the root-relative path from cobra's CommandPath instead of a hand-rolled parent walk. Drop the __completeNoDesc entry: it is an alias of __complete, so Name() never returns it. Give the hint tests a realistic non-exempt command, replace the fake "help jobs" subtree with the plain help command, and add a prefix negative so "authz" is never exempt. Project the current-user me acceptance output to the one field the step needs. Co-authored-by: Isaac <no-reply@databricks.com>
The version command is the same kind of one-shot lookup as current-user me, and versioncheck already exempts it. The acceptance test now triggers the hint with clusters list, which runs the pre-run hook against the fake server. Nothing outside the package calls the predicate yet, so it is unexported until the update hint needs it. Co-authored-by: Isaac <no-reply@databricks.com>
commented
Nov 11, 2026
|
Thanks for the thorough pass. On the three questions:
|
Co-authored-by: Isaac <no-reply@databricks.com>
left a comment
There was a problem hiding this comment.
🤖 Automated review from simonfaltum's review agent (pr-review skill) at 83b8607. Each finding was verified against the code; simonfaltum may follow up.
Not approving yet: 1 open design question.
This PR replaces the aitools-only check with a root-relative exempt list, so Claude Code stops seeing the install hint on auth, configure, current-user me, version, help, and shell-completion commands. I traced the matching against cobra (CommandPath, the __completeNoDesc alias, lazy help/complete registration, and --help returning before the pre-run hook) and found no defects. Both aitools mounts stay exempt, exempt commands don't use up the per-session hint, and CI is green. One open question is whether the eval evidence covers auth and configure; beyond that, only small test and description nits remain.
Questions
- The comment above
hintExemptCommandssays evaluations showed low conversion on all of these commands, but the description cites only the "who am I" result (0 of 20). Did the eval also coverauthandconfigure? Those often run right before real work, and since exempt commands don't record the session marker, the hint still lands on the next non-exempt command. If they weren't measured, would you narrow the comment to what was measured, keep the entries as a judgment call, or drop them until there's data?
Comments outside the changed lines
- [nit]
.github/PULL_REQUEST_TEMPLATE.md: Two description fixes. First,.agents/skills/pr-checklist/SKILL.mdasks bodies to keep the template's## Changes,## Why,## Testsheadings; this one has no## Why, and the eval reason sits inside Changes. Second, "the list holds for both thedatabricksand thepipelinesbinary" doesn't match this tree: there is a singledatabricksroot (cmd/root/root.go:29), and nothing switches on the executable name. Please move the reason under## Whyand drop or reword the pipelines sentence.
Agreeing with existing threads
- [nice to have] Exempt list is not checked against the real command tree: #7452 (comment)
| // tooling hint prints. Paths are relative to the root command. The aitools | ||
| // trees are exempt because telling the agent to run aitools while it already | ||
| // runs aitools makes no sense. The rest are plumbing or one-shot lookups (auth | ||
| // checks, "who am I", version, help, shell completion): the agent has no task to apply |
There was a problem hiding this comment.
[nit] This line of the hintExemptCommands doc comment is 87 characters, while the lines around it wrap near 78, so the paragraph reads raggedly ("...(auth" / "checks, ... to apply" / "the skills to."). It looks like it wasn't reflowed after version was added. Please re-wrap the paragraph to the same width as the rest of the comment.
| return cmd | ||
| } | ||
|
|
||
| func TestIsHintExemptCommand(t *testing.T) { |
There was a problem hiding this comment.
[nit] No case in the table puts an exempt name under a non-exempt parent. If the matching went back to the old walk that compares Name() at any depth, every current case, including authz and current-user, would still pass. Add a case such as {"bundle help", false} or {"clusters version", false} so that regression fails.
| trace CLAUDE_CONFIG_DIR=missing $CLI clusters list | ||
|
|
||
| title "Exempt commands never hint, even without the tooling" | ||
| trace CLAUDE_CONFIG_DIR=missing $CLI current-user me | jq .userName |
There was a problem hiding this comment.
[nit] This step pulls one field with inline jq .userName, but .agents/rules/testing.md prefers gron.py | grep <field> for single-value lookups, because gron prints the JSON path into the golden output. Consider trace CLAUDE_CONFIG_DIR=missing $CLI current-user me | gron.py | grep userName.
The exempt-list comment now says the nudge eval measured only "who am I", and the paragraph is re-wrapped. A "bundle help" case fails if matching regresses to comparing Name() at any depth. The current-user me step uses gron.py instead of an inline jq path. Co-authored-by: Isaac <no-reply@databricks.com>
Main added hints for non-Claude agents, Claude Code's native hint line, hint telemetry, and a credential-helper check for auth token and auth docker token. isHintExemptCommand replaces main's isAIToolsCommand; the credential-helper check stays separate because it guards output other tools embed, not conversion. version is exempt, so the acceptance tests that used it to trigger the hint use jobs list, clusters list, or bundle schema instead. On version --check, hinted agents now get no nudge: the version-check tip already skips them. Tests that rooted the tree at aitools use commandAt. Co-authored-by: Isaac <no-reply@databricks.com>
commented
Nov 17, 2026
|
Thanks. On the second pass:
I also merged main and resolved the conflicts with #7585 and #7586; the description lists what changed (the credential-helper check stays, and the tests that used |
left a comment
There was a problem hiding this comment.
🤖 Automated review from simonfaltum's review agent (pr-review skill) at 6d9ae47. Each finding was verified against the code; simonfaltum may follow up.
No blocking issues found, approving. 5 non-blocking comment(s) below.
This PR replaces the aitools-only check with a root-relative exempt list, so coding agents no longer see the install hint on auth, configure, current-user me, version, help, and shell-completion commands. I traced the matching through cobra: the __completeNoDesc alias resolves to __complete, both aitools mounts stay exempt, and exempt commands don't use up the per-session hint. I found nothing blocking, the earlier questions are all answered, and CI is green. The five nits cover a guard comment on the now-overlapping credential-helper check, two misleading auth test names, a /dev/null redirect that should go to a LOG file, the telemetry README leaving out configure, and an acceptance case that no longer exercises the self-exec guard.
Accepted answers
- Export the exempt predicate now or in the follow-up?: #7452 (comment)
- Share one predicate with versioncheck.isExemptCommand?: #7452 (comment)
- Should
versionstay hintable?: #7452 (comment) - Did the eval cover
authandconfigure?: #7452 (comment) - Test the exempt list against the real command tree?: #7452 (comment)
Comments outside the changed lines
- [nit]
libs/aitools/agents/hint_test.go:417: "other auth command still hints" (and "other auth docker command still hints" at line 433) build trees rooted atauth, so they check only that the credential-helper predicate is narrow. Under the real root,databricks auth profilesanddatabricks auth docker configureprint nothing now. Read on their own, the names suggest the opposite. Rename them to say what they test, e.g. "credential-helper check ignores other auth commands". - [nit]
acceptance/air/image-push/script:65: This case says theauth docker configurechild adds no install hint because of the self-exec guard. That child is now exempt throughauth, so the case would pass even if theDATABRICKS_CLI_SELF_EXECcheck inMaybeHintbroke. Non-exempt self-exec children such asapps deployfromapps initkeep only the unit test athint_test.go:442. Consider updating the comment to say what keeps the child quiet now, or covering the guard with a non-exempt child.
| if isHintExemptCommand(cmd) { | ||
| return | ||
| } | ||
| if isCredentialHelperCommand(cmd) { |
There was a problem hiding this comment.
[nit] Under the real databricks root, the auth entry in hintExemptCommands already returns before isCredentialHelperCommand runs, so this branch looks dead. The reason it stays (auth token and auth docker token must stay silent even if auth leaves the list) is only in the PR description and the test comment at hint_test.go:403. A later cleanup could drop the check as redundant; if auth is then removed from the list, the hint ends up inside SDK and Terraform error messages. .agents/rules/comments.md asks for a comment on branches kept as guards. Please add one line here, e.g. "Overlaps the auth exemption on purpose: the credential helpers must stay silent even if auth leaves hintExemptCommands."
|
|
||
| title "hint printed on a command that resolves no auth: nothing is uploaded" | ||
| trace $CLI version | ||
| trace $CLI bundle schema > /dev/null |
There was a problem hiding this comment.
[nit] .agents/rules/testing.md asks for noisy output to go to LOG.<name>, not /dev/null, so it stays visible under go test -v. Use trace $CLI bundle schema > LOG.schema; the golden still shows only the hint on stderr.
| `databricks version`), no install hint event is logged for that hour even though the agent saw the | ||
| hint. | ||
| hint is never printed on hint-exempt commands (`hintExemptCommands` in | ||
| `libs/aitools/agents/hint.go`: aitools, `auth`, one-shot lookups, help, completion) or in CLI |
There was a problem hiding this comment.
[nit] The parenthetical lists "aitools, auth, one-shot lookups, help, completion". configure is exempt but is not a lookup, so someone checking why databricks configure logs no hint event won't find it here. Add configure to the list.
commented
Nov 17, 2026
❌ Integration test reportCommit: 4c8b7a1
526 interesting tests: 392 MISS, 122 FAIL, 9 RECOVERED, 3 KNOWN
Top 50 slowest tests (at least 2 minutes):
|
Changes
When a coding agent such as Claude Code or Codex runs the CLI without the Databricks tooling installed, the CLI prints a stderr hint asking the agent to run
databricks aitools install. This PR replaces theaitools-only check that skips the hint withisHintExemptCommand, which matches the command's path below the root against one list:aitools,experimental aitools,auth,configure,current-user me,version,completion,help, and cobra's hidden shell-completion command.MaybeHintkeeps its separate check for theauth tokenandauth docker tokencredential helpers, althoughauthcovers them. That check protects output that other tools embed mid-line, so it must hold even ifauthleaves this list.On
databricks version --check, hinted agents (Claude Code and the registry agents, such as Codex) now get no install nudge: the root hint skipsversion, and the version-check tip already skips agents that the root hint covers. Other detected agents still get the tip.Out of scope: the update hint for outdated installs (follow-up PR). That PR exports the predicate and calls it from
libs/aitools/installer.Why
The hint fires on every command outside the
aitoolstree, including one-shot lookups such asdatabricks current-user meanddatabricks version, auth checks, help, and shell completion. The nudge eval measured "who am I" at 0 of 20 conversions: the agent has no task to apply the skills to, so the line is noise. The other entries are the same kind of call; the eval did not measure them separately. Exempt commands do not use up the per-session hint, so the hint still prints on the next non-exempt command.Tests
TestIsHintExemptCommandtable covering exempt and non-exempt paths, including a prefix negative (authz) and an exempt name under a non-exempt parent (bundle help), built with a small localcommandAthelper.acceptance/cmd/aitools/claude-config-dirtriggers the hint withclusters listinstead ofversion, and gains a step showingcurrent-user meprints with no hint.acceptance/cmd/aitools/agent-hintstriggers the hint withjobs list, andacceptance/cmd/aitools/telemetry/hintusesbundle schemaas its command without auth.acceptance/cmd/versionshows no hint for Claude Code and Codex.go test ./libs/aitools/... ./cmd/root/..., the acceptance suite outsidebundle/, and golangci-lint pass.This pull request and its description were written by Isaac.