Repository navigation
Description
What happened?
The custom HTTP transport returns compressed wire bytes as a Fetch Response without decoding Content-Encoding: gzip. Both buffered and streaming responses are affected. A JSON caller then receives compressed bytes from .text()/.json() rather than JSON.
Expected: Fetch-compatible content decoding, including appropriate size limits on decoded data. Observed: the original transport does not decode the fixture below; native Bun fetch does.
Steps to reproduce
From a checkout of tag v2.0.151, run this isolated test. It extracts the unchanged private transport function, avoiding application initialization. The loopback address is a local fixture supplied directly to the transport, not a claim about passing the production address guard.
Standalone reproduction command
python3 - <<'PY' | bun run -
from pathlib import Path
s=Path('backend/cli/src/settings/network.ts').read_text()
print('import {isIP} from "node:net"; import {request as httpRequest,createServer} from "node:http"; import {request as httpsRequest} from "node:https"; import {Readable} from "node:stream"; import {gzipSync} from "node:zlib";')
print(s[s.index(' async function pinnedFetch('):s.index(' /** Policy-aware fetch.')])
print('''
const payload='{"ok":true}';
const server=createServer((req,res)=>{
res.writeHead(200,{"content-type":"application/json","content-encoding":"gzip"});
res.end(gzipSync(payload));
});
await new Promise(r=>server.listen(0,"127.0.0.1",r));
const url=new URL("http://127.0.0.1:"+server.address().port);
try {
for(const stream of [false,true]) {
const res=await pinnedFetch(url,{signal:AbortSignal.timeout(2000)},"127.0.0.1",undefined,stream);
console.log({stream,decoded:(await res.text())===payload});
}
console.log({nativeDecoded:(await (await fetch(url)).text())===payload});
} finally {server.closeAllConnections();server.close();}
''')
PYLogs and screenshots
stream=false: decoded=false
stream=true: decoded=false
nativeDecoded=true
Code location
network.ts:619–660 passes either Readable.toWeb(incoming) or concatenated raw chunks to new Response. There is no content-decoding stage. This is separate from DNS/Fake IP rejection; it occurs after a successful connection. The fixture deliberately returns gzip; this does not claim every upstream API currently does so.
How did you install OpenScience?
Official desktop release ZIP and npm. Reproduction uses source functions from tag v2.0.151.
OpenScience version
2.0.151 (latest npm at reporting time).
Provider and model
Not applicable; no model calls.
Operating system
macOS 27.0 ARM64; isolated reproduction on Bun 1.3.13. Not yet reproduced inside the packaged desktop runtime.
Action approval mode
Not applicable to this isolated transport test.
Activity
aayambansal commentedon Oct 18, 2026
Fixed in #998, squash merged to
main. The pinned transport now decodes gzip, deflate, and Brotli in both buffered and streaming modes, removes stale encoding/length headers after decoding, and applies size limits to decoded bytes. Real HTTP fixtures verify JSON decoding, expansion limits, and interrupted/cancelled streams.Validation passed on the supported pinned runtime, including the focused network and scientific-connector regressions, plus PR CI. These source fixes are on
main; installed 2.0.151 builds need a release containing them.