GeezerVison is showing github.com — mcpx: take the pool's session key from the request (`_meta["ai.opencode/sessionID"]`), not the daemon's pid · Issue #1932 · developing-today/code
mcpx: take the pool's session key from the request (_meta["ai.opencode/sessionID"]), not the daemon's pid #1932Labels app/mcpxPackage/app: mcpx (pkgs/ or apps/ in this repo)effort/mMedium: expected under 1 day of workenhancementNew feature or requestkind/bugSomething isn't working (prefixed form of the classic bug label)meta/enrichedIntake review done: acceptance criteria, links, and normalized labels addedpriority/normalOrdinary priority (the default)source/humanFiled directly by a human DescriptionRelocated from dezren39/darwin-nix#211 on 2026-10-28 (placement audit): mcpx's single source lives in developing-today/code (pkgs/mcpx); re-home tracked at #309. Original body below; issue references inside it are historical (dezren39/nix numbering).
Parent: #181
Summary
A host that reaches mcpx over MCP is keyed as mcp-<pid> of the serving process. Over the daemon's /mcp that pid is the daemon's, so every HTTP host shares one session scope and one browser. The comment says a host has "no way to tell us" its session. opencode v2 does tell: every tools/call, including calls from inside its code mode, carries _meta["ai.opencode/sessionID"]. 2026-07-28 also forbids treating connection or process identity as session continuity. Reading the key from the request would give each opencode session its own stateful servers without the shell.env plugin hook, which v2 no longer provides.
Found while writing the comparison register (pkgs/mcpx/docs/compare/) and checked against the code at 05c78b2. Each row below links its register entry, which carries the value, effort, risk, the specification text and every source.
Register rows
| row |
difference |
mcpx @ 05c78b2 |
effort |
| META-09 |
ai.opencode/sessionID on every opencode v2 tools/call |
✗ — ignored; every host shares one scope |
M |
| PM-10 |
Every HTTP MCP host shares one pool session key |
✗ — key is the daemon's pid |
S |
Evidence
internal/cli/serve.go:287-297 (mcpSession), internal/cli/serve_ask.go:31-37.
v2:packages/core/src/mcp/client.ts:278 (opencode v2 2.0.3).
2026-07-28/basic/index.mdx:204-208.
What to do
Take the scope key from a configured list of _meta keys (default ai.opencode/sessionID), falling back to today's behaviour; thread it through Backend.Call/Exec. A setting, not a hard-coded key.
Ease · Impact · Related
Ease S · Impact high · Related: #47 (plugin port to v2), #48 (harness-free plugin core); docs/compare/stateless.md §5 item 5
Acceptance criteria
- When a
tools/call carries _meta["ai.opencode/sessionID"], mcpx keys the pool session from that value: distinct opencode sessions get distinct stateful server scopes (META-09 / PM-10).
- Hosts that send no session meta get a documented fallback scope — never the daemon's pid or connection identity treated as session continuity (2026-07-28 rule).
- The
shell.env plugin hook workaround is no longer required for per-session state once this lands.
- Tests cover two interleaved sessions sharing one daemon
/mcp endpoint.
Activitydeveloping-today commented on Oct 28, 2026 dezren39 commented on Oct 28, 2026 History carried over from dezren39/darwin-nix#211 (verbatim, oldest first):
@dezren39 · 2026-10-28T04:31:09Z
🤖 Intake review — fleet monitor, 2026-10-27 run
- Related: parent tracker Phase 3: sync, blob gate, and relays #181; register rows META-09 / PM-10 in
pkgs/mcpx/docs/compare/register/.
- Evidence caveat: the register evidence was verified against mcpx at
05c78b2 (2026-09-30). Re-verify each row against current main before fixing — a row may have moved since.
- Still live: checked this run — no merged PR references this issue (cross-references are the register/tracker issues themselves).
- Risks: session-key changes affect every stateful server (browsers especially) — a wrong fallback merges strangers' sessions; test the no-meta fallback explicitly.
- Suggested approach: read the key at the
/mcp boundary and thread it to the pool; keep the old keying behind it only for the documented fallback.
added kind/bugSomething isn't working (prefixed form of the classic bug label) effort/mMedium: expected under 1 day of work meta/enrichedIntake review done: acceptance criteria, links, and normalized labels added app/mcpxPackage/app: mcpx (pkgs/ or apps/ in this repo) on Oct 28, 2026dezren39 commented on Oct 29, 2026 🤖 Agent note · parked
- Agent: queue worker (repo-worker-code), lane C shift
- Session / ID: queue task 3227, repo-health-code-pilot (second resume)
- Found via: queue claim
- Task: PR mcpx: configurable _meta session keys — read ai.opencode/sessionID for request identity (#1932) #2195 confirmed already queued to merge (
gh pr merge → "already queued to merge"; all branch checks PASS, mergeStateStatus CLEAN/MERGEABLE, Codex no findings on head 259749f) — but the merge queue has not merged it after a further 4-minute poll. The merge-group CI is queued behind the same runner congestion affecting PRs feat(usage-hub): GitHub billing collector on the unified usage endpoint (#1051) #2236/docs(openclaw): comms-path design — Slack primary, direct API phase 2 (#2023) #2303. Nothing about the PR itself is blocked.
- Expectation / resume: on resume, check PR mcpx: configurable _meta session keys — read ai.opencode/sessionID for request identity (#1932) #2195 fresh — if MERGED, complete task 3227 as fixed_merged, verify mcpx: take the pool's session key from the request (
_meta["ai.opencode/sessionID"]), not the daemon's pid #1932, strip claim labels. If it was ejected from the queue, re-check branch checks and re-queue the merge.
- Links: PR mcpx: configurable _meta session keys — read ai.opencode/sessionID for request identity (#1932) #2195
dezren39 commented on Oct 29, 2026 dezren39 commented on Oct 29, 2026 dezren39 commented on Oct 29, 2026 dezren39 commented on Oct 29, 2026 dezren39 commented on Oct 29, 2026 🤖 Agent note · done (pr_opened)
- Agent: queue worker (repo-worker-code), openchamber scheduled lane
- Session / ID: queue task 3227 (small_fix, resume attempt 2)
- Found via: queue claim (resumed from
awaiting_ci)
- Task: PR mcpx: configurable _meta session keys — read ai.opencode/sessionID for request identity (#1932) #2195 (head
259749f8) verified green and complete: basic: proxy port fallbacks, basic: spec parity, basic: test all PASS, MERGEABLE/CLEAN, 0 unresolved threads. It sits in the main merge queue at position 8, behind a repo-wide stall — main has not advanced since 5a34fa70 (10:57:51Z) and every entry ahead is AWAITING_CHECKS with no runner pickup (ci: Actions check runs stuck in queued across PRs — no runner pickup since ~05:00Z 2026-10-28 #1599). This is the third pass blocked on that same wait (the queue ejected the PR at 14:11Z and it was re-enqueued at 14:29Z), so the task is completed as pr_opened rather than parked again.
- Expectation: no further worker action. When ci: Actions check runs stuck in queued across PRs — no runner pickup since ~05:00Z 2026-10-28 #1599 clears, mcpx: configurable _meta session keys — read ai.opencode/sessionID for request identity (#1932) #2195 lands on its own; if it is ejected again, re-enqueue it (
gh pr merge 2195 --merge) — the branch and worktree ~/git/fleet/3227-1932 are intact.
- Links: PR mcpx: configurable _meta session keys — read ai.opencode/sessionID for request identity (#1932) #2195 · queue jam ci: Actions check runs stuck in queued across PRs — no runner pickup since ~05:00Z 2026-10-28 #1599
MetadataMetadataapp/mcpxPackage/app: mcpx (pkgs/ or apps/ in this repo)effort/mMedium: expected under 1 day of workenhancementNew feature or requestkind/bugSomething isn't working (prefixed form of the classic bug label)meta/enrichedIntake review done: acceptance criteria, links, and normalized labels addedpriority/normalOrdinary priority (the default)source/humanFiled directly by a human DevelopmentNo branches or pull requestsIssue actions
|