Repository navigation
Description
What happened?
Network.fetch waits for DNS resolution to finish even after its AbortSignal has timed out. The transport is correctly prevented from running afterward, but the caller does not regain control at the deadline.
Expected: cancellation promptly rejects the fetch while a slow resolver is still pending.
Steps to reproduce
Run from tag v2.0.151. The script extracts original URL validation, address validation and fetch orchestration. Domain authorization is stubbed as already approved. It uses the existing resolver/transport test seams and performs no network request.
Standalone reproduction command
python3 - <<'PY' | bun run -
from pathlib import Path
s=Path('backend/cli/src/settings/network.ts').read_text()
print('import {BlockList,isIP} from "node:net"; import {lookup} from "node:dns/promises"; import {request as httpRequest} from "node:http"; import {request as httpsRequest} from "node:https"; import {Readable} from "node:stream"; import {domainToASCII} from "node:url";')
print(s[s.index(' export function canonicalDomain'):s.index(' export const Domain')])
print(s[s.index(' function url(raw:'):s.index(' export async function assertAllowed')])
print('const blocked=async()=>undefined; const fetchedURL=new WeakMap();')
print(s[s.index(' const nonPublic ='):s.rfind('\n}')].replace('export async function fetch(raw:', 'async function policyFetch(raw:'))
print('''
let sends=0; const start=Date.now();
try {
await policyFetch("https://example.com",{signal:AbortSignal.timeout(10)},{
resolveAddresses:async()=>{await Bun.sleep(250);return ["1.1.1.1"];},
transport:async()=>{sends++;return new Response("ok");}
});
} catch(e) {console.log({timeoutMs:10,elapsedMs:Date.now()-start,sends,error:e.name});}
''')
PYLogs and screenshots
timeoutMs=10 elapsedMs=254 sends=0 error=TimeoutError
Code location
network.ts:691 awaits assertPublicResolution without a signal. The next signal check is at line 710, after resolution. The system resolver at line 524 also receives no cancellation mechanism.
This is a deterministic slow-resolver test, not a measurement of the user's production DNS latency. There is no observed HTTP request after cancellation.
How did you install OpenScience?
Official desktop ZIP and npm; isolated reproduction uses tag v2.0.151 source.
OpenScience version
2.0.151 (latest npm at reporting time).
Provider and model
Not applicable; no model calls.
Operating system
macOS 27.0 ARM64; Bun 1.3.13. Not yet tested inside the packaged desktop runtime.
Action approval mode
Domain authorization is stubbed as approved in this isolated test.
Activity
aayambansal commentedon Oct 18, 2026
Fixed in #998, squash merged to
main. Cancellation now races the pending resolver, so the caller rejects promptly even while system DNS is still pending. A late DNS result cannot start an HTTP request. The regression holds DNS behind a barrier, aborts it, and verifies both prompt rejection and no late transport dispatch.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.