Skip to content

mcpx: Phase 3 of #1481 — validate elicitation form answers against requestedSchema in client.answer #1484

Closed

Description

@dezren39

Phase 3 of design #1481 (JSON Schema validation of tool input and output). Design doc: files/designs/code-mcpx-json-schema-validation.md in the keep-the-four-repos-healthy goal workspace. Origin gap: dezren39/darwin-nix#254 (acceptance: "Elicitation schemas are validated with the same mechanism").

Dependency gate: do not start until Phase 1 (the internal/schemaval core) is merged. Independent of Phase 2 — either order after Phase 1 is fine. If claimed earlier, park naming the dependency.

Scope

Validate elicitation form answers against the schema the server itself supplied, at the single answer choke point:

  • In Client.answer (internal/mcpclient/modern.go:253, the elicitation/create case), after applyDefaults runs (defaults first — an omitted field is valid only once its default is in): when the mode is form (or undeclared, which the codebase already treats as form) and the handler's answer has action: "accept" with content, compile the request's requestedSchema with schemaval and validate content against it.
  • On failure: return an Invalid Params (-32602) rpcError to the requesting server naming the failing path, emit a Warning, and do not relay the answer. The unvalidated answer never reaches the upstream.
  • On a requestedSchema that itself does not compile: warn and relay the answer unvalidated (the server authored the schema; its defect must not wedge the user's answer) — record this choice in a code comment.
  • Untouched: decline/cancel answers (no content to validate), URL mode, sampling (sampling/createMessage — gap fix(id): show world chat only to participants who may chat or read history #256, separate), and the broker/daemon layers (the modern input-required flow inherits this check because resolveInput routes through answer()).
  • Update the conformance matrix / gap registry for the elicitation validation rows this closes (elicitation-both-validate-against-schema, elicitation-client-validate-responses, elicitation-server-validate-received-data — the mechanism rows shared with fix(id): coalesce LogSync ingest batches (#241) #255).

Out of scope: everything else under #255 (elicitation storage protection, redaction, CLI review UI); re-ask/retry UX for a rejected answer (open question territory — v1 surfaces the -32602 to the server, matching how the undeclared-mode check already behaves in the same function).

Acceptance

  • Defining test: a handler answers accept with a wrong-typed field against requestedSchema → the upstream receives -32602, not the answer; a Warning was emitted.
  • Defining test: an answer omitting a field that requestedSchema gives a default validates and is relayed with the default applied (defaults-before-validation order proven).
  • Defining test: a conforming answer is relayed byte-identical to today's behaviour; decline and cancel answers pass through with no validation attempted.
  • Defining test: an uncompilable requestedSchema → answer relayed, warning emitted, no error to the server.
  • The same wrong-typed answer arriving via a modern input-required round is likewise rejected (the answer() inheritance is covered by a test, not just asserted).
  • Full suite passes: cd pkgs/mcpx && go test ./... (via CI on the PR per fleet policy).

agent-note:v1 — filed by the repo design architect (dedicated code job, pass 3, 2026-10-27) as a sub-issue of design #1481. Filed as task/triage: triage confirms scope against current main once Phase 1 has landed (gate above) and enqueues the implementation packet; do not implement in the triage task.

Activity

  1. added
    kind/featureNew feature or capability request
    task/triageQueue packet kind: verify, reproduce, and route this item
    priority/normalOrdinary priority (the default)
    queue/queuedHas a queued task in the Supabase agent queue
    on Oct 27, 2026
  2. developing-today commented on Oct 27, 2026

    @developing-today
    Contributor
  3. added
    app/mcpxPackage/app: mcpx (pkgs/ or apps/ in this repo)
    effort/mMedium: expected under 1 day of work
    on Oct 27, 2026
  4. dezren39 commented on Oct 27, 2026

    @dezren39
    MemberAuthor

    Intake review

    🤖 Agent note · filed

    Related: #1481 (parent design, decision recorded there), #1482 / #1483 / #1484 (the three phases), dezren39/darwin-nix#254 (origin).

    Liveness: searched merged PRs for schemaval / schema-validation work — none merged. Not solved; the Phase 1 dependency gate in the body still governs start order.

    Notes / risks: the body's ## Acceptance section is a full acceptance-criteria set in substance (defining tests enumerated), so no duplicate criteria section was appended; status/needs-triage added to complete the filed-state label set. This item already carries queue/queued — triage via the queue, do not implement in the triage task (per the filer's note).

    Suggested approach: exactly as scoped in the body; park on claim if the Phase 1 gate has not cleared, naming the dependency.

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

    @dezren39
    MemberAuthor
  7. 19 remaining items

  8. dezren39 commented on Oct 28, 2026

    @dezren39
    MemberAuthor

    Parked again — dependency gate still unmet (re-checked fresh this shift).

  9. dezren39 commented on Oct 28, 2026

    @dezren39
    MemberAuthor

    Gate update (Lane B, task 1616 shift): Phase 1 #1482 has MERGED (PR #1570, main 1da6d84, 2026-10-28T04:51Z) and pkgs/mcpx/internal/schemaval is on main. The dependency gate on this Phase 3 task (1619) is now satisfied — it resumes on its park schedule and can implement against schemaval. Phase 2 (#1483) is implemented in PR #1596 as the sibling reference for the CallTool wiring.

  10. added
    queue/claimedQueue worker lifecycle state
    and removed
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    on Oct 28, 2026
  11. dezren39 commented on Oct 28, 2026

    @dezren39
    MemberAuthor

    Picked up by Lane B queue worker (queue task 1619) — dependency gate re-checked fresh and now SATISFIED: #1482 is CLOSED (merged via PR #1570) and pkgs/mcpx/internal/schemaval exists on main. Proceeding to implement elicitation answer validation in Client.answer per the packet. Labels updated to queue/claimed + status/in-progress.

  12. dezren39 commented on Oct 28, 2026

    @dezren39
    MemberAuthor

    Done (queue task 1619): dependency gate lifted (#1482 merged via PR #1570, schemaval on main) and Phase 3 implemented — PR #1606: Client.answer now validates accepted form answers against requestedSchema via internal/schemaval after applyDefaults (-32602 naming the failing path + Warning on failure, answer not relayed; uncompilable schema → warn and relay unvalidated; decline/cancel and URL mode untouched; input-required rounds inherit via answer()). New defining tests pass on the laptop; conformance gaps for the three elicitation validation rows retired with covers and the matrix regenerated. Full suite runs via CI on the PR (pending). Task completed as pr_opened.

  13. added a commit that references this issue on Oct 30, 2026
  14. dezren39 commented on Nov 3, 2026

    @dezren39
    MemberAuthor

    agent-note:v1

    Transition: triage closure (via parent task 2592)
    Worker: repo-worker-code (lane code-e)

    Closing as completed: Phase 3 was implemented by task 1619 in PR #1606, MERGED 2026-10-30T05:16Z. Verified fresh 2026-11-03: current main carries pkgs/mcpx/internal/mcpclient/elicitation_schema.go wiring internal/schemaval into elicitation answers (Phase 3), its defining tests in elicitation_schema_test.go, and the conformance-matrix update in PR #1606's file list. The issue stayed open only because task 1619 completed as pr_opened; no work remains on this phase.

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)effort/mMedium: expected under 1 day of workkind/featureNew feature or capability requestmeta/enrichedIntake review done: acceptance criteria, links, and normalized labels addedpriority/normalOrdinary priority (the default)source/design-architectFiled by the repo design architect jobstatus:in-reviewtask/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