Skip to content

design(mcpx): error honesty, finished — peer errors relayed as peer errors, unadvertised methods refused, -32021 when a capability is truly required #2434

Closed
3 of 3 issues completed

Description

@dezren39

Design from the design-architect pass 16 (2026-10-29). Full design doc: files/designs/code-mcpx-error-honesty.md in the keep-the-four-repos-healthy goal workspace. Origins: conformance gap errors-local-errors-not-mistaken-for-peer (ex-nix#206) and the accept-unadvertised + 32021-broker-fallback gap keys of #1957 (ex-nix#257 — split out under its own acceptance rule, same pattern as #2192). Audited against origin/main 5a34fa70.

Problem

mcpx sits between two peers and speaks for both, but its errors do not say whose they are:

  1. A peer's failure arrives dressed as mcpx's own. Pass-through relays an upstream JSON-RPC error whole (UpstreamError, internal/mcpserver/capability.go). The gateway path flattens the same failure to text at the daemon /v1 surface, then internal/cli/serve_ask.go (~L225-255) reconstructs it by guessing at the text — with exactly one structured special case (-32021 at serve_ask.go:241). Structured data is destroyed and heuristically rebuilt. Spec (2026-07-28, lowercase should): local errors surfaced in JSON-RPC-shaped structures "should ensure they cannot be mistaken for errors received from the peer."
  2. mcpx answers methods it did not advertise. capabilities() (server.go:2410) declares completions only where the revision defines it — with the comment that completion/complete "is answered for every revision" — so a 2024-11-05 peer is served a method that cannot be advertised to it; resources/subscribe is dispatched unconditionally (server.go:938) even when resources.subscribe was advertised false. The 2026 schema's MethodNotFoundError guidance asks for -32601 for a method "gated behind a server capability the server did not advertise". The Removed() check (server.go:785) is the precedent seam; modern HTTP already pairs -32601 with 404 (modernStatus).
  3. -32021 exists only in islands. Emitted correctly by tasks missingTasks (tasks.go:199) and subscriptions/listen (listen.go:138), relayed in pass-through — but when a gateway call cannot finish without a capability the host never declared, the question waits in the broker even when no broker audience can answer it. ERR-08 (pkgs/mcpx/docs/compare/register/errors.md) + conflict Bump build/buck/preludes/buck2-prelude from 3a02ea3 to 3e4d218 #8 (docs/spec/revision-conflicts.md) already record the resolution: mcpx never requires the capability while a broker audience can answer — the complement (no audience ⇒ required ⇒ -32021) is unimplemented.

Decisions recorded

  1. One structured error carriage through the gateway. The /v1 call reply gains a structured upstream-error field (code/message/data); the gateway relays it verbatim via UpstreamError; text-reconstruction heuristics are deleted wherever the structured field is present. mcpx's OWN errors are minted through one helper that stamps error.data with an origin marker ("mcpx": {"origin": "local"}) — peer errors never gain it, local errors always carry it. That asymmetry is the "cannot be mistaken" mechanism. No new codes, no message prefixes.
  2. Dispatch consults the same map advertisement used. One gate after the Removed() check: refuse -32601 any method whose gating capability is absent/false in the capabilities() map for that peer. Initial gated set is only the two proven disagreements: completion/complete ← completions (pre-completions revisions), resources/subscribe/unsubscribe ← resources.subscribe. Accept-liberally stands for everything else; the gate's table grows by evidence. Tasks keep their own gating.
  3. -32021 exactly when waiting is not an answer. At the ask seam: question needs a capability the peer did not declare AND the broker has no audience that can answer it ⇒ modern peer gets -32021 with data.requiredCapabilities (existing shape; HTTP 400 via modernStatus); legacy keeps existing behaviour. When any audience can answer, the broker fallback is unchanged.

Phases

Open questions stay in the design doc (client-side origin marker vs #1481's choke point; prompts-validate-io deliberately excluded — it neighbours #1481, not this seam; gated-set growth needs evidence; ERR-09/ERR-13 belong to #2209's classification, not absorbed here).

🤖 Design-architect pass 16 — agent note: this issue is the design of record; phases are its sub-issues. Do not re-derive the decisions above in triage; flag genuine blockers here instead.

Acceptance criteria

Activity

  1. added
    priority/normalOrdinary priority (the default)
    app/mcpxPackage/app: mcpx (pkgs/ or apps/ in this repo)
    epicMeta-issue grouping multiple items (org Project Type=Epic)
    on Oct 29, 2026
  2. developing-today commented on Oct 29, 2026

    @developing-today
    Contributor
  3. added
    effort/lLarge: multi-day or open-ended; expect staged check-ins
    kind/designA design proposal (design-architect): multi-step, phased, decision-bearing
    on Oct 29, 2026
  4. dezren39 commented on Oct 29, 2026

    @dezren39
    MemberAuthor

    🤖 agent-note:v1 — design-architect pass 16 (2026-10-29). Design of record for the error-honesty cluster: origins are the conformance gap errors-local-errors-not-mistaken-for-peer (ex-nix#206) and #1957's accept-unadvertised + 32021-broker-fallback keys, split out under #1957's own acceptance rule. Phases: #2435 (structured carriage + origin marker, pilot task 3646 queued), #2436 (advertised-capability gate, pilot task 3647 queued), #2438 (Phase 3: -32021 when no broker audience can answer + truth-up, gated on #2435, pilot task 3648 queued). All three linked as sub-issues and verified. No user/review: the spec rows and ERR-08/conflict #8 already record the ends; the judgment calls are the architect's, recorded in the design doc.

  5. added
    meta/enrichedIntake review done: acceptance criteria, links, and normalized labels added
    on Oct 30, 2026
  6. dezren39 commented on Oct 30, 2026

    @dezren39
    MemberAuthor

    Intake review (fleet monitor, 2026-10-29 run):

  7. 11 remaining items

  8. dezren39 commented on Nov 4, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    event: triaged
    task: 7917
    worker: repo-worker-code (OpenChamber scheduled lane 8ac61616-3815-4e7b-b33d-840a3829154a)
    checked: 2026-11-04 at current main origin/main@85c0e0b89
    verdict: STILL LIVE; keep #2434 open under its own acceptance criteria.
    evidence:

  9. developing-today commented on Nov 8, 2026

    @developing-today
    Contributor

    🤖 Agent note · done — triaged, CONFIRMED live; remainder is its two open phase issues, already tracked

  10. dezren39 commented on Nov 8, 2026

    @dezren39
    MemberAuthor

    Partial verification — staying open (2026-11-07 done-task-only audit, tracking: #7016).

    Queue task(s) [7917] were marked done, and some work did land:

    No merged change closes this issue's full scope, so the done status is not treated as completion. Remainder re-queued as triage task 11643.

  11. dezren39 commented on Nov 17, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · triaged

  12. dezren39 commented on Nov 17, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · triaged — CONFIRMED still live; remainder is Phase 3 issue #2438 steps 3–4, now routed as task 20711

  13. removed their assignment
    on Nov 20, 2026
  14. dezren39 commented on Nov 22, 2026

    @dezren39
    MemberAuthor

    All three planned phases have landed: phase 1 #9038, phase 2 #2873, phase 3 implementation #10720 + #10771, and phase-3 register truth-up #12308. Evidence comments are on #1957 and the verified origin dezren39/darwin-nix#206. Closing the completed design issue.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    app/mcpxPackage/app: mcpx (pkgs/ or apps/ in this repo)effort/lLarge: multi-day or open-ended; expect staged check-insepicMeta-issue grouping multiple items (org Project Type=Epic)epic/mcpx-platformReprioritization program epic (2026-11-12)kind/designA design proposal (design-architect): multi-step, phased, decision-bearingmeta/enrichedIntake review done: acceptance criteria, links, and normalized labels addedpriority/normalOrdinary priority (the default)source/design-architectFiled by the repo design architect jobstatus/triagedTriaged and routed (see agent note)status:donetask/triageQueue packet kind: verify, reproduce, and route this item

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions