Found while reviewing #8.
src/daemon/remote-client.ts:145-151:
function isSessionNotFound(err: unknown): boolean {
if (!err || typeof err !== 'object') return false;
const code = (err as {code?: unknown}).code;
return code === 404;
}
This relies on the SDK's StreamableHTTPError.code being the HTTP status. If the SDK ever changes that field — e.g. to the JSON-RPC error code (-32001) or wraps the error in another type — the retry path silently regresses and users see a raw "Session not found" instead of the transparent reconnect that sticky sessions are designed to deliver.
The current test fixture matches this exact shape so a regression wouldn't be caught.
Suggested fix:
import {StreamableHTTPError} from '@modelcontextprotocol/sdk/client/streamableHttp.js';
function isSessionNotFound(err: unknown): boolean {
if (err instanceof StreamableHTTPError) {
return err.code === 404 || /Session not found/i.test(err.message);
}
return false;
}
Add a test case where the server returns a JSON-RPC -32001 envelope without an HTTP 404 so this contract is locked in.
Found while reviewing #8.
src/daemon/remote-client.ts:145-151:This relies on the SDK's
StreamableHTTPError.codebeing the HTTP status. If the SDK ever changes that field — e.g. to the JSON-RPC error code (-32001) or wraps the error in another type — the retry path silently regresses and users see a raw "Session not found" instead of the transparent reconnect that sticky sessions are designed to deliver.The current test fixture matches this exact shape so a regression wouldn't be caught.
Suggested fix:
Add a test case where the server returns a JSON-RPC
-32001envelope without an HTTP 404 so this contract is locked in.