fix(mcp): a close cuts a request that never finishes arriving, so a stalled client can't hold a book open
A client that begins an upload or an MCP POST and stops sending is inside the book's door, and the close waited for it with no bound. Now, when the close's answer grace runs out, every request inside whose body has not been read to its end is cut: connection closed, an upload's part file removed by receive's read error, the access record (written before the answer) says cut_by_close. A body read to its end is whole and never cut, so a running call still finishes. Nothing of an MCP call can be journaled by a cut: rmcp reads the whole body (expect_json) before any message reaches a session or tool, and the handler checks for the cut again before binding a session. Holds for a book's close, a restore over an open book (Books::release) and the server's close. The restore-waits test now uses a grace longer than its 5 s watch: an upload finishing within the grace is still waited for. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1332c2a576
commit
ce636adbb5
5 files changed
+554
-10
No files matched your search
@@ -120,6 +120,8 @@ pub(crate) const UNAUTHORIZED: &str = "unauthorized";
|
||||
pub(crate) const INSUFFICIENT_SCOPE: &str = "insufficient_scope";
|
||||
/// The books were closing.
|
||||
pub(crate) const CLOSING: &str = "closing";
|
||||
/// A close cut the request while its body was still arriving.
|
||||
pub(crate) const CUT: &str = "cut_by_close";
|
||||
/// The server had stopped.
|
||||
pub(crate) const STOPPED: &str = "stopped";
|
||||
/// A file's bytes or text came as an argument (D-46).
|
||||
|
||||
Reference in new issue
Block a user