Repository navigation
feat(mcpx): plugin session foundation for the privileged plugin surface (#1873) - #10045
Conversation
…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).
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Warning Review limit reachedYou'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. View limit details
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. |
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.Openissues a plugin session id (ps-prefixed, so it is distinguishable from the leasing/attributionMCPX_SESSION_IDin 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.Ownregisters later slices' creations against a live session (refused against a dead one).Closedrops 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.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/statusembeds the same live list aspluginSessions, somcpx statusanswers what is extending the daemon.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.tsregenerated 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[]../...):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=5on 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 toClose, capability enforcement, and the verbs themselves (vars store, named-command registry, detach/re-address) are follow-on packets on top of this foundation.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.