Skip to content

mcpx: /v1/exec leaves session-scoped servers running, /mcp never rebuilds its surface, /v1/protocol reports the default nativeElicit, stats reads one opencode database #1942

Closed

Description

@dezren39

Relocated from dezren39/darwin-nix#219 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

Four daemon-state defects. /v1/exec never marks its runs ephemeral, so session-scoped instances (a browser) are not released at the end of the run and wait for idle reaping; the CLI path sets MCPX_EPHEMERAL (read from code, not driven). The MCP surface is built once under a sync.Once and never rebuilt, so adapters added later are invisible, and a failed first build is cached for the daemon's life. /v1/protocol reports nativeElicit from the compiled default rather than the effective setting. mcpx stats opencode looks only for opencode.db, while both opencodes choose the filename by release channel.

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
PM-12 /v1/exec session-scoped instances outlive the run ✗ — never marked ephemeral; waits for idle reap S
PM-13 MCP surface built once per daemon, never rebuilt ✗ — sync.Once; new adapters invisible S
PM-15 /v1/protocol reports nativeElicit from the default ✗ — compiled default, not the setting S
PM-21 opencode database filename depends on release channel ✗ — mcpx stats opencode reads opencode.db only S

Evidence

internal/execsvc/execsvc.go:573-593 vs internal/cli/commands.go:694; internal/cli/serve_ask.go:234-254; internal/daemon/routes_proto.go:530 (the comment at :495-497 says it cannot disagree); v1:packages/core/src/database/database.ts:49, v2:packages/cli/src/database-path.ts:7.

What to do

One change each; the ephemeral release needs a test that fails today.

Ease · Impact · Related

Ease S · Impact med · Related: #78 (daemon state and caches), #189

Acceptance criteria

  • /v1/exec runs are marked ephemeral, so session-scoped instances are released at the end of the run instead of waiting for idle reaping (PM-12).
  • The MCP surface is rebuilt when adapters/servers change; a failed first build is not cached for the daemon's life (PM-13).
  • /v1/protocol reports the effective nativeElicit setting, not the compiled default.
  • mcpx stats opencode finds the opencode database filename for the installed release channel, not only opencode.db.
  • Regression tests cover each of the four defects.

Activity

  1. developing-today commented on Oct 28, 2026

    @developing-today
    Contributor
  2. dezren39 commented on Oct 28, 2026

    @dezren39
    MemberAuthor

    History carried over from dezren39/darwin-nix#219 (verbatim, oldest first):


    @dezren39 · 2026-10-28T04:30:11Z

    🤖 Intake review — fleet monitor, 2026-10-27 run

    • Related: parent tracker Phase 3: sync, blob gate, and relays #181; register rows PM-12/PM-13 plus the protocol/stats rows in pkgs/mcpx/docs/compare/register/process-model.md.
    • 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: four independent defects in one issue — slice them; the surface-rebuild change (PM-13) is the only one with concurrency risk.
    • Suggested approach: fix and test each defect as its own commit; the stats filename and protocol-report fixes are near-trivial.
  3. added
    bugSomething isn't working
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    source/humanFiled directly by a human
    priority/normalOrdinary priority (the default)
    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)
    queue/queuedHas a queued task in the Supabase agent queue
    on Oct 28, 2026
  4. added
    work/assignedQueue worker lifecycle state
    and removed
    queue/queuedHas a queued task in the Supabase agent queue
    on Oct 29, 2026
  5. 51 remaining items

  6. dezren39 commented on Oct 30, 2026

    @dezren39
    MemberAuthor

    Agent note — picked up (resume)

  7. added a commit that references this issue on Oct 30, 2026
  8. dezren39 commented on Oct 30, 2026

    @dezren39
    MemberAuthor

    Agent note — done (queue task 3243)

  9. dezren39 commented on Oct 30, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done

  10. dezren39 commented on Nov 3, 2026

    @dezren39
    MemberAuthor

    Triage verdict: all four defects are fixed at current main — closing with evidence (d3476bce7, 2026-11-03)

    Checked against the code, not the packet: every acceptance criterion is satisfied, with a regression test per defect, and the tests pass on current main today.

    Row Fix at current main Regression test
    PM-12 /v1/exec never marked runs ephemeral internal/execsvc/execsvc.go:1115-1130 — scriptEnv sets MCPX_EPHEMERAL unless the caller named a session, so exec-<runID> instances are released at run end instead of waiting for idle reaping internal/execsvc/ephemeral_internal_test.go (passes)
    PM-13 MCP surface built once under sync.Once internal/cli/serve_ask.go:347-430 — surface rebuilt when its declared inputs change; a failed first build is not cached; replaced surfaces are retired (internal/mcpserver/server.go:2327) internal/cli/lazymcp_test.go (3 cases, pass)
    PM-15 /v1/protocol reported the compiled default internal/daemon/routes_proto.go:802 reports s.set.Bool("proto.native"), i.e. the setting in force (and the daemon reads set per request, so PUT /v1/settings reaches it) internal/e2e/conflicts2_test.go — TestProtocolReportsTheSettingInForce (passes)
    PM-21 mcpx stats opencode read only opencode.db internal/opencode/opencode.go:38-95 — resolves the channel filename set (opencode.db for v1 latest/beta/prod, opencode-<channel>.db for v2 dev/next/…), plain path as fallback internal/opencode/paths_test.go (passes)

    Vehicles: PR #2625 (merged 2026-10-30T11:13:37Z, "fix remaining #1942 daemon-state defects — ephemeral exec runs, MCP surface rebuild, opencode channel DBs") and the follow-up 11551b8df (retire replaced MCP surface sessions; keep shared daemon PID out of ephemeral ownership).

    Tests re-run today on current main (all pass):

    • go test ./internal/execsvc ./internal/opencode ./internal/cli — ok
    • go test ./internal/e2e -run TestProtocolReportsTheSettingInForce — ok

    Register note: the compare register's status column is explicitly pinned to mcpx @ 05c78b2, so its ✗ cells are a dated snapshot, not a live claim — PM-15 in particular was already correct at the repo-migration commit (a03494f30). No doc change is owed by this issue; if a register truth-up is wanted it belongs to the truth-up work tracked under #1837/#1834 phase 3, not here.

    🤖 Agent note · state: done (closed)

  11. added
    queue/queuedHas a queued task in the Supabase agent queue
    task/triageQueue packet kind: verify, reproduce, and route this item
    on Nov 3, 2026
  12. dezren39 commented on Nov 3, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    state: triaged (coverage pass)
    Coverage pass 2026-11-03: reviewed in the fleet-wide per-issue pass (drift / overlap / already-handled / stale / blockers / ordering). Verdict: still live; queued in repo-health-code-pilot as triage at priority 40 (priority/normal). If this is already handled at current main, the triage closes it with evidence; if it needs splitting, the triage files the split.
    Found via: coverage pass 2026-11-03

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

app/mcpxPackage/app: mcpx (pkgs/ or apps/ in this repo)bugSomething isn't workingeffort/mMedium: expected under 1 day of workkind/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)queue/queuedHas a queued task in the Supabase agent queuesource/humanFiled directly by a humanstatus/needs-triageNot yet triaged; needs a first looktask/triageQueue packet kind: verify, reproduce, and route this item

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions