Skip to content

feat(plugins): discover and aggregate provider plugins - #272

Open
AprilNEA wants to merge 5 commits into
masterfrom
xuan/code-432
Open

feat(plugins): discover and aggregate provider plugins#272
AprilNEA wants to merge 5 commits into
masterfrom
xuan/code-432

Conversation

@AprilNEA

@AprilNEA AprilNEA commented Jul 24, 2026

Copy link
Copy Markdown
Member

Summary

  • add a read-only provider adapter boundary for native plugin discovery
  • discover and normalize Claude Code plugins through plugin list --available --json and plugin marketplace list --json
  • discover and normalize Codex plugins through app-server plugin/list and plugin/read, including remote plugin identity, per-entry fallback, and process cleanup
  • aggregate Claude Code and Codex catalogs in Engine with deterministic ordering and provider failure isolation
  • keep assets empty in this phase because neither provider control plane supplies trusted LinkCode managed-tool requirements

CODE-432

This PR is intentionally read-only. It does not add wire messages, client/UI support, marketplace mutations, plugin installation, or asset installation.

Verification

  • ran the installed Claude Code and Codex binaries with isolated config directories and observed valid catalogs
  • pnpm format:check
  • pnpm typecheck
  • node --max-old-space-size=8192 node_modules/eslint/bin/eslint.js --concurrency=off --format=sukka . (0 errors)
  • pnpm test (246 files passed, 1 skipped; 1,926 tests passed, 1 skipped)

The default local pnpm check:ci reached the known concurrent ESLint heap limit after its format step; the equivalent format, low-concurrency full-repo lint, and typecheck gates above all passed.

Checklist

  • pnpm check:ci and pnpm test both pass (local concurrent ESLint OOM; equivalent gates and full tests pass as documented above)
  • I ran the affected surface and observed the change working
  • If a wire message changed: WIRE_PROTOCOL_VERSION is bumped (no wire changes)
  • New code and assets are my own work, or their origin and license compatibility are noted above
  • Docs and comments are updated where behavior changed

Summary by CodeRabbit

  • New Features
    • Added plugin discovery to the engine runtime via a new listPlugins capability.
    • Introduced provider-specific adapters to discover and normalize Claude Code and Codex plugins (including metadata, availability, installations, and components).
    • Added optional working-directory scoping for provider discovery and standardized normalized plugin output ordering.
  • Bug Fixes
    • Improved resilience to malformed provider responses and discovery timeouts so other providers’ results still load.
  • Tests
    • Added comprehensive adapter and plugin service test coverage, including validation and timeout scenarios.

@linear-code

linear-code Bot commented Jul 24, 2026

Copy link
Copy Markdown

CODE-432

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: e04c2d77-2b62-4d46-9100-67e85ee51ba1

📥 Commits

Reviewing files that changed from the base of the PR and between 9848e73 and ed49732.

📒 Files selected for processing (5)
  • packages/host/agent-adapter/src/__tests__/claude-code-plugins.test.ts
  • packages/host/agent-adapter/src/__tests__/codex-plugins.test.ts
  • packages/host/agent-adapter/src/native/codex/app-server.ts
  • packages/host/agent-adapter/src/plugins/claude-code.ts
  • packages/host/agent-adapter/src/plugins/codex.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/host/agent-adapter/src/tests/claude-code-plugins.test.ts

📝 Walkthrough

Walkthrough

Adds Claude Code and Codex plugin adapters, normalizes provider plugin catalogs, validates provider responses, handles lifecycle timeouts, and exposes aggregated plugin discovery through the engine runtime and service.

Changes

Plugin discovery

Layer / File(s) Summary
Adapter contracts and registry
packages/host/agent-adapter/src/plugins/adapter.ts, packages/host/agent-adapter/src/plugins/index.ts, packages/host/agent-adapter/src/index.ts
Defines plugin discovery adapter types, exports concrete adapters, and selects adapters for Claude Code and Codex providers.
Claude Code discovery adapter
packages/host/agent-adapter/src/plugins/claude-code.ts, packages/host/agent-adapter/src/__tests__/claude-code-plugins.test.ts
Discovers Claude Code plugins through CLI commands, validates and normalizes metadata, reads local manifests and components, and tests malformed output handling.
Codex discovery adapter
packages/host/agent-adapter/src/plugins/codex.ts, packages/host/agent-adapter/src/native/codex/app-server.ts, packages/host/agent-adapter/src/__tests__/codex-plugins.test.ts
Discovers Codex plugins through the app-server protocol, loads details, normalizes sources and components, and handles malformed responses, subprocess aborts, cleanup, and timeouts.
Engine plugin aggregation
packages/host/engine/src/plugin/service.ts, packages/host/engine/src/engine.ts, packages/host/engine/src/service.ts, packages/host/engine/src/deps.ts, packages/host/engine/src/__tests__/plugin-service.test.ts
Aggregates provider catalogs with deterministic sorting and failure isolation, then exposes listPlugins through engine runtime and service APIs.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant EngineService
  participant EngineRuntime
  participant PluginService
  participant ProviderAdapters
  EngineService->>EngineRuntime: listPlugins(opts)
  EngineRuntime->>PluginService: list(opts)
  PluginService->>ProviderAdapters: list(opts) concurrently
  ProviderAdapters-->>PluginService: normalized plugin catalogs
  PluginService-->>EngineRuntime: sorted aggregated plugins
  EngineRuntime-->>EngineService: plugin list
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 5.26% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the new plugin discovery and aggregation work.
Description check ✅ Passed The description includes Summary, Verification, and Checklist sections with the required details.
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.
✨ 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 xuan/code-432

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

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9848e73c7e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/host/agent-adapter/src/plugins/codex.ts Outdated
Comment thread packages/host/agent-adapter/src/plugins/claude-code.ts Outdated
@greptile-apps

greptile-apps Bot commented Jul 24, 2026

Copy link
Copy Markdown

Greptile Summary

Adds read-only native plugin discovery and aggregation.

  • Introduces Claude Code and Codex provider adapters that normalize native plugin catalogs.
  • Adds Codex discovery deadlines and app-server cleanup.
  • Exposes deterministic, failure-isolated plugin aggregation through the Engine runtime and service.

Confidence Score: 5/5

The pull request appears safe to merge.

No blocking failures remain.

T-Rex T-Rex Logs

What T-Rex did

  • Baseline state was established with Codex CLI 0.144.1, which returned a valid empty catalog and an adapter count of 0, exited with code 0, and reaped PIDs 4228 and 4341.
  • Post-run state matched the baseline, with a valid empty catalog, adapter count 0, exit code 0, and reaped PIDs 4509 and 4626.
  • Final process inspection reported NO_CODEX_APP_SERVER_PROCESSES and exit code 0.

View all artifacts

T-Rex Ran code and verified through T-Rex

Important Files Changed

Filename Overview
packages/host/agent-adapter/src/plugins/claude-code.ts Adds Claude Code CLI catalog discovery, package metadata inspection, and schema normalization.
packages/host/agent-adapter/src/plugins/codex.ts Adds deadline-bound Codex app-server discovery, per-entry detail fallback, and normalization.
packages/host/agent-adapter/src/native/codex/app-server.ts Adds abort-signal propagation to the spawned Codex app-server.
packages/host/engine/src/plugin/service.ts Aggregates provider catalogs concurrently with deterministic ordering and provider failure isolation.
packages/host/engine/src/engine.ts Wires plugin aggregation into the Engine runtime with an injectable provider factory.

Sequence Diagram

sequenceDiagram
  participant C as Engine Consumer
  participant E as Engine
  participant P as PluginService
  participant A as Provider Adapters
  participant CLI as Claude/Codex Control Plane
  C->>E: listPlugins(options)
  E->>P: list(options)
  par Claude Code discovery
    P->>A: ClaudeCodePluginAdapter.list(options)
    A->>CLI: plugin list + marketplace list
    CLI-->>A: native catalog
  and Codex discovery
    P->>A: CodexPluginAdapter.list(options)
    A->>CLI: plugin/list + plugin/read
    CLI-->>A: native catalog
  end
  A-->>P: normalized plugins
  P-->>E: sorted aggregate
  E-->>C: Plugin[]
Loading

Reviews (2): Last reviewed commit: "fix(agent-adapter): harden plugin discov..." | Re-trigger Greptile

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/host/agent-adapter/src/plugins/codex.ts`:
- Around line 125-151: Guard the discovery server shutdown in list so the
timeout callback and the finally block share an idempotent close path. Update
the server.close usage around startServer, the DISCOVERY_TIMEOUT_MS timer, and
the finally cleanup so CodexAppServer.close is invoked at most once, including
when the request rejects after the timeout.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 7c01cd37-5164-4280-850e-3129c22bf462

📥 Commits

Reviewing files that changed from the base of the PR and between 364dd55 and 9848e73.

📒 Files selected for processing (12)
  • packages/host/agent-adapter/src/__tests__/claude-code-plugins.test.ts
  • packages/host/agent-adapter/src/__tests__/codex-plugins.test.ts
  • packages/host/agent-adapter/src/index.ts
  • packages/host/agent-adapter/src/plugins/adapter.ts
  • packages/host/agent-adapter/src/plugins/claude-code.ts
  • packages/host/agent-adapter/src/plugins/codex.ts
  • packages/host/agent-adapter/src/plugins/index.ts
  • packages/host/engine/src/__tests__/plugin-service.test.ts
  • packages/host/engine/src/deps.ts
  • packages/host/engine/src/engine.ts
  • packages/host/engine/src/plugin/service.ts
  • packages/host/engine/src/service.ts

Comment thread packages/host/agent-adapter/src/plugins/codex.ts
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