Repository navigation
[PR] fix: preserve null response bodies in the inline HTTP engine - #6502
ranxianglei merged 18 commits into
Conversation
…st (ranxianglei#6502) The null-body test boots the full inline engine (config + sqlite state) but, unlike its sibling inline-streaming.test.ts, did not redirect the XDG dirs, so a developer run would touch the real ~/.config/billion-context and state. Pin the same hermetic pattern and restore the env in the after hook.
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) 查重: 不重复。 Searched open + closed issues/PRs for inline-engine null-body / 204 / 205 / 304 / HEAD handling — the only matches are #6501 (this PR's issue) and this PR. Sibling PR #6504 (Request-object cancellation, from #6503) is a different symptom AND a different mechanism (signal propagation in 标签: bug, pi, opencode, scope/wiring, p2 — defect in the inline in-process lane (consumed by the pi-inline and opencode-native lanes); client-integration surface; usable, degrades only under specific upstream response shapes. Review conclusionThe bug is real — reproduced locally. I ran the PR's new test file against unchanged master: exactly 4 failures ( The fix is correct and minimal. Per the fetch spec, Test quality: real teeth. The new suite boots the real engine against a real loopback HTTP upstream (hermetic XDG roots, ephemeral port — same pattern as Local verification on the merged tree: all 20 inline-lane tests pass (inline-null-body 6, inline-streaming 8, pi-inline 7, pi-inline-ws 4, launcher-pi-inline 2); CI: fully green on the original head a3b1afc (36 success / 12 skipped / 0 failed; the skipped lanes are the zero-token e2e suites gated out by diff paths — the core test matrix, which includes the new suite, ran green). The branch was behind master (missing #6480 pure-SQLite default, which changes the storage bootstrap this test boots), so I merged current master into the PR branch as an additive merge commit — fae9926, the same pattern the author used earlier in the branch. CI is re-running on the new head (in progress, no failures so far). Merge-ordering note: #6504 (same author) edits src/inline-engine.ts in the region adjacent to this diff (the Auto-merge gate (§7.4): all 8 conditions met — single-module fix, reproducing regression test, green on head, no config/persistence/wire/kernel change, pure 八问结论
|
The suite baseline preload (preload-storage-baseline.mjs) pins BILI_STORAGE_UNIFIED="legacy" for the broad corpus. After ranxianglei#6480 flipped the storage default to pure-sqlite, the notice-registry suite's visibleNotices assertions expect the pure-sqlite default notice, which is gated on unifiedSelectionIsSqlite (unified "sqlite" or absent) — the preload's "legacy" made the notice silent, so the suite was born-red on master. Pin the selection explicitly (ranxianglei#4011 lesson: a test that depends on the production default passes locally but fails in CI).
…test The dsh plugin lane (ci-e2e-dsh.yml) runs node --import tsx --test WITHOUT the preload-storage-baseline.mjs preload, so BILI_STORAGE_UNIFIED is unset and the storage mode defaults to 'full'. Under the pure-sqlite default flip (5a80e2b, ranxianglei#6480), 'full' mode turns the JSON envelope writer OFF — so the .content-store.json sidecar is never written, and the test's readdirSync(namespace) hits ENOENT. Pin BILI_STORAGE_JSON_WRITER=on in the test so the content-store sidecar is written regardless of the storage mode. This keeps the corrupted-store detection path exercised in both full and legacy modes. Closes: dsh plugin lane red on master (run 43532980164, job 132255459726)
The pure-sqlite default flip (5a80e2b, ranxianglei#6480) turns the JSON envelope writer OFF, so the .json session file this lane asserts on is never written and 'proxy must persist the session' / 'no persisted session carried compressed blocks' fail after the 20s wait. Pin the writer ON in the spawned client's env (the bootstrapped proxy inherits it) so the envelope this test was written for is still produced. Closes: native opencode lane red on master (run 43547593803, job 132302438610)
Same pure-sqlite default flip (5a80e2b, ranxianglei#6480) as the opencode lane: the JSON envelope writer is OFF, so 'proxy must persist the session within 20000ms' fails — the on-disk .json session file is never written. Pin the writer ON in the spawned dsh client's env (the bootstrapped proxy inherits it). Closes: native dsh lane red on master (run 43547497015, job 132302138843)
…e2e lane Same pure-sqlite default flip (5a80e2b, ranxianglei#6480) as the opencode/dsh lanes: the JSON envelope writer is OFF, so 'session persisted' fails — the on-disk .json session file is never written. Pin the writer ON in the spawned pi client's env (the bootstrapped proxy inherits it). Closes: pi codex-responses WS lane red on master (run 43547626291, job 132302540960)
…lane 4th lane of the pure-sqlite default flip (5a80e2b, ranxianglei#6480) family: the JSON envelope writer is OFF, so 'proxy must persist the session' and 'at least one persisted session must carry compressed blocks' fail — the on-disk .json session file is never written. Pin the writer ON in the spawned pi client's env (the bootstrapped proxy inherits it). Closes: pi package-native lane red on ci-fixes (run 43558179054, job 132336647955)
Same pure-sqlite default flip (5a80e2b, ranxianglei#6480) family: the JSON writer is OFF, so the per-session CCR content-store sidecar (.content-store.json) that 'child persists its own companion and survives a proxy restart' asserts on is never written (0 !== 1). The earlier b1bc17b pin only covered tests/plugin-fork.test.ts, not this file. Pin the writer ON at module load (before any SessionStore is constructed). Closes: dsh plugin lane red on ci-fixes (run 43558179102, job 132336519539)
…lane Pure-sqlite default flip (5a80e2b, ranxianglei#6480) family: the JSON envelope writer is OFF, so 'proxy must persist the session' fails — the on-disk .json session file is never written. Pin the writer ON in the spawned opencode client's env (the bootstrapped proxy inherits it).
Pure-sqlite default flip (5a80e2b, ranxianglei#6480) family: the JSON envelope writer is OFF, so the on-disk .json session envelope this lane asserts on (exactly ONE persisted session under the raw key) is never written. Pin the writer ON in the spawned dsh client's env.
Pure-sqlite default flip (5a80e2b, ranxianglei#6480) family: the JSON envelope writer is OFF, so the on-disk .json session file this lane asserts on (state survival across the OLD→NEW update) is never written. Pin the writer ON in the spawned proxy's env (both update phases share envBase).
Resolve CI baseline conflicts using the current upstream test setup.
[bot] (ai: vllm-qwen/qwen3.8-27b) 重启后进度汇报: 会话卡住重启后,我重新独立核对了 PR 现状(没沿用旧结论)。结论:修复本身正确;PR 已从「陈旧基线冲突」转为「可合、待 CI 转绿」。 我独立做了什么:
CI(新 head 八问
判定:可合(待 |
|
Superseded by #6677 (merged as Landed into master via the real merge commit The fix for #6501 is now in master. Closing this PR as superseded — thanks for the careful, well-tested fix. |
[bot] (ai: vllm-qwen/qwen3.8-27b) Acknowledged — review complete on my side. I independently verified the fix is correct and spec-valid, and just confirmed it's now in master: Closing #6502 as superseded by #6677 is correct — nothing further needed from me. Thanks. |
Closes #6501
Problem
The inline engine always reconstructs a fetch Response with its body stream. For upstream HTTP 204, 205 and 304 this throws a Response-constructor TypeError, turning a valid response into a failed inline dispatch. HEAD requests also expose an empty stream where fetch requires a null body.
Changes
Pass the effective request method to response construction and use a null body for HEAD and null-body status codes. Other statuses keep the existing streaming body and header-commit behavior.
Original feature validation
A real loopback HTTP upstream reproduces 4 failures and 2 passing controls on unchanged master 9674cfa. The failures cover 204/205/304 and HEAD 200; GET 200/201 controls confirm ordinary response content survives.
With the fix, all 14 tests across inline-null-body, inline-streaming, and pi-inline pass. This includes token delivery before generation completes, loopback model/admin dispatch, caller cancellation, loopback Web UI, and transport fallback behavior.
Passed: npm run typecheck; npm run build; npm run check:unused-exports; npm run check:test-import-graph; git diff --check.
The zero-token Codex preflight finds the CLI and built distribution but its local model endpoint is unreachable; the real-model case is skipped. Full real-model E2E and upstream CI remain unverified.
Prior work and submission
Checked 61 author PRs, 165 fork heads, complete inline-engine history, and null-body/HEAD/204/205/304 PR and issue searches. Prior #4999 fixes streaming timing; #3284 introduces the inline lane and init.signal cancellation. Neither fixes construction of responses that cannot carry a body.
Current master integration
Merged upstream
fcc2e848486cc2152e36b6658c517fbfa51ec428into this branch without rewriting the existing feature commit. Integration head:6d3fbcfc34f83516a2ebcccca00919bf39cd05ac. The merge parents are the original feature headda5d55a0e3f8440c4c1826b6e99f9db4ce32292eand the upstream commit above.The production file and feature test are byte-for-byte unchanged from the original feature head. Relative to current master, this PR still changes only
src/inline-engine.tsandtests/inline-null-body.test.ts.Revalidated the merged tree on Node 24.22.1:
inline-null-body,inline-streaming, andpi-inlinepass, using the repository's storage and test-environment preloads.npm run typecheck,npm run build,npm run check:unused-exports, andnpm run check:test-import-graphpass.git diff fcc2e848486cc2152e36b6658c517fbfa51ec428 --checkis clean for this PR's net changes.The original failure/control reproduction above remains tied to
9674cfafbc78c50245ae0d887483d3d6ce880c15; the validation in this section was rerun after integrating current master. The model/admin cases use loopback HTTP fixtures, and full real-model E2E was not rerun locally.Review status
Linked to #6501 and ready for maintainer review. The branch now includes current master and is mergeable; GitHub no longer reports it as behind. CI run 43377629691 was queued for this exact integration head when this update was prepared. The Checks tab contains the current hosted results.
Please apply the existing
ci:fulllabel to run the FULL matrix, including the required Windows / Node 24 checks. The default CORE matrix does not produce those checks.