Commit 761500d
committed
Tighten dispatcher abandon-path writes and response invariants
- Bound the timeout-path courtesy cancel like the other abandon writes and
extract a single _final_write policy: 5s for courtesy cancels, 1s for
shutdown responses so closing a session stays fast on a wedged transport
- Answer shutdown-interrupted requests with CONNECTION_CLOSED and retire the
REQUEST_CANCELLED constant (-32002 collides with resource-not-found)
- Key the peer-cancel error response on cancelled_caught so a cancel landing
after the handler finished cannot produce a second answer for the same id
- Decide outbound metadata and cancel-on-abandon suppression in one place:
only resumption hints that actually reach the transport suppress the
courtesy cancel
- Never send notifications/cancelled for a request whose write never completed
- Identity-guard the in-flight pop so a finished handler cannot evict a newer
entry that reused its request id
- Map request-write stream failures to MCPError(CONNECTION_CLOSED); warn when
a bounded final write gives up; mark the Dispatcher lifecycle provisional1 parent a51357c commit 761500d
5 files changed
Lines changed: 784 additions & 94 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
65 | | - | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
66 | 69 | | |
67 | 70 | | |
68 | 71 | | |
| |||
197 | 200 | | |
198 | 201 | | |
199 | 202 | | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
200 | 207 | | |
201 | 208 | | |
202 | 209 | | |
| |||
0 commit comments