Repository navigation
Conversation
## Changes
When a coding agent runs the CLI, the CLI can print the "Databricks skills are not installed" hint before the command. On the same command, the auto-install that runs afterwards can install those skills for that agent. The agent then sees two lines that disagree: one tells it to run `databricks aitools install`, and the next says the tools were just installed.
With this change, the hint is skipped when the auto-install after the command is due to give that agent its first tools.
```diff
MaybeHint(ctx, cmd)
if hint.installed(ctx)
return
+ if autoinstall.InstallsFor(cmd, hint.agentName)
+ return // no event, no throttle marker
claim throttle, print hint, log hint event
```
- `libs/aitools/autoinstall/hook.go`: new hook `InstallsFor(cmd, agentName)`, next to `Run`. `main.go` sets it to `aitools.AutoInstallsFor`, the same way `Run` is set, so `libs/aitools/agents` does not import `cmd/aitools`.
- `cmd/aitools/autoinstall_hint.go`: `AutoInstallsFor` makes the same decision as `autoInstall`. It runs the state-free skips, loads the state and checks that `Decide` reaches the gate lookup. Then it plans the install and reports whether this agent is one of the plan's new agents. It reads the state but never writes it, and it does not fetch the compatibility manifest.
- `cmd/aitools/autoinstall_run.go`: moves the building of `autoinstall.Inputs` into `autoInstallInputs` so both callers use it. Behavior is unchanged.
- `libs/aitools/agents`: each `agentHint` now carries the agent's registry name so the hint can ask about it. This covers Claude Code and the registry agents.
## Why
The hint runs before the command, but the gate is only fetched afterwards, so the check stops at the point where `autoInstall` would fetch it. A run that gets that far counts as installing, and its hint is withheld. If that run then installs nothing (for example, because the gate is off), the hint was not printed and no throttle marker was written. The next command prints the hint as usual. This costs one command of delay and avoids a network call before every command.
An agent that the install skips, such as Claude Code with no config dir, still gets the hint on the same command.
## Tests
- `TestAutoInstallsFor` (`cmd/aitools`) covers:
- first run, retry and fresh state, which install;
- an agent without a config dir;
- a settled version, exhausted retries, opt-out in state and opt-out in env;
- CI, a development build and a command that skips auto-install;
- a corrupt install state, where planning fails.
Each case also checks that the gate is never fetched, the state file is unchanged and nothing is installed.
- `libs/aitools/agents`:
- `TestMaybeHint_WithheldWhileAutoInstallInstallsForTheAgent`: both hint lines are withheld and no event is logged. When the next command does not install, it prints the hint.
- `TestMaybeHint_RegistryAgentAskedByItsName`: a registry agent is asked about by its own name.
- `TestMaybeHint_InstalledToolingSkipsTheAutoInstallCheck`: when the tooling is already installed, the hook is not called.
- New acceptance test `acceptance/cmd/aitools/auto-install/agent-hint` covers four cases:
- the first run prints only the install notice;
- the second run prints nothing;
- with the gate off, the first run prints nothing and the next prints the hint;
- an agent the install skips still gets the hint next to the install notice.
Changelog fragment: `.nextchanges/cli/aitools-auto-install-hint-contradiction.md`.
Co-authored-by: Isaac <no-reply@databricks.com>
There was a problem hiding this comment.
Automated review at 24b61a7. Each finding was verified against the code.
Not ready yet: 1 blocking issue(s), tagged [blocking].
This PR withholds the "Databricks skills are not installed" hint when the auto-install after the command is expected to install tools for the calling agent. The check guesses in the pre-run hook what the post-run install will do, and several real outcomes are guessed wrong. A command that fails never reaches the install, so the hint stays withheld on every failing command. Failed install attempts and holdout machines also lose the hint without getting an install in return. The first case should be fixed before merge, and the changelog fragment needs its PR link.
| // The auto-install after this command prints its own notice; neither line | ||
| // may tell the agent to install what it installs. No marker is written, so | ||
| // a run that ends up not installing leaves the hint to the next command. | ||
| if autoinstall.InstallsFor != nil && autoinstall.InstallsFor(cmd, hint.agentName) { |
There was a problem hiding this comment.
[blocking] MaybeHint runs in PersistentPreRunE, but autoinstall.Run runs only from PersistentPostRunE, which Cobra calls only when the command succeeds (cmd/root/root.go:113). When the command fails, nothing installs and auto-install.json is not written, so the next command gets the same answer and the hint is withheld again. Example: on a new CLI version, Claude Code with ~/.claude present runs databricks jobs list with no auth configured. Every call errors, and the agent never sees the hint until some command succeeds. Before this change it got the hint on the first command. This contradicts "the next command prints the hint" in the InstallsFor doc. Can the withheld hint be printed when the command fails (for example from the error path), or can the check be limited to runs that will reach the post-run hook?
| } | ||
| var err error | ||
| in.State, err = autoinstall.Load(ctx) | ||
| if err != nil || autoinstall.Decide(in) != autoinstall.ReasonGateOff { |
There was a problem hiding this comment.
[nice to have] Decide returns ReasonGateOff for any 0 < Attempts < MaxAttempts, so a retry after a failed attempt counts as installing (the "a retry installs too" case). A failed attempt prints "Could not install" only when asked, and coding agents are never asked. So with the gate on and the release download blocked or timing out, an agent can run up to 10 successful commands with neither the hint nor any install notice. Should this withhold the hint only on the version's first attempt (in.State.LastVersion != in.Version), so a failed attempt lets the hint through on the next command?
| } | ||
| var err error | ||
| in.State, err = autoinstall.Load(ctx) | ||
| if err != nil || autoinstall.Decide(in) != autoinstall.ReasonGateOff { |
There was a problem hiding this comment.
[nice to have] in.Bucket is never set here, and Decide checks the holdout only after the gate. So a holdout machine counts as installing, has its hint withheld, and is then settled as SKIPPED_HOLDOUT with nothing installed. On every new version the 10% control arm loses a hint the status quo would have shown, which skews the comparison the holdout exists for. When in.State.ID is set, the bucket is already known locally. Can this return false when autoinstall.InHoldout(autoinstall.Bucket(in.State.ID))?
| @@ -0,0 +1 @@ | |||
| * A coding agent no longer gets the "Databricks skills are not installed" hint on a command after which the automatic installation of Databricks AI tools installs them for that agent, so its output no longer tells it to install what the same command installs. When that installation does not happen, the hint appears on the next command. | |||
There was a problem hiding this comment.
[nice to have] .nextchanges/README.md requires a trailing PR link such as ([#NNNN](https://github.com/databricks/cli/pull/NNNN)), and task check-changelog fails without it. The entry is also long for a single changelog line. Something like "Coding agents no longer get the install hint on a command whose automatic installation of Databricks AI tools installs them for that agent." would do. Can you shorten it and add the link?
Co-authored-by: Isaac <no-reply@databricks.com>
|
Commit: Regression test reportSelected 1 changed tests (limit=20, 0 not selected) 1 tests: regression=1 unreleased=0 coverage=0 failing=0
TestAccept/cmd/aitools/auto-install/agent-hint: branch ✅ | main (1ea5591) ❌ | latest (v1.27.0) ❌main (1ea5591): latest (v1.27.0): |
| if err != nil { | ||
| return false | ||
| } | ||
| for _, it := range tools.plan { |
There was a problem hiding this comment.
[non-blocking] An update plan has no items, so this returns false when the global install predates the calling agent. With tools installed for Cursor only and ~/.claude created later, an upgrade that updates a skill still prints the hint followed by "Updated Databricks AI tools for Claude Code, Cursor" on the same command. Is the update path meant to be out of scope? If so, can the doc comment say it?
✅ Integration test reportCommit: cb5377d
Top 32 slowest tests (at least 2 minutes):
|
simonfaltum
left a comment
There was a problem hiding this comment.
🤖 Automated review from simonfaltum's review agent (pr-review skill) at b117245. Each finding was verified against the code; simonfaltum may follow up.
Not approving yet: 1 blocking issue(s), tagged [blocking].
This PR withholds the "Databricks skills are not installed" hint when the auto-install after the command is predicted to give the calling agent its first tools, which fixes the contradiction on a successful first install. The prediction is made before the command, but auto-install runs only after a command that succeeded. So on a failing command the hint is withheld and nothing installs, and every later failing command does the same; this is the blocking item, already raised in an open thread. Failed retries, holdout machines and the update path are smaller gaps in the same prediction. Deciding the hint after the command, from what auto-install actually did, may close all of them at once.
Questions
AutoInstallsForrepeats the first half ofautoInstall(state-free skips,Load,Decide,planTools,newAgents) to predict, before the command runs, what the post-run hook will do. Any later change to howautoInstalldecides has to be copied here, or the hint and the install disagree again; the holdout, retry and failed-command gaps are cases where the copy already differs. Would it be simpler to decide the hint after the command, from what auto-install actually did? Or should both callers use one shared decision helper? (non-blocking)
Agreeing with existing threads
- [blocking] The hint is withheld on every failing command, with no install to replace it: #7890 (comment)
- [nice to have] Failed install retries withhold the hint with no notice: #7890 (comment)
- [nice to have] Holdout machines lose the first-command hint: #7890 (comment)
- [nice to have] The update path still prints the hint next to "Updated … for ": #7890 (comment)
Co-authored-by: Isaac <no-reply@databricks.com>
Auto-install runs only after a command succeeded, and its gate lookup or install can still end without tools. The hint withheld for it now prints when the command ends unless the agent has the tools by then, so a failing command still gets it. A holdout machine is not withheld from, and an update counts as installing for every agent with a config directory. Co-authored-by: Isaac <no-reply@databricks.com>
Changes
When a coding agent runs the CLI, the CLI can print the "Databricks skills are not installed" hint before the command. On the same command, the auto-install that runs afterwards can install those skills for that agent. The agent then sees two lines that disagree: one tells it to run
databricks aitools install, and the next says the tools were just installed.With this change, the hint is skipped when the auto-install after the command is due to give that agent its first tools.
MaybeHint(ctx, cmd) if hint.installed(ctx) return + if autoinstall.InstallsFor(cmd, hint.agentName) + return // no event, no throttle marker claim throttle, print hint, log hint eventlibs/aitools/autoinstall/hook.go: new hookInstallsFor(cmd, agentName), next toRun.main.gosets it toaitools.AutoInstallsFor, the same wayRunis set, solibs/aitools/agentsdoes not importcmd/aitools.cmd/aitools/autoinstall_hint.go:AutoInstallsFormakes the same decision asautoInstall. It runs the state-free skips, loads the state and checks thatDecidereaches the gate lookup. Then it plans the install and reports whether this agent is one of the plan's new agents. It reads the state but never writes it, and it does not fetch the compatibility manifest.cmd/aitools/autoinstall_run.go: moves the building ofautoinstall.InputsintoautoInstallInputsso both callers use it. Behavior is unchanged.libs/aitools/agents: eachagentHintnow carries the agent's registry name so the hint can ask about it. This covers Claude Code and the registry agents.Why
The hint runs before the command, but the gate is only fetched afterwards, so the check stops at the point where
autoInstallwould fetch it. A run that gets that far counts as installing, and its hint is withheld. If that run then installs nothing (for example, because the gate is off), the hint was not printed and no throttle marker was written. The next command prints the hint as usual. This costs one command of delay and avoids a network call before every command.An agent that the install skips, such as Claude Code with no config dir, still gets the hint on the same command.
Tests
TestAutoInstallsFor(cmd/aitools) covers:Each case also checks that the gate is never fetched, the state file is unchanged and nothing is installed.
libs/aitools/agents:TestMaybeHint_WithheldWhileAutoInstallInstallsForTheAgent: both hint lines are withheld and no event is logged. When the next command does not install, it prints the hint.TestMaybeHint_RegistryAgentAskedByItsName: a registry agent is asked about by its own name.TestMaybeHint_InstalledToolingSkipsTheAutoInstallCheck: when the tooling is already installed, the hook is not called.New acceptance test
acceptance/cmd/aitools/auto-install/agent-hintcovers four cases:Changelog fragment:
.nextchanges/cli/aitools-auto-install-hint-contradiction.md.