Skip to content

mcpx: typed sampling errors — -1 on rejection, expiry stays -32603 (#1835) - #2440

Merged
dezren39 merged 1 commit into
mainfrom
queue/3050-1835-typed-sampling-errors
Oct 30, 2026
Merged

dezren39 merged 1 commit into
mainfrom
queue/3050-1835-typed-sampling-errors

Conversation

@dezren39

@dezren39 dezren39 commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Fixes #1835 — Phase 1 of #1834 (typed sampling errors), per triage task 2718. Queue task 3050.

What changed

Tests

  • mcpclient: typed passthrough through both Client.answer caller paths (legacy wire request and modern input_required), wrapped-error (%w) recognition, tool-shape -32602 passthrough, untyped stays -32603.
  • daemon: decline → -1 naming decline; cancel → -1 naming cancel; synthesized expiry answer → -32603 naming expiry.
  • conformance: new row for sampling-client-errors-user-rejected-and-tool-shape asserting -1 (passes under MCPX_CONFORMANCE_RUN_GAPS=1); the gap is reworded to only the -32602 content half for Phase 2 (mcpx: Phase 2 of #1834 — sampling message + result validation at the broker (pairing, era shape, no silent fill-in) #1836), and docs/spec/conformance-matrix.md regenerated.

Targeted tests pass on the laptop (go test ./internal/mcpclient/ -run TestSamplingTypedErrors|TestSamplingDeclarations|TestModernSamplingShape, go test ./internal/daemon/ -run TestSampleViaBrokerTypedErrors, conformance row + TestMatrix after regeneration). Full suite verification is CI's job on this PR.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

…1835)

Phase 1 of #1834. Adds mcpclient.CodedError (exported, errors.As-recognised) with UserRejectedError (-1), ToolShapeError (-32602, for Phase 2 #1836) and InternalError (-32603) constructors next to rpcError. sampleViaBroker returns typed -1 naming the action for a real decline/cancel and typed -32603 naming expiry for the broker-synthesized expiry answer (By==expiry checked first). Client.answer relays a typed handler code instead of flattening to -32603; untyped errors keep the -32603 wrap. Tests cover both Client.answer caller paths (legacy wire + modern input_required), the broker decline/cancel/expiry split, and a conformance row for the -1 half; the conformance gap is reworded to the -32602 content half only (#1836) and the matrix regenerated.
@dezren39
dezren39 requested a review from a team as a code owner October 29, 2026 21:43
@coderabbitai

coderabbitai Bot commented Oct 29, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 18 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b8bdc309-2051-433e-b0fb-1d6e5262cd12
Commits

Reviewing files that changed from the base of the PR and between 5a34fa7 and 8e5c00d.

Files selected for processing: 8
  • pkgs/mcpx/docs/spec/conformance-matrix.md
  • pkgs/mcpx/internal/conformance/clientfeatures_test.go
  • pkgs/mcpx/internal/conformance/coverage_clientfeatures.go
  • pkgs/mcpx/internal/daemon/hooks.go
  • pkgs/mcpx/internal/daemon/hooks_sampling_test.go
  • pkgs/mcpx/internal/mcpclient/client.go
  • pkgs/mcpx/internal/mcpclient/modern.go
  • pkgs/mcpx/internal/mcpclient/sampling_typed_errors_test.go
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@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 ✅ Completed 2026-10-29T21:45:09.413370Z 8e5c00d PR opened
ℹ️ 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.

@dezren39 dezren39 added queue/needs-review Queue task finished and is awaiting review status/needs-review Ready for review work/assigned Queue worker lifecycle state labels Oct 29, 2026
@dezren39 dezren39 added queue/parked Queue task is parked (waiting on CI, time, or an event) status/parked Deliberately paused with a recorded resume condition and removed status/needs-review Ready for review queue/needs-review Queue task finished and is awaiting review labels Oct 29, 2026
@dezren39

Copy link
Copy Markdown
Member Author

🤖 Agent note · parked

@dezren39
dezren39 added this pull request to the merge queue Oct 29, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to Branch Protection failures Oct 29, 2026
You're not authorized to push to this branch. Visit "About protected branches" for more information.
@dezren39
dezren39 added this pull request to the merge queue Oct 30, 2026
Merged via the queue into main with commit 1ddc772 Oct 30, 2026
8 checks passed
@dezren39
dezren39 deleted the queue/3050-1835-typed-sampling-errors branch October 30, 2026 00:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

queue/parked Queue task is parked (waiting on CI, time, or an event) status/parked Deliberately paused with a recorded resume condition work/assigned Queue worker lifecycle state

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mcpx: Phase 1 of #1834 — typed sampling errors (-1 on rejection, -32602 tool-shape, expiry stays -32603)

1 participant