Repository navigation
Commit 7402ab1
aitools: refresh only the plugin's own marketplace, and do not fail the install on it (#7473)
Stacked on #7472.
Stacked on: aitools: raise the plugin probe timeout from 5s to 20s
## Summary
Claude Code's `plugin marketplace update` with no name refreshes every
marketplace the user has added, so one unreachable third-party
marketplace failed the Databricks plugin install. The refresh now names
the marketplace the Databricks plugin is listed in
(`claude-plugins-official` for Claude Code), and a failed refresh no
longer stops the install or the update: both go on from the local copy
of the marketplace and, once that succeeds, warn and record the plugin
version as unknown. Codex's `plugin marketplace upgrade` in `aitools
update` names the marketplace too.
```diff
InstallPluginForAgent (libs/aitools/installer/plugin.go)
marketplace add (if absent)
- claude plugin marketplace update
- on error: remove the marketplace we added, return install-failed
+ claude plugin marketplace update <marketplace>
+ on error: keep the error, continue
claude plugin install databricks@<marketplace>
on error: remove the marketplace we added
- return install-failed with the install error
+ return install-failed with the install error
+ + "(refreshing the marketplace also failed: <refresh error>)" if the refresh failed
- record Version = <ref>
+ if the refresh failed and the marketplace was not just added by us:
+ warn that the plugin came from the local copy (with the agent's stderr)
+ record Version = "" (version unknown)
+ else record Version = <ref>
UpdatePluginForAgent (aitools update)
- claude plugin marketplace update
+ claude plugin marketplace update <recorded marketplace, or the agent's current one>
- on error: return install-failed
+ on error: keep the error, continue
claude plugin update ...
- codex plugin marketplace upgrade
+ codex plugin marketplace upgrade <recorded marketplace, or the agent's current one>
+ on error: same as above
codex plugin add ...
on update error: return install-failed
+ + "(refreshing the marketplace also failed: <refresh error>)" if the refresh failed
- record Version = <ref>
+ if the refresh failed and the record does not already hold <ref>:
+ warn that the plugin came from the local copy, record Version = "" (version unknown)
+ else record Version = <ref>
```
Changelog fragment: `.nextchanges/cli/aitools-marketplace-refresh.md`.
## Evidence
`libs/aitools/installer/plugin_test.go`, run at this head with
`plugin.go` temporarily reverted to the parent's version and then
restored:
- **Before:**
```text
TestInstallPluginContinuesWhenRefreshFails FAIL
claude-code: install-failed: /usr/bin/claude plugin marketplace update:
boom
TestInstallPluginRollsBackMarketplaceWhenRefreshAndInstallFail FAIL
detail "...marketplace update: refresh boom" does not contain "install
boom (refreshing the marketplace also failed: "
```
**After:**
```text
TestInstallPluginContinuesWhenRefreshFails PASS (install runs,
marketplace kept)
TestInstallPluginRollsBackMarketplaceWhenRefreshAndInstallFail PASS
(both errors in the detail, marketplace removed)
ok github.com/databricks/cli/libs/aitools/installer
```
The existing tests now also check that the refresh command names the
marketplace (`claude plugin marketplace update databricks-agent-skills`,
`codex plugin marketplace upgrade databricks-agent-skills`) and that a
failed refresh leaves the recorded version empty unless we just added
the marketplace. `TestInstallPluginContinuesWhenRefreshFails` is a
table: a just-added marketplace (version recorded, no warning) and an
already registered one (install goes on, no `marketplace remove`,
`InstalledMarketplace == false`, empty version, warning with the agent's
stderr). `TestUpdatePluginForAgentClaudeOneStep` also covers a record
without a marketplace (falls back to the agent's marketplace). The
failed install and failed update tests assert that the local-copy
warning is not printed. For `aitools update`:
`TestUpdatePluginForAgentContinuesWhenRefreshFails` (Claude Code and
Codex: the refresh fails, the update still runs),
`TestUpdatePluginForAgentReportsRefreshWhenUpdateFails` (both errors in
the detail), and
`TestUpdateInstalledPluginsRecordsUnknownVersionWhenRefreshFails` (the
update succeeds, the state records an empty version).
`TestUpdateInstalledPluginsRecordsUnknownVersionWhenRefreshFails` also
covers a record that already holds the current release (kept).
`TestInstalledPluginAgents` covers plugin records without a version, and
`TestUpdateCheckPrintsPluginState` the three `--check` statuses.
`TestAgentStatusLabelKeepsUnknownStaleScope` covers the `aitools list`
label when one scope has an unknown version and the other is current. At
this head: `go build ./...`, unit tests for `libs/aitools/...` and
`cmd/aitools/...`, `task test-exp-aitools`, the `cmd/aitools` acceptance
tests, lint and format on changed files, `task checks`, and `go vet` for
windows and darwin on the aitools packages pass. Not run on Windows or
macOS, and not run against a real `claude` binary.
## Merge Danger
**Door:** two-way
Behavior change: a failing refresh used to fail `aitools install` with
an install-failed error and remove the marketplace we had just added.
Now the install goes on using the local copy of the marketplace; if that
copy is stale and lacks the plugin, the install fails and the error
includes both messages. A refresh failure that is followed by a
successful install prints a warning with the agent's stderr and a hint
to run `databricks aitools update`, and the plugin is recorded as
"version unknown" so `aitools update --check` and `aitools list` don't
report it as up to date. The warning is printed only after the install
succeeds, and not when we just added the marketplace (that copy is
fresh, so the version is recorded as usual). `aitools list` now shows
"version unknown · update available" when one scope has an unknown
version and another is current, instead of the current scope's version.
No exit code changes. A refresh that hangs until the 60s command timeout
used to end the run; now the install or update runs next and can wait up
to another 60s, so on a machine where GitHub hangs instead of failing
fast, `aitools install` or `aitools update` can take about a minute
longer than before. `aitools update` used to skip the plugin with a
warning when the refresh failed; now, for both Claude Code and Codex, it
still runs the plugin update and, unless the record already holds the
current release, warns (with a hint to rerun `databricks aitools update`
later) and records the version as unknown. When the record already holds
the current release, it keeps that version and prints no warning.
`aitools update --check` shows an unknown version as "version unknown
(update may be available)", and `databricks version --check` still
counts a plugin recorded without a version as installed, so it does not
suggest installing Databricks tooling. If the update itself fails, the
plugin is skipped as before and the error includes both messages. Both
commands refresh only the one marketplace now.
**Blast Radius:** small
Only the Claude Code plugin install and update path and the Codex plugin
update path in `databricks aitools`. This relies on `claude plugin
marketplace update <name>` and `codex plugin marketplace upgrade <name>`
accepting a marketplace name; that is checked only through the stubbed
commands in the tests here.
This pull request and its description were written by Isaac.
Co-authored-by: Isaac <no-reply@databricks.com>1 parent 460df03 commit 7402ab1
12 files changed
Lines changed: 434 additions & 75 deletions
File tree
- .nextchanges/cli
- cmd
- aitools
- version
- libs/aitools
- agents
- installer
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
379 | 379 | | |
380 | 380 | | |
381 | 381 | | |
382 | | - | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
383 | 385 | | |
384 | 386 | | |
385 | 387 | | |
386 | 388 | | |
387 | 389 | | |
388 | 390 | | |
389 | | - | |
390 | | - | |
| 391 | + | |
| 392 | + | |
391 | 393 | | |
392 | 394 | | |
393 | 395 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
348 | 348 | | |
349 | 349 | | |
350 | 350 | | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
351 | 362 | | |
352 | 363 | | |
353 | 364 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
300 | 300 | | |
301 | 301 | | |
302 | 302 | | |
303 | | - | |
| 303 | + | |
304 | 304 | | |
305 | 305 | | |
306 | 306 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
62 | 80 | | |
63 | 81 | | |
64 | 82 | | |
| |||
85 | 103 | | |
86 | 104 | | |
87 | 105 | | |
88 | | - | |
| 106 | + | |
89 | 107 | | |
90 | 108 | | |
91 | 109 | | |
| |||
94 | 112 | | |
95 | 113 | | |
96 | 114 | | |
97 | | - | |
| 115 | + | |
98 | 116 | | |
99 | 117 | | |
100 | 118 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
| 47 | + | |
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
29 | | - | |
30 | | - | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
17 | 20 | | |
18 | 21 | | |
19 | 22 | | |
| |||
34 | 37 | | |
35 | 38 | | |
36 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
37 | 61 | | |
38 | 62 | | |
39 | | - | |
40 | | - | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
41 | 67 | | |
42 | 68 | | |
43 | 69 | | |
| |||
55 | 81 | | |
56 | 82 | | |
57 | 83 | | |
58 | | - | |
| 84 | + | |
59 | 85 | | |
60 | 86 | | |
61 | 87 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
57 | 71 | | |
58 | 72 | | |
59 | 73 | | |
| |||
82 | 96 | | |
83 | 97 | | |
84 | 98 | | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
85 | 150 | | |
86 | 151 | | |
87 | 152 | | |
| |||
0 commit comments