Skip to content

fix: self-heal stale marketplace cache on first-install#273

Merged
efenocchi merged 2 commits into
mainfrom
fix/install-claude-stale-marketplace
Jun 17, 2026
Merged

fix: self-heal stale marketplace cache on first-install#273
efenocchi merged 2 commits into
mainfrom
fix/install-claude-stale-marketplace

Conversation

@efenocchi

@efenocchi efenocchi commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

Problem

After the harnesses/claude-code path fix (#272, v0.7.99), users who had already attempted an install before the fix still cannot install by re-running hivemind install. Their machine has the marketplace added but pinned to a stale cached marketplace.json (old sha/path claude-code), and the plugin is not installed.

installClaude() first-install branch did NOT refresh the marketplace — the comment claimed "the marketplace fetch is implicit in plugin install", but it isn't: marketplace add is a no-op when already present, so plugin install resolves the stale catalog and re-fails with Subdirectory 'claude-code' not found.

This is exactly the situation of any customer (e.g. Krisp) who hit the original SSO bug: telling them to re-run hivemind install would fail again.

Fix

In the first-install branch, when the marketplace pre-existed, run claude plugin marketplace update hivemind before plugin install. A freshly-added marketplace already fetched the latest, so the refresh only fires when the marketplace was already on disk (stale-cache case). Cold installs are unchanged.

Verification (real end-to-end, not just unit)

Reproduced a faithful stale-cache machine: marketplace cache rolled back to a pre-fix commit (8a9670e, path claude-code, v0.7.98), plugin uninstalled.

  • Negative control — raw claude plugin install hivemindSubdirectory 'claude-code' not found (re-fails).
  • New installClaude() (compiled) → ran marketplace update (cache advanced to current main, path → harnesses/claude-code) → plugin installinstalled, no manual step.

Unit tests: added a guard asserting marketplace update runs BEFORE plugin install when the marketplace pre-exists and the plugin is absent; existing cold-install tests (exact argv sequence, no marketplace update) still pass. 33/33 green.

Summary by CodeRabbit

  • Bug Fixes
    • Improved the plugin installation process to properly refresh marketplace data when needed before installing, preventing failures that could result from using outdated cached marketplace information.

@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 7f1d13f1-fc10-4787-86e8-62ee61626f59

📥 Commits

Reviewing files that changed from the base of the PR and between a2f3739 and 496979a.

📒 Files selected for processing (2)
  • src/cli/install-claude.ts
  • tests/cli/cli-install-claude.test.ts

📝 Walkthrough

Walkthrough

installClaude() gains a marketplacePreexisting boolean derived from marketplaceAlreadyAdded(). When the marketplace is already on disk and the plugin is not yet installed, the installer runs claude plugin marketplace update before claude plugin install hivemind, skipping the marketplace add call. A new test verifies this ordering.

Changes

Stale Marketplace Self-Heal

Layer / File(s) Summary
Stale-cache guard and ordering test
src/cli/install-claude.ts, tests/cli/cli-install-claude.test.ts
installClaude() stores marketplaceAlreadyAdded() in marketplacePreexisting, gates marketplace add on it being false, and conditionally runs plugin marketplace update hivemind before plugin install hivemind in the first-time install branch. A new Vitest case asserts marketplace add is absent and that marketplace update call index precedes plugin install call index.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐇 Hippity-hop, the cache went stale,
But now we update before we install!
The marketplace flag is checked with care,
No dusty plugins lurking there.
Fresh catalogs bloom — all hail the trail! 🌿

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The description addresses the problem, fix, and verification steps thoroughly, though it does not include explicit version bump information as required by the template. Clarify whether a version bump is needed for this bug fix, and if so, specify the new version number in accordance with the template's semantic versioning guidance.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: fixing a stale marketplace cache issue during first install.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/install-claude-stale-marketplace

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

Copy link
Copy Markdown
Contributor

Coverage Report

Scope: files changed in this PR. Enforced threshold: 90% per metric (per file via vitest.config.ts).

Status Category Percentage Covered / Total
🟢 Lines 96.74% (🎯 90%) 89 / 92
🟢 Statements 96.04% (🎯 90%) 97 / 101
🟢 Functions 100.00% (🎯 90%) 10 / 10
🔴 Branches 84.75% (🎯 90%) 50 / 59
File Coverage — 1 file changed
File Stmts Branches Functions Lines
src/cli/install-claude.ts 🟢 96.0% 🔴 84.7% 🟢 100.0% 🟢 96.7%

Generated for commit e730888.

@efenocchi efenocchi merged commit 903a606 into main Jun 17, 2026
11 checks passed
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