Repository navigation
[PR] fix(agent/dsh): keep the no-init threw takeover-gate verdict synchronous for the WS-lane consumer (#4841) - #4844
ranxianglei wants to merge 1 commit into
Conversation
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.9278-pr.4844.43451f7This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr4844.tgz
npm install -g packageInstall instructions are refreshed on each push. |
(ai: vllm-qwen/qwen3.8-27b) 查重: 不重复 —— 本条是 [PR] 镜像(对应 GitHub PR #4844,分支 这是已完成工作的 review 唤醒,不重做。按 PR Review 规范独立审:① 方向(对照 #4841)→ ② 回归面清点 → ③ 代码本体 → ④ 测试有效性 → ⑤/⑤b diff 与代码整洁 → CI 状态。结论按结构化八问给出,稍后回帖。 |
(ai: vllm-qwen/qwen3.8-27b) 独立审核完成(核对代码 + 定向验证 + 读 CI,非重做)。结论:ready to merge。 八问:
行为变更披露(旧→新):dsh 独立验证记录:
交互提醒:#4832(未合入)给同一闭包的相邻 none 臂加同型 fast path —— hunk 不同、冲突风险低;谁后合并谁 rebase(与正文所述一致)。 判定:可合(合并按钮归人)。 |
…ous for the WS-lane consumer (#4841) The WS intercept compares state.takeoverGate(target) === false without awaiting; a Promise verdict never matches and the refusal is silently lost. The dsh threw arm now answers no-init (WS-shaped) calls with the same verdict as its exhausted-settle tail (extracted shared helper), and the sync-by-contract rule is documented on the gate field and at the ws comparison site. Regression test pins the verdict class both ways (sync false pre-await / init-carrying stays a Promise).
378ce9e to
76f1464
Compare
[bot] 🏷 Conflict resolved & pushed. Rebased the single-commit PR onto current master (
Whether the PR is still worth merging for that remaining value is the owner's call at merge time — I did not need a decision to resolve the conflict deterministically, so I proceeded rather than parking it. How the conflict was resolved (per file):
Transparency: this run's process was force-restarted once by the supervisor after ~35 min idle; after the restart I re-verified git state (rebase intact), reinstalled deps, and re-ran the full local verification above before pushing. No impact on the result. 八问(中文,供人工复核)
收工判定:冲突已消解并推送,PR 现为干净可合并状态(1 ahead / 0 behind)。CI 将在新 head |
Part of #4841
What
The WS-lane consumer (
src/agent/native-ws-intercept.ts) decides per connection with a SYNCHRONOUS compare:It cannot await before the socket opens. Any gate verdict that is a Promise — even one that resolves to
false— never matches=== false, so "refuse takeover, go direct" silently fails and the connection gets rewritten onto the proxy instead. The fetch lane awaits correctly (native-intercept.ts:1203 / :1372); only the WS lane was affected. On master, dsh'sthrewarm returned a Promise for every call shape (settleThrewAttribution(...).then(...)).Fix (option B from the issue — provider-side contract, small closed loop)
src/agent/dsh-native.ts: thethrewarm now answers no-init (WS-shaped) calls synchronously, with exactly the verdict of its exhausted-settle tail. That tail (doom check + event wording + refusal) is extracted into a sharedthrewExhaustedVerdictso both shapes judge oversize identically — one doom call, one event string. Rationale pinned in comments: without init there is no body to decode or doom-check; the settle-retry's tick-scale recovery is unreachable synchronously (the top-of-gate probe re-runs on every call, so self-heal is not lost); streak untouched (no settle attempt = no give-up budget consumed). Init-carrying (fetch-lane) calls keep the full async settle-retry path unchanged.src/agent/native-intercept.ts: thetakeoverGatefield doc now states the contract explicitly — providers MUST return a non-Promise verdict for no-init (WS-shaped) calls; a Promise there is silently lost.src/agent/native-ws-intercept.ts: pointer comment at the sync comparison site.tests/dsh-native.test.ts: new regression test pins the verdict CLASS both directions — no-init call underthrewyields raw=== falseBEFORE any await, logs the standard refusal line, consumes no settle budget (threwStreakstays 0); negative row: init-carrying call stays a Promise, settle-retry still refuses, streak increments; recovery re-claims once attribution returns. Three existing tests (#2924a claim-after-recovery, #3581a probe counts, #3581b latch arming) now drive their gate calls WITH init — they pin FETCH-LANE semantics, which by definition carry init; bare calls mean the WS shape under the new contract. All assertions preserved unchanged.Behavior change (old → new, required disclosure)
dsh
threw-state, no-init gate call: verdict was aPromise<false>→ now synchronouslyfalse. The only observable difference is the WS lane, where the refusal now takes effect instead of being silently lost (connection goes direct instead of being rewritten onto the proxy). The fetch lane awaits and is unaffected. Reachable today only when a pi-installed WS wrapper reads a dsh-owned ACTIVE_STATE within one process — real hosts run separate processes, so no production behavior changes today; this closes the latent contract gap (#4841 reachability analysis, p3).Notes
61f31b921adds the same-shape no-init fast path to the ADJACENT none arm of the same closure; this PR touches the threw arm + settle tail (different hunks). Whichever merges second should rebase — expect clean, verify please.tests/issue4125-giveup-reason.test.ts("send-failed", actual "dead") is part of the registered master born-red cluster on cdac1c0 (tracked in CI Control Center: Centralized CI Failure Handling & Status Sync (Comment all CI issues here; do not open new issues) | CI 总控: CI 失败集中处理与状态同步(所有 CI 问题在此评论, 勿开新 issue) #4599) — reproduced identically on clean master locally, unrelated to this diff.