fix(marketplace): handle invalid registrations safely - #451
Merged
Conversation
Deploying allagents with
|
| Latest commit: |
e33a28e
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://82f754c7.allagents.pages.dev |
| Branch Preview URL: | https://fix-handle-invalid-plugin.allagents.pages.dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
.allagentsstate directory while refusing internal or per-marketplace cache symlinksCloses #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.jsonwithout 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
.allagentsdirectory 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 typechecknpx --yes bun@1.3.12 run lintnpx --yes bun@1.3.12 run buildnpx --yes bun@1.3.12 run test:e2e(123 pass, 4 skip)Manual E2E
Build the CLI with
bun run build.Create an isolated
ALLAGENTS_TEST_HOMEcontaining:XXXhttps://127.0.0.1:1/unreachable.gitRecord checksums for
marketplaces.jsonand the cache marker, then run:Verify the command exits 1, reports the underlying refresh failure and that the existing registration/cache were preserved, and both checksums are unchanged.
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.
Run
plugin marketplace addwith 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.