← Back to Pull requests

fix(runtime): bound proxied dispatcher teardown in the remaining call sites #6003

Closed
unknown closed this pull request without merging on Oct 10, 2026 10:47 UTC
View on GitHub
unknown unknown commented on Oct 08, 2026 12:32 UTC
Author

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 graceful close(). 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.

  • proxiedFetch error 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 proxiedFetch keeps 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 uses Refs instead of Fixes — 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 test settles after a successful probe even when the dispatcher close stalls hung to its 5s guard; 3 existing tests passed |
    | node --test dist/bots/__tests__/proxied-fetch.test.js (before fix, with new tests) | fail — new test rejects promptly on request failure even when the dispatcher close stalls hung 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 check on 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

  • Generative tooling made a substantive contribution
  • 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

  • Tests cover the change and fail without it

  • Lint, format, typecheck and the affected suites pass locally
  • Does this PR entail a change in behavior?

  • Yes — described under Summary above
  • Diff: 384 lines (+288 / -96) across 4 files Reviewer: ggbdpq Review duration: 2775m
    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
    0.43
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 43% (MEDIUM) · Higher = larger blast radius
    43%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 17.0% · Safe to merge
    17.0%
    Repository