Skip to content

feat(mcpx): plugin session foundation for the privileged plugin surface (#1873) - #10045

Merged
dezren39 merged 1 commit into
mainfrom
queue/16646-1873-plugin-session
Nov 14, 2026
Merged

dezren39 merged 1 commit into
mainfrom
queue/16646-1873-plugin-session

Conversation

@dezren39

@dezren39 dezren39 commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

Implements queue task 16646 — the plugin-session foundation slice for #1873 (Approach C), as routed by the 2026-11-14 triage (task 15163) and bounded by decisions 0001/0003.

What lands

  • internal/pluginsession — the ownership registry. Open issues a plugin session id (ps- prefixed, so it is distinguishable from the leasing/attribution MCPX_SESSION_ID in logs and events — mcpx: the privileged plugin surface -- runtime hooks, variables, internal commands, detachment #1873 open question 1), records the plugin's manifest declarations, and keys everything to the session. Own registers later slices' creations against a live session (refused against a dead one). Close drops the session and everything it owns in one locked step and returns the dropped record — it is the single teardown operation the clean path and any crash path both call, so a dead plugin's registrations cannot outlive it.
  • Declarations, declare-only. Capabilities are captured from the open call and are recorded/reportable, never enforced (decision 0003). Hook subscriptions are captured as manifest declarations owned by the session; there is no hook-registration route (decision 0001 forbids one).
  • Daemon surface — POST /v1/plugin-sessions (201, returns the issued session), GET /v1/plugin-sessions, GET /v1/plugin-sessions/{id}, DELETE /v1/plugin-sessions/{id} (returns the dropped record; a closed session 404s — gone, not parked). /v1/status embeds the same live list as pluginSessions, so mcpx status answers what is extending the daemon.
  • Ops registry — the four operations are declared in internal/api/ops.go (PermissionRun for open/close, PermissionRead for reads), which makes them reachable from the generated CLI commands and MCP proxy tools; plugin/core/ops.gen.ts regenerated via the api test's -update.

Tests (oracle named per test)

  • internal/pluginsession: issuance + distinguishable ids; declared capabilities/hooks recorded once each and reportable via Get/List; two sessions' registrations and declarations isolated; close drops everything atomically (dropped snapshot is the whole record; dead-session Own refused; double-close drops nothing); snapshots are copies; concurrent open/own/close leaks nothing; empty registry lists [], not nil.
  • internal/daemon: open without a plugin name is a 400 that creates nothing; the full lifecycle across list, status embedding, get, and close surfaces; empty list renders [].
  • Run per the tree's rules (changed packages, not ./...): go test ./internal/pluginsession ✔, go test ./internal/api ✔ (incl. parity + generated-TS freshness), go test ./internal/daemon -run 'PluginSession|Parity|Routes|OpenAPI|Status|Ops' ✔, -race -shuffle=on -count=5 on the new tests ✔, darwin/arm64 build + test-compile of the touched packages ✔.

Deferred, as the packet scopes

Resolving manifest hooks into live bus subscribers (and the #1872 hooks-setting question), binding pool-instance death to Close, capability enforcement, and the verbs themselves (vars store, named-command registry, detach/re-address) are follow-on packets on top of this foundation.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…ce (#1873)

Task 16646, the first implementation slice of #1873 (Approach C, decisions 0001/0003): internal/pluginsession is the ownership registry -- Open issues a plugin session id (ps- prefixed, distinct from the leasing MCPX_SESSION_ID), records the manifest declarations (capabilities per 0003: declared and reportable, never enforced; hook subscriptions per 0001: manifest-owned, no registration route), Own keys later slices registrations to the session, and Close drops the session and everything it owns in one locked step -- the single teardown the clean and crash paths both call. Daemon surface: POST/GET/DELETE /v1/plugin-sessions (+/{id}), the same list embedded in /v1/status as pluginSessions, and the four operations declared in internal/api (generated CLI/MCP reachability; ops.gen.ts regenerated). Tests: issuance/identity, declaration capture, two-session isolation, atomic teardown, snapshot immutability, concurrency; daemon route lifecycle across list/status/get/close; race+shuffle x5 on the new tests; darwin build and test-compile pass. Deferred to follow-on packets, as the packet scopes: resolving manifest hooks into live bus subscribers, binding pool-instance death to Close, and the verbs (vars store, named commands, detach).
@dezren39
dezren39 requested a review from a team as a code owner November 14, 2026 14:20
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-14T14:20:21.868267Z
We couldn’t complete this review. Comment @codex review to try again.
f99babb PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Nov 14, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 11 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 2173c121-6923-4963-a597-5396137ac8a7
Commits

Reviewing files that changed from the base of the PR and between 58aeae3 and f99babb.

Files selected for processing: 7

  • pkgs/mcpx/internal/api/ops.go
  • pkgs/mcpx/internal/daemon/routes_pluginsessions.go
  • pkgs/mcpx/internal/daemon/routes_pluginsessions_test.go
  • pkgs/mcpx/internal/daemon/server.go
  • pkgs/mcpx/internal/pluginsession/pluginsession.go
  • pkgs/mcpx/internal/pluginsession/pluginsession_test.go
  • pkgs/mcpx/plugin/core/ops.gen.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

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