[Bug]: Plugin HTTP client swallows response-body transport failures
Issue Origin
Observed or reproduced in a real environment
Bug Description
createOvHttp in examples/memory-plugin-shared/lib/ov-http.mjs catches every response.json() failure as an invalid/empty body. When a real HTTP server has already sent 200 headers and then stalls or resets during the body, this swallows the request's abort or transport failure.
The default mode returns { ok: true, status: 200, result: {} }. With requireJsonBody: true, it instead returns a non-retryable status-200 empty or invalid JSON response failure. Both lose the existing transport-failure contract (ok: false, status: 0), and isRetryableFailure returns false. The shared hook runtime and capture clients use this HTTP owner, so the incorrect classification can suppress their existing retry path.
Steps to Reproduce
Run the following from the repository root on main d9352f2a8bac78cbf4ed08b26543d22adcdd4c93 with Node 24.21.0:
import { createServer } from "node:http";
import { createOvHttp } from "./examples/memory-plugin-shared/lib/ov-http.mjs";
import { isRetryableFailure } from "./examples/memory-plugin-shared/lib/retryable.mjs";
const server = createServer((_req, res) => {
res.writeHead(200, { "Content-Type": "application/json" });
res.flushHeaders();
res.write('{"status":"ok","result":');
// Leave the body unfinished. For the reset variant, destroy it after 30 ms.
});
await new Promise(resolve => server.listen(0, "127.0.0.1", resolve));
try {
for (const requireJsonBody of [false, true]) {
const fetchJSON = createOvHttp({
baseUrl: `http://127.0.0.1:${server.address().port}`,
}, { defaultTimeoutMs: 1000, requireJsonBody });
const result = await fetchJSON("/health");
console.log({ requireJsonBody, result, retryable: isRetryableFailure(result) });
}
} finally {
server.closeAllConnections();
await new Promise(resolve => server.close(resolve));
}
The same misclassification occurs when the response sends that prefix and then calls res.destroy() after 30 ms.
Expected Behavior
Preserve body-read transport failures through the existing outer error handler: ok: false, status: 0, result: null, and retryable. When the owned timeout aborts the read, preserve its existing error.name: "AbortError" / error.aborted: true fields.
Keep the current default/strict treatment of complete malformed or empty JSON, normal success and HTTP/server error envelopes. A syntax error in a completed body is distinct from a timeout or broken stream while reading it. No new timeout, queue, configuration or protocol semantics are proposed.
Actual Behavior
After the timeout or connection reset, the default mode reports success with an empty result; strict JSON mode reports a non-retryable status-200 parse failure.
Minimal Reproducible Example
The code above uses real loopback HTTP, Node's actual fetch and a partial response body. It requires no OpenViking deployment or provider credentials.
OpenViking Version
Source main d9352f2a8bac78cbf4ed08b26543d22adcdd4c93
Python Version
Not applicable: JavaScript plugin HTTP client.
Operating System
Windows, Node 24.21.0
Model Backend
Other / not used
Additional Context
Local observations include both default and strict JSON modes, body timeout and connection reset, and complete normal/invalid/empty JSON plus HTTP 503 controls. This is a client transport reproduction, not a live host session, server deployment, model inference or performance measurement. The related #4739/#4741 is MCP proxy error-code mapping, while #5467 and #5275 concern cumulative host-request budgets; they do not fix this response-body catch in createOvHttp.