Repository navigation
Conversation
(ai: vllm-qwen/qwen3.8-27b) Reviewed the diff, traced the full inline-lane call chain, verified the signal semantics against the WHATWG fetch spec + empirical Node probes, and ran the targeted suites locally. What I verified
Regression surface (existing behaviors the diff touches)
Test quality: real loopback HTTP (not mocked), connection-close assertions, exact-reason identity ( Two adjacent pre-existing defects this PR surfaces (out of scope, noted for tracking)
Both are in separate files/layers from this PR's scope and pre-date it — I did not bundle them in. 八问
判定:引擎边界上的修复正确、测试扎实、diff 干净(2 文件),回归面清白——CI 转绿即可合。上面两处相邻既有缺陷(withHeaders 丢 signal、pi-inline 自定义 abort reason 误判)超出本 PR 范围,建议另行跟踪;本 PR 不捆绑。 |
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.
The pi-inline transport's catch only re-threw errors named "AbortError", but the engine rejects with the signal's REASON — for a custom abort (controller.abort(new Error(...))) that reason is not an AbortError, so a caller cancellation was misclassified as an engine failure and degraded to a direct (uncompressed) resend that also consumed the one-shot warning. Classify by the effective signal's aborted state (resolved exactly as the engine does) so any caller cancellation propagates. Pinned by a regression test (custom-reason Request.signal cancel must propagate, never degrade).
ranxianglei
left a comment
There was a problem hiding this comment.
APPROVE — the core fix is correct and well-tested.
The dispatcher now resolves the effective signal exactly as the platform fetch does (init.signal if present, else the Request's signal, else none), throws if already aborted before and after the body conversion, and reuses the existing abort path (res.destroy + reject with the signal's reason). Verified against platform fetch semantics (probe: the Request constructor does NOT throw on an already-aborted signal — it creates a linked dependent signal — so the pre-aborted case is handled by the new throwIfAborted, not by a ctor throw). The test file is solid (real loopback upstream, exact-reason identity, both-direction override controls per #3617).
已顺手修:pi-inline transport 按 signal 状态(非 reason 名)分类取消——custom-reason 取消(engine 以 signal.reason reject,非 AbortError)不再被误判为引擎失败而降级直发(烧 token + 消耗一次性警告),并补回归测试。+ commit dc0efc3
结构化八问
- 是什么问题:内联引擎 dispatcher 只读
init.signal,忽略 Request 对象自带的 signal,调用方用new Request(url, {signal})(无 init)取消的请求未被尊重,仍被转发上游。 - 什么原因导致的:signal 解析只有单一来源(
init?.signal),Request 的.signal从未被读;toInlineReq的 body 读取.catch(()=>null)吞掉 pre-aborted 读取,pre-aborted Request 被转发上游。 - 影响范围与严重程度:内联车道(pi + opencode inline)在宿主传带 signal 的 Request(无 init.signal)时触发;调用方取消被静默忽略(烧 token、忽略用户取消)——正确性问题,非数据丢失/可用性。
- 怎么修复的:按平台 fetch 语义解析有效 signal(init.signal 存在→用之;否则 Request.signal;否则无),body 转换前后
throwIfAborted(),复用现有 abort 路径(res.destroy + 以 reason reject);另修 pi-inline transport 按 signal 状态(非 reason 名)分类取消,使 custom-reason 取消被传播而非降级直发。 - 是否有回归问题:无——只添加之前缺失的 signal 处理,不改变现有 init.signal 路径(表达式与平台 fetch 语义一致,probe 验证);Defect B 只改取消分类,不改引擎失败降级路径。
- 是否破坏缓存:无。
- 是否改了设计方向:无——复用现有 abort 路径,无新机制。
- 是否引入新配置:无。
合并判定:可合并。核心修复正确、测试充分;Defect B 已顺手修(commit dc0efc3);Defect A(withHeaders 丢 signal,跨文件跨车道)已转 🔶 需要决策,见下条评论。
|
🔶 需要决策 Defect A:
new Request(input.url, { method: input.method, headers, body: input.body, duplex: "half" })This omits Reachability: only when the input is a Request object AND Why not fixed on the spot: this is a cross-file (native-intercept.ts, a hot file) and cross-lane (all lanes) change — not "small" per the review-lane rule. The fix would be Decision needed: fold into this PR vs track separately. |
[bot] 🏷 Review of PR #6504 complete. Verdict: APPROVE (posted as a formal GitHub review with the structured 8-question checklist). What I did:
Verified:
Pending:
|
[bot] 🏷 Re-triggered review lane — the APPROVE review is already posted on this exact head ( CI status per mirror cache (fetched 09:19:11Z, may be stale): 4 success, 12 skipped, 14 queued. The task reports the PR as green. The 🔶 需要决策 item (Defect A: |
|
Superseded by #6677 (merged as Landed into master via the real merge commit The fix for #6503 is now in master. Closing this PR as superseded — thanks for the careful, well-tested fix. |
…#6504) into batch5-wave5
Closes #6503
Problem
Inline dispatch accepts a Request object but observes only init.signal. A caller using new Request(url, { signal }) can cancel before response headers or during streaming, yet the inline engine continues forwarding work and the caller's body read remains pending. A pre-aborted Request is also sent upstream.
Changes
Resolve the effective signal from Request when init.signal is omitted or undefined. Preserve explicit replacement signals and null overrides. Check cancellation before and after request conversion, then reuse the existing pre-header rejection and post-header stream/transport cancellation path.
Original feature validation
On unchanged master 9674cfa, the new real loopback HTTP suite reports 4 failing regressions and 2 passing override controls. It covers omitted init, undefined init.signal, a committed streaming body, and a pre-aborted Request. Cancellation tests verify the actual upstream connection closes; pre-header errors retain the caller's exact reason.
After completing the build, all 14 tests across inline-request-signal, inline-streaming and pi-inline pass, including existing POST model dispatch, init.signal cancellation, live token delivery and admin/transport integration.
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/distribution but its local model endpoint is unreachable; its real-model case is skipped. Full real-model E2E and upstream CI remain unverified. Request body conversion keeps the existing eager-buffering behavior; this change does not make a pending request-body read interruptible.
Prior work and submission
Checked 61 author PRs, 166 fork heads, complete inline-engine history, and Request.signal/inline/abort PR and issue searches. The cancellation introduced with #3284 observes init.signal only; no prior change was found for inheritance from a Request.
Current master integration
Merged upstream
fcc2e848486cc2152e36b6658c517fbfa51ec428into this branch without rewriting the existing feature commit. Integration head:1c6d2c5cee73c3bd951c224be4a342098a291e7f. The merge parents are the original feature head9bcd9c44488c9225da46e57e86eb81f49f9beddcand 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-request-signal.test.ts.Revalidated the merged tree on Node 24.22.1:
inline-request-signal,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 dispatch and cancellation cases use loopback HTTP fixtures, and full real-model E2E was not rerun locally. Request-body conversion retains its existing eager buffering and does not make an in-progress body read interruptible.Review status
Linked to #6503 and ready for maintainer review. The branch now includes current master and is mergeable; GitHub no longer reports it as behind. CI run 43377731925 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.