Skip to content

fix(dispatch): report available capacity after synchronous rejection - #153

Merged
ronag merged 4 commits into
nxtedition:masterfrom
ronag:codex/upstream-sync-dispatch-capacity
Nov 18, 2026
Merged

ronag merged 4 commits into
nxtedition:masterfrom
ronag:codex/upstream-sync-dispatch-capacity

Conversation

@ronag

@ronag ronag commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

Confidence Reproduced on 13.3.0. Severity High for a dispatcher caller awaiting drain. Likelihood Possible with direct dispatch and an invalid request. An idle Client reports backpressure when it rejects a request synchronously. A caller can then wait indefinitely for capacity that was never used.

Align the public return value with nodejs#6180. The handler still receives the original error. The pool continues to honor its existing failure marker for custom children, and genuine backpressure still triggers normal drain handling.

The direct-client regression failed before the change and passed afterwards. The pool lifecycle, pre-abort, concurrent body consumption and 304 connection-reuse suites passed, along with lint and the public type checks. No dependency version changes are included.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The change affects the public dispatch boolean contract across DispatcherBase, pool propagation, custom implementations, and closed or busy edge cases that local tests do not fully cover, so maintainer validation is warranted.

No open issues 🎉

What changed in this PR

Fixes dispatcher backpressure reporting when request validation fails synchronously, ensuring rejected requests report available capacity while still delivering the original error to the handler.

Changes:

  • Return true after synchronous dispatch errors.
  • Simplify pool backpressure handling by relying on dispatcher return values.
  • Remove the obsolete dispatch-failure symbol.
  • Add regression coverage for direct-client and pool behavior.
File Description
test/​pool.js Adds regression coverage for direct-client and pool behavior after synchronous request rejection.
lib/​dispatcher/​pool-base.js Simplifies pool backpressure handling by relying directly on child dispatcher return values.
lib/​dispatcher/​dispatcher-base.js Reports available capacity after delivering synchronous dispatch errors.
lib/​core/​symbols.js Removes the obsolete dispatch-failure symbol.

Review effort: Lite

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

A critical active finding remains: the invalid-request rejection path can incorrectly report a backpressured dispatcher as writable, allowing callers to send work before capacity is available.

1 open issue

Review effort: Lite

Comment thread lib/dispatcher/dispatcher-base.js Resolved

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues remain, with targeted regression coverage for synchronous rejection and genuine backpressure/drain behavior.

No open issues 🎉

1 resolved since last review

Review effort: Lite

@ronag
ronag marked this pull request as ready for review November 18, 2026 11:00
@ronag
ronag merged commit dc81885 into nxtedition:master Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants