Skip to content

fix(marketplace): handle invalid registrations safely - #451

Merged
christso merged 4 commits into
mainfrom
fix/handle-invalid-plugin
Aug 18, 2026
Merged

fix(marketplace): handle invalid registrations safely#451
christso merged 4 commits into
mainfrom
fix/handle-invalid-plugin

Conversation

@christso

@christso christso commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Summary

  • refresh remote marketplaces through a staged clone so transient failures preserve both the existing registration and cached files
  • distinguish unreachable marketplaces from unsafe legacy registrations; remove only unsafe metadata and never access or delete an unmanaged path
  • reject unsafe marketplace names and overly broad local roots, guard every remote cache access, and surface warnings in text, JSON, and TUI flows
  • support relocation of the complete .allagents state directory while refusing internal or per-marketplace cache symlinks
  • carry the exact registry key and scope through lookup, refresh, plugin/skill updates, and cleanup so malformed legacy aliases cannot affect another registration
  • preserve platform-valid local aliases, handle prototype-named registry keys safely, and prevent unsafe marketplace paths from entering the plugin fetch cache
  • cover refresh failure, rollback, unsafe paths/names, canonical names, symlinks, scope precedence, cache seeding, update, and removal behavior with focused regressions

Closes #449

Root cause

Resolving a missing plugin from a registered remote marketplace triggers a fresh clone. The old refresh path deleted and saved the marketplace entry, then deleted its cache, before cloning. If the clone failed because of auth, network, or repository availability, the failed install left marketplaces.json without the original entry.

A missing plugin or transient clone failure does not make a marketplace registration invalid. This change preserves valid registrations and caches in that case. Separately, legacy remote registrations whose cache path is outside or does not match AllAgents' managed marketplace cache are removed from the registry without touching the referenced filesystem path. Specific local marketplace directories remain user-owned and are never refreshed or deleted; filesystem roots, the entire user home, and aliases to either are too broad to register.

The filesystem ownership and registry-key rules are colocated with the implementation and focused tests. Relocating the complete .allagents directory remains supported, but symlinking only its internal cache directories or an individual remote cache is refused because those paths do not establish an AllAgents-owned deletion boundary. Local aliases use registry-key rules rather than remote-cache filename rules, so valid platform-specific names remain supported.

Validation

  • npx --yes bun@1.3.12 test (1397 pass, 5 skip)
  • npx --yes bun@1.3.12 run typecheck
  • npx --yes bun@1.3.12 run lint
  • npx --yes bun@1.3.12 run build
  • npx --yes bun@1.3.12 run test:e2e (123 pass, 4 skip)
  • final independent code review found no remaining issues

Manual E2E

  1. Build the CLI with bun run build.

  2. Create an isolated ALLAGENTS_TEST_HOME containing:

    • a registered remote marketplace whose cached manifest does not contain XXX
    • a marker file in that marketplace cache
    • an unreachable Git source such as https://127.0.0.1:1/unreachable.git
  3. Record checksums for marketplaces.json and the cache marker, then run:

    ALLAGENTS_TEST_HOME=/tmp/allagents-issue-449/home \
      ./dist/index.js plugin install XXX@test-mp --scope user
  4. Verify the command exits 1, reports the underlying refresh failure and that the existing registration/cache were preserved, and both checksums are unchanged.

  5. Create a separate isolated registry with a legacy remote entry pointing at an unmanaged directory plus an unrelated valid entry. Run the same install for the unsafe entry and verify only its registry key is removed, the referenced directory is untouched, and the unrelated entry remains.

  6. Run plugin marketplace add with an unsafe marketplace name and verify it is rejected before cloning or changing the registry.

Before this fix, step 3 cleared the affected marketplace entry and deleted its old cache when the refresh clone failed. After the fix, the valid registration and cache remain intact, while genuinely unsafe remote metadata is handled explicitly without deleting user-owned files.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 18, 2026

Copy link
Copy Markdown

Deploying allagents with  Cloudflare Pages  Cloudflare Pages

Latest commit: e33a28e
Status: ✅  Deploy successful!
Preview URL: https://82f754c7.allagents.pages.dev
Branch Preview URL: https://fix-handle-invalid-plugin.allagents.pages.dev

View logs

@christso christso changed the title fix(plugin): preserve marketplace on failed refresh fix(marketplace): handle invalid registrations safely Aug 18, 2026
@christso
christso merged commit f0716e5 into main Aug 18, 2026
5 checks passed
@christso
christso deleted the fix/handle-invalid-plugin branch August 18, 2026 04:06
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.

marketplaces.json will be cleaned when we install an invalid plugin

1 participant