Skip to content

fix(mcp): preserve input validation issue attribution - #7981

Merged
morluto merged 10 commits into
mainfrom
codex/sdk-input-attribution-7661
Oct 29, 2026
Merged

morluto merged 10 commits into
mainfrom
codex/sdk-input-attribution-7661

Conversation

@morluto

@morluto morluto commented Oct 29, 2026 •

Copy link
Copy Markdown
Owner

Problem and change

Fixes #7661. SDK validation errors could replace rejected field paths with a root issue, including for concurrent requests. Request-scoped validation facts now preserve the field-level issues for the matching response. Projection is charged before allocating nested and repeated paths; when the detail allowance is exhausted, the result explicitly reports omitted field detail and retains the SDK diagnostic.

This addresses ordinary input diagnostics, which #7905 explicitly leaves outside its input-admission scope. The SDK still constructs its own validation issues before this projection; the allowance is not a process-memory cap.

Validation

  • 33 focused source, in-memory MCP, production stdio, oversized-error and deferred-server tests passed on macOS with Node 24.22.1, including concurrent calls and a 256-branch union capacity case.
  • npm run check:fast, npm run docs:check, and git diff --check passed. Independent review identified and verified fixes for nested and repeated-path accounting.
  • Cancellation and transport-close scoping were source-audited but not directly exercised in a new transport regression. No native provider was needed.

Review follow-up: the fallback retains the SDK diagnostic once and records omitted field detail as a structured fact. The tests compare the full diagnostic against an unwrapped SDK response, cover a long unknown key, and assert exact concurrent issue lists. The branch includes current main; 33 focused tests, check:fast, format:check, and git diff --check passed. Independent review found no further material issue.

CI follow-up: four MCP tests that asserted the prior flattened SDK errors now check the structured issue paths and reasons. All 24 affected tests, check:fast, and git diff --check passed; independent review confirmed the existing failure and provider-launch controls remain.

Additional CI follow-up: the browser-scenario full and compact MCP assertions now check the structured path, reason and bound instead of the old flattened diagnostic. Both cases, check:fast, and git diff --check passed; independent source review confirmed the CLI and MCP controls remain.

CI follow-up on 5ffd64410: SDK diagnostic fragments are attached to their producing issue or retained in the residual summary once, including mixed custom and expanded union cases; the complete diagnostic is not always one contiguous string. Source-aligned projection avoids misattribution when union and sibling issues share a path. Fifty-two focused tests, check:fast, docs:check, and format:check passed. Independent source review found no further concrete defect.

Author readiness

Human owner: @morluto

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-29T07:32:08.857868Z
We couldn’t complete this review. Comment @codex review to try again.
108359e New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@greptile-apps

greptile-apps Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5 Tier: apex

[Medium impact] The PR appears safe to merge; no new blocking issue was found.

Summary

Preserves rejected field paths and constraints in SDK input errors, with separate validation facts for each request.

  • MCP input errors now point to the fields that failed.

git diff --check passed. Tests were not run because dependencies are absent. Live PR supersession could not be checked because GitHub authentication was unavailable.

Diagram

sequenceDiagram
  participant Client
  participant Transport as ErrorEvidenceTransport
  participant SDK
  participant Schema
  Client->>Transport: tools/call with request ID
  Transport->>SDK: Dispatch with a separate validation context
  SDK->>Schema: Validate arguments
  Schema-->>SDK: Return issues and capture them for this call
  SDK->>Transport: Return validation error
  Transport->>Transport: Bound field detail and place SDK explanations
  Transport-->>Client: Field error or bounded recovery response
Loading

Reviews (6) · Last reviewed commit: "merge: integrate main into SDK input att..." · Reviewed by Greptile

Comment thread src/server/EvidenceMcpServerCore.ts Resolved
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@morluto
morluto merged commit 17ceb77 into main Oct 29, 2026
39 of 42 checks passed
@morluto
morluto deleted the codex/sdk-input-attribution-7661 branch October 29, 2026 07:39
Entrpi added a commit to Entrpi/rea that referenced this pull request Oct 29, 2026
morluto#7905 bounds MCP arguments at 1,024 elements by default, which two inline
ESP flash-dump inventories exceed, so the ESP flash comparison test now
compares the Evidence its session retained. morluto#7981 reports an input issue at
its field path with zod's reason, so the Rizin decoder-input refusal is
`invalid_format` at `asm_cpu`.
@morluto morluto added area: mcp MCP server, transport, and tool registration bug Something isn't working labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: mcp MCP server, transport, and tool registration bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] MCP input-error normalization replaces rejected field paths with one root issue

2 participants