Repository navigation
Description
Implementation issue for item (1) of #2841 (SET-REMAINDER of #1858, the set tracker). Filed by queue worker lane code-p, triage task 8566, 2026-11-03.
Decision recorded (worker review, 2026-11-03)
Item (1) as originally worded — register a filtered MCP server set per session via mcp.transform — is not implementable on the pinned opencode v2 surface. Verified across tasks 3997 and 6867 and re-verified at current main by task 8566:
- The pinned
mcp.transformeditor (packages/plugin/src/promise/mcp.ts:6-16) is synchronous and location-wide, with no session ID. - Host reconciliation changes shared connections (
packages/core/src/mcp/index.ts:534-574), so a transform cannot own a per-session server set safely, and a blind implementation risks deleting or duplicating a user's hand-configured servers.
Decision: item (1) is dispositioned as a recorded deviation — the same closest-supported-equivalent treatment #2841 already sanctions for items (3) and (4). The landed equivalent is per-session filtering of model-visible mcpx tool definitions via session.hook("context") (packages/plugin/src/promise/session.ts:25-35; core filtering at packages/core/src/session/model-request.ts:249-275,300,406-407). This is explicitly not access control and not session-scoped registration: connections stay shared, and gateway/shell calls can bypass it. That limitation is part of the acceptance record, not a hidden gap.
Scope
- In
pkgs/mcpx/plugin/opencode/v2/: implement a context-hook filter that, per session, hides model-visible tool definitions for mcpx servers/tools the session's policy marks disabled. - Policy source: the plugin's existing per-session state only (ctx.storage remembered daemon choice / session-env) — the filter must close over asynchronously refreshed plugin state (the established pattern from
v2/permission.ts), never query the daemon synchronously from the hook. - Filter only mcpx-namespaced tool definitions. Never mutate the location-wide MCP registry; never remove or alter user-configured servers.
Out of scope
- Session-scoped MCP registration/discovery in the opencode host itself (upstream surface change; revisit if the pinned API gains a session-scoped transform).
- Items (3) and (5) of mcpx opencode v2 plugin: implement the #1858 SET-REMAINDER items (1)-(5) #2841 — they follow in order after this and item (4) (PR mcpx(v2 plugin): answer sampling via ctx.generate.text (#2841) #4997) land.
Acceptance
- Context-hook filter implemented in the v2 tree with targeted tests (
bun test plugin/opencode/v2/on the laptop or CI green on the PR) - Tests prove: disabled mcpx tools are hidden for the session, enabled ones remain, non-mcpx tools are untouched, and the MCP registry is not mutated
- PR references mcpx opencode v2 plugin: implement the #1858 SET-REMAINDER items (1)-(5) #2841 and mcpx: port the opencode plugin to opencode v2 (a rewrite, and several things get better) #1858, and the deviation (model-visible filtering only, not access control) is stated in the PR body
- Outcome noted on mcpx opencode v2 plugin: implement the #1858 SET-REMAINDER items (1)-(5) #2841 and mcpx: port the opencode plugin to opencode v2 (a rewrite, and several things get better) #1858 when merged
Activity
dezren39 commentedon Nov 3, 2026
🤖 Agent note · picked up
pkgs/mcpx/plugin/opencode/v2/(per-session hiding of disabled mcpx tool definitions, registry untouched), with targeted testsdezren39 commentedon Nov 3, 2026
🤖 Agent note · parked
queue/8797-5122-context-tool-filter41 remaining items
dezren39 commentedon Nov 4, 2026
🤖 Agent note · parked
dezren39 commentedon Nov 4, 2026
🤖 Agent note · picked up
awaiting_ciqueue/8797-5122-context-tool-filterMerge pull request #5170 from developing-today/queue/8797-5122-contex…
dezren39 commentedon Nov 4, 2026
🤖 Agent note · done
awaiting_cipkgs/mcpx/plugin/opencode/v2/, with the mcp.transform deviation as scoped on this issuef486f2aab6a98cf709a4b37659441f318eafa0f8). Verification this shift:bun test plugin/opencode/v2/re-run on the laptop at head7852ed96a— 61 pass, 0 fail. Both Codex P2 findings were fixed in the PR (d4f1c2416,4b0e6a022) with disposition replies on their threads; the final Codex review of the head reports no findings. The two guard checks on PR mcpx v2 plugin: per-session tool filtering via session context hook (#5122) #5170 stayed queued from 2026-11-03T23:35Z (fleet runner congestion, see issue CI: hosted runner queue saturates repo-wide (~425 queued runs), so PR checks wait hours behind push and workflow_run traffic #2605); their substance was verified directly — a test file ships with the fix and every changed file is ≤252 lines (limit 2500).queue/8797-5122-context-tool-filter