Skip to content

plugins: detect the bundle format and record it in Plugin status - #694

Closed
danielle-mustillo wants to merge 2 commits into
mainfrom
feat/plugin-format-detection
Closed

danielle-mustillo wants to merge 2 commits into
mainfrom
feat/plugin-format-detection

Conversation

@danielle-mustillo

@danielle-mustillo danielle-mustillo commented Sep 25, 2026 •

Copy link
Copy Markdown
Collaborator

Description

The registry now detects which layout a plugin bundle uses, and records it in Plugin.status.

Why: A plugin bundle has one of two layouts.

  • A Claude plugin keeps its manifest at .claude-plugin/plugin.json.
  • An Agent Plugins bundle keeps its manifest at plugin.json in the root.

The registry reads only the Claude path today. So an Agent Plugins bundle gets no manifest and still becomes Ready. kagent checks bundles more strictly at startup, so an accepted Plugin can still fail later.

What changed:

  1. Plugin.status gets two fields.
    • format holds the detected layout: claude-plugin or agent-plugins.
    • scanVersion holds the version of the detection rules. It starts at 1.
  2. The new package internal/registry/plugins/format detects the layout. It uses the same rules as kagent's loadManifest (feat(harness): load Claude-format plugins whole only on the Claude harness kagent-dev/kagent#2875).
    • A root plugin.json with the Agent Plugins $schema is agent-plugins. It wins when both manifests exist.
    • A root plugin.json with any other $schema, or none, is rejected.
    • A bundle with only .claude-plugin/plugin.json is claude-plugin.
    • A bundle with no manifest, or a manifest path that is a directory, is rejected.
    • The manifest needs a valid name. Known keys must have the right JSON type. Other keys are ignored.
  3. A rejected bundle becomes Ready=False with reason SourceInvalid. The message names the file and the rule.
    • The status drops the old manifest, inventory, and format.
    • It keeps the resolved source, because Deployment fingerprints read it.
  4. The controller rescans any Plugin whose scanVersion is not current. So raising the version rescans every stored Plugin.
    • Terminal failures record the version, so they do not rescan on every resync.
    • Retryable failures do not record it, so they retry.
  5. status.manifest now comes from the selected manifest.
  6. openapi.yaml and ui/lib/api/types.gen.ts are regenerated.

Size: Code is +346/−93 lines. Tests are +426/−29 lines. Generated files are +7 lines.

Related issues: Part of #626. #695 builds on this PR.

Change Type

/kind feature

Changelog

Plugin status now records the detected bundle format in status.format and the rules version in status.scanVersion. A Plugin without a valid plugin.json or .claude-plugin/plugin.json manifest now becomes Ready=False with reason SourceInvalid. After an upgrade, the controller scans every Plugin once more. A Plugin whose git source names a branch pins to the current branch head during that scan.

Additional Notes

  1. Behaviour change: A Plugin with only a skills/ folder and no manifest used to be Ready. Now it is Ready=False.
  2. One rescan after upgrade: Each stored Plugin is scanned once. The scan changes no spec, so nothing redeploys. The exception is a Plugin that tracks a branch. It pins to the branch head, so its Deployments redeploy once.
  3. Inventory is unchanged: An Agent Plugins bundle still gets the old inventory. plugins: build the inventory by the rules of the detected format #695 fixes that. Both PRs should ship in the same release.
  4. Known gap: The bundle loader skips symbolic links, but kagent follows them. So the scan cannot see a manifest that is a link. A test covers this gap.
  5. Tests: make test-unit, make lint, and make test-e2e E2E_SUITE=registry pass locally.

Detect whether a bundle is a Claude plugin or an Agent Plugins bundle,
using the same manifest rules as kagent. Record the format and a scan
version in Plugin status. A bundle with no valid manifest is now
rejected. Raising PluginScanVersion makes stored Plugins rescan.
@danielle-mustillo
danielle-mustillo force-pushed the feat/plugin-format-detection branch from e76beca to cf38b6d Compare September 25, 2026 15:04
@danielle-mustillo danielle-mustillo self-assigned this Sep 25, 2026
@danielle-mustillo
danielle-mustillo marked this pull request as ready for review September 25, 2026 22:44
@github-actions

Copy link
Copy Markdown

This pull request has been marked as stale due to no activity in the last 14 days. It will be closed in 3 days unless it is tagged "no stalebot" or other activity occurs.

@github-actions github-actions Bot added the stale label Oct 10, 2026
@github-actions

Copy link
Copy Markdown

This pull request has been closed due to inactivity.

@github-actions github-actions Bot closed this Oct 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant