Repository navigation
[PR] fix(server): release bodyText after the prepare path consumed it — restores the watermark fastpath (CI shard #5418 red since #6482) - #6646
Closed
ranxianglei wants to merge 0 commit into
Closed
ranxianglei wants to merge 0 commit into
ranxianglei wants to merge 0 commit into
Conversation
ranxianglei
force-pushed
the
fix-5418-bodytext-release
branch
from
November 14, 2026 07:39
f162293 to
c26e001
Compare
Owner
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
CI shard "#5418 A/B byte-equality" (
tests/issue5403-watermark-fastpath.test.ts) has been red on master since the #6482 batch merge, and it goes red on every PR that merges current master — including all of Afloat16's wave-5 branches, which is why 40 unrelated PRs each carry one red shard.Root cause: #4753's fix (commit 6c0079b, "release input-only request data before streaming") set
bodyText = undefinedin the sync region ofhandleRequestbefore the awaited prepare path ran. The watermark fastpath gate (src/server/prepare-openai.ts:135,if (bodyText !== undefined && ...)) therefore never fired — the feature was silently dead, not failing loudly. Runtime probes (set site → release → consume, in order) confirm the release precedes the only consumer.Changes
src/server/handle.ts: move the fix: release request input buffers before long-running responses #4753 release to the last consumer — insiderunPrepareInner, right afterprepareOpenaihas read the parsed body (thepreparedOutternary). All other consumers (auth bypass, bodyMightCarryImages, preparedPipeline, forward, streaming path) still see the released text exactly as before; only the fastpath regains it.tests/issue5403-watermark-fastpath.test.ts: turn 0's "side lane must not stamp" pin pre-dates c15d9ce ("a tool-less MAIN turn must not be mistaken for a dsh sidecar"), which deliberately re-routes a tool-less main turn with a large output budget (64000 here) off the verbatim side lane. That turn is now a full-pipeline turn in both phases and stamps normally — pin it to the measured wire total like the other turns. The side-lane exemption itself stays pinned intests/issue5656-single-shot-sidecar.test.ts("side lane must never stamp: no x-bili-pf-turn").Verification (node v22.23.4, CI preload set)
#4753suites: request-input-lifetime 5/5, proxy-readbody 8/8, plugin-wire-metadata 3/3 — the memory release still happens, just after the last read.tests/issue5403-watermark-fastpath.test.ts: 2/2 green (wasB stamp 1: measured wire total — null !== 4).