fix(runtime): bound proxied dispatcher teardown in the remaining call sites #6003
All Vouch review confidence checks passed
Residual risk 0.17 = Change Risk (0.43) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.43 · 384 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.356
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #6003"
general
weight: 0.35
ggbdpq
Summary
Refs #5978. Two call sites build their own proxy dispatcher and dispose it themselves, so the abort-before-close teardown that the shared transport fix (#5900) reordered survives in them:
testProxyConnection(packages/runtime/src/network/proxy-test.ts) aborted its controller and then awaited the dispatcher's gracefulclose(). Behind a real proxy that close never settles, so the call stays pending long past its 8s probe timeout — the Desktop "Test current configuration" button spins forever and the serialized settings lane it occupies wedges. The fix starts dispatcher teardown before the abort and races it against a 1s grace, mirroring the transport pattern.proxiedFetcherror path (packages/runtime/src/bots/proxied-fetch.ts) awaited the same graceful close after aborting, so a stalled close delays the rejection the caller is owed. Same ordering and bound applied.The success path of
proxiedFetchkeeps its fire-and-forget close: it owns the streaming body lifecycle (awaiting it was the previous streaming bug), and bounding or re-chaining it is the separate semantic decision the issue itself flags for maintainers. That is why this PR usesRefsinstead ofFixes— the dispatcher-lifecycle question on the success path stays open on the issue.Both regression tests stall
ProxyAgent.prototype.close— the same Undici/Node-version-independent technique the transport tests in #5900 use — and assert the calls still settle. Both fail on the previous ordering.Verification
| Check | Result |
| --- | --- |
|
node --test dist/network/__tests__/proxy-test.test.js(before fix, with new tests) | fail — new testsettles after a successful probe even when the dispatcher close stallshung to its 5s guard; 3 existing tests passed ||
node --test dist/bots/__tests__/proxied-fetch.test.js(before fix, with new tests) | fail — new testrejects promptly on request failure even when the dispatcher close stallshung to its 5s guard; 5 existing tests passed ||
node --test dist/network/__tests__/proxy-test.test.js(after fix) | pass 4/4 (stall test settles at ~1s, the grace bound) ||
node --test dist/bots/__tests__/proxied-fetch.test.js(after fix) | pass 6/6 ||
node --test dist/network/__tests__/.test.js dist/bots/__tests__/.test.js(adjacent suites) | pass 165/165 ||
npx biome checkon the 4 changed files | clean ||
npm run check:asf-headers| pass (4308 covered, 253 excluded) || Full-repo
format:check, full runtime/runtime-host suites | not run |AI use
Tool(s) and scope: GLM-5.3-Flash (ZCode) — issue triage, root-cause confirmation against #5900's pattern, TDD implementation (tests written first and confirmed failing), and PR drafting; all checks executed locally on macOS arm64 (Node 24).
Checklist
Does this PR entail a change in behavior?