Repository navigation
Commit 07d94ee
committed
fix: late peer-cancel cannot double-respond; mcpserver completion gets typed params
JSONRPCDispatcher._handle_request: pop from _in_flight in the inner
finally (right after the handler returns, before _write_result). No
checkpoint between handler return and pop, so a late
notifications/cancelled finds nothing and is a no-op; scope.cancel_called
is only true if the cancel landed during the handler. Previously a cancel
arriving during _write_result's checkpoint after the result was buffered
would send both the result and a code=0 "Request cancelled" for the
same id.
mcpserver/server.py: register completion/complete via
add_request_handler with CompleteRequestParams (was the legacy
_add_request_handler which defaulted params_type=RequestParams, so the
handler got base RequestParams and params.ref AttributeErrored). Delete
_add_request_handler (last caller).1 parent fa20352 commit 07d94ee
3 files changed
Lines changed: 14 additions & 24 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
272 | 272 | | |
273 | 273 | | |
274 | 274 | | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | 275 | | |
285 | 276 | | |
286 | 277 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
607 | 607 | | |
608 | 608 | | |
609 | 609 | | |
610 | | - | |
611 | | - | |
612 | | - | |
613 | | - | |
614 | | - | |
| 610 | + | |
615 | 611 | | |
616 | 612 | | |
617 | 613 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
565 | 565 | | |
566 | 566 | | |
567 | 567 | | |
568 | | - | |
569 | | - | |
570 | | - | |
571 | | - | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
572 | 575 | | |
| 576 | + | |
573 | 577 | | |
574 | 578 | | |
575 | | - | |
576 | | - | |
577 | | - | |
578 | | - | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
579 | 583 | | |
580 | | - | |
581 | | - | |
| 584 | + | |
582 | 585 | | |
583 | 586 | | |
584 | 587 | | |
| |||
0 commit comments