Skip to content

aitools: recover from a removed built-in marketplace on plugin install#6066

Open
dustinvannoy-db wants to merge 2 commits into
databricks:mainfrom
dustinvannoy-db:dustinvannoy-db/aitools-marketplace-recovery-clean
Open

aitools: recover from a removed built-in marketplace on plugin install#6066
dustinvannoy-db wants to merge 2 commits into
databricks:mainfrom
dustinvannoy-db:dustinvannoy-db/aitools-marketplace-recovery-clean

Conversation

@dustinvannoy-db

Copy link
Copy Markdown

Why

When databricks aitools install installs the databricks plugin for Claude Code, the plugin is served from Claude's built-in claude-plugins-official marketplace. #5771 added a proactive plugin marketplace update before install to fix a stale local copy, but a user who has removed that marketplace entirely still hits an opaque failure at install time:

✘ Failed to install plugin "databricks@claude-plugins-official": Plugin "databricks" not found in marketplace "claude-plugins-official". Your local copy may be out of date...

What

  • Detect the removed-marketplace case at the install-failure step via marketplaceMissing(err) (Claude reports Plugin "<id>" not found in marketplace "<name>"), gated by builtinMarketplaceRepairable so only that failure triggers recovery — auth and network errors are left untouched, and we never prompt to re-add a marketplace that is present.
  • In an interactive session, prompt the user, then re-add + refresh the marketplace and retry the install once. The built-in marketplace is shared infrastructure, so recovery never records ownership and uninstall never de-registers it.
  • In a non-interactive session (or when the user declines or the retry fails), return a BlockedError naming the exact repair commands, rendered from a single repairCommands() helper shared with the prompt so the two can't drift.

Notes for reviewers

  • marketplaceMissing matches on the agent CLI's stderr string rather than a sentinel. This is a deliberate exception to the "don't branch on error strings" rule: the claude CLI exposes no error code for this, the same file already does this in claudeAlreadyDisabled, and the match is only used to decide whether to attempt a re-add — the retried install is always the real verdict. The matched string was verified against the live Claude CLI.

Testing

  • Unit tests cover: recover-after-prompt, user-declines, non-interactive actionable error, retry-still-fails, and a non-missing (auth) failure that must skip recovery.
  • go test ./libs/aitools/... ./cmd/aitools/..., go vet, and ./task lint-q all pass.

This pull request and its description were written by Isaac.

The proactive `plugin marketplace update` handles a stale local copy of
Claude's built-in claude-plugins-official marketplace, but a user who
removed it entirely still hits "Plugin not found in marketplace" at
install time. Detect that specific failure (marketplaceMissing) and, only
then, offer to re-add and refresh the marketplace and retry the install
once. Auth and network failures are left untouched so we never prompt to
re-add a marketplace that is present.

In a non-interactive session (or when the user declines or the retry
fails), surface a BlockedError naming the exact repair commands, rendered
from a single repairCommands() helper shared with the prompt so the two
can't drift apart.

Co-authored-by: Isaac
Verified against the real Claude CLI: a plugin install against a missing
built-in marketplace fails with `Plugin "<id>" not found in marketplace
"<name>"`. The `marketplace not found` phrase only comes from `plugin
marketplace update` (which the recovery gate never inspects) and puts the
name mid-string, so the substring never matched anything. Drop it and keep
only the verified `not found in marketplace` match.

Co-authored-by: Isaac
@github-actions

Copy link
Copy Markdown
Contributor

An authorized user can trigger integration tests manually by following the instructions below:

Trigger:
go/deco-tests-run/cli

Inputs:

  • PR number: 6066
  • Commit SHA: f6d06849cdd711dfa60af53a2c75288c3c7458a6

Checks will be approved automatically on success.

@github-actions

Copy link
Copy Markdown
Contributor

Waiting for approval

Based on git history, these people are best suited to review:

  • @simonfaltum -- recent work in libs/aitools/installer/, libs/aitools/agents/

Eligible reviewers: @Divyansh-db, @MarioCadenas, @Shridhad, @atilafassina, @calvarjorge, @chrisst, @ditadi, @fjakobs, @hectorcast-db, @igrekun, @keugenek, @lennartkats-db, @mihaimitrea-db, @parthban-db, @pffigueiredo, @pkosiec, @rauchy, @renaudhartert-db, @tanmay-db, @tejaskochar-db

Suggestions based on git history. See OWNERS for ownership rules.

@dustinvannoy-db

Copy link
Copy Markdown
Author

@renaudhartert-db would you be able to review this when you have a chance? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant