mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 10:53:59 +00:00
fix(mcp): bound panel requests, request bodies and cancelled calls
Panels on one MCP server share six requests in flight; further requests wait their turn (up to 256 waiting) instead of failing, and a waiting request leaves the queue when its caller cancels. Held responses belong to their own MCP server rather than to the process. /mcp request bodies must arrive within 30 seconds. Over stdio, a client's notifications/cancelled aborts the named request, which then gets no response. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
1 parent
fec93aa817
commit
857767842f
6 files changed
+310
-32
No files matched your search
@@ -171,3 +171,43 @@ test("only the key in the server's own panel page opens panel requests", async (
|
||||
});
|
||||
assert.doesNotMatch(otherPage.result.contents[0].text, new RegExp(key));
|
||||
});
|
||||
|
||||
test('a request the client cancels over stdio is aborted and gets no answer', async () => {
|
||||
let seen;
|
||||
const server = {
|
||||
handle: (message, { signal } = {}) => {
|
||||
if (message.id === 1) {
|
||||
seen = signal;
|
||||
return new Promise((resolve) =>
|
||||
signal.addEventListener(
|
||||
'abort',
|
||||
() => resolve({ jsonrpc: '2.0', id: 1, result: {} }),
|
||||
{ once: true },
|
||||
),
|
||||
);
|
||||
}
|
||||
return Promise.resolve(
|
||||
message.id === undefined
|
||||
? null
|
||||
: { jsonrpc: '2.0', id: message.id, result: {} },
|
||||
);
|
||||
},
|
||||
};
|
||||
const input = new PassThrough();
|
||||
const output = new PassThrough();
|
||||
let written = '';
|
||||
output.on('data', (chunk) => (written += chunk));
|
||||
const served = serveStdio(server, { input, output });
|
||||
input.write('{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{}}\n');
|
||||
input.write('{"jsonrpc":"2.0","id":2,"method":"ping"}\n');
|
||||
input.end(
|
||||
'{"jsonrpc":"2.0","method":"notifications/cancelled","params":{"requestId":1}}\n',
|
||||
);
|
||||
await served;
|
||||
assert.equal(seen.aborted, true);
|
||||
const ids = written
|
||||
.trim()
|
||||
.split('\n')
|
||||
.map((line) => JSON.parse(line).id);
|
||||
assert.deepEqual(ids, [2]);
|
||||
});
|
||||
Reference in new issue
Block a user