Skip to content

[PR] fix(#5687): a tool-less MAIN turn must not be mistaken for a dsh sidecar - restores the BLOCKED-ref and wire-byte contracts - #5709

Closed
Louie0806 wants to merge 0 commit into
ranxianglei:masterfrom
Louie0806:2026-11-05_single-shot-sidecar-carrier-veto
Closed

Louie0806 wants to merge 0 commit into
ranxianglei:masterfrom
Louie0806:2026-11-05_single-shot-sidecar-carrier-veto

Conversation

@Louie0806

Copy link
Copy Markdown
Contributor

What this fixes

master is red on every test shard right now (10 of 12 test (...) jobs on 0aace2f203b2da9065fd53c63f4be0c0ab03c90c). The cause is #5687's generic dsh single-shot sidecar gate, which over-matches the first main turn.

isDshSingleShotSidecar (added by #5687 in src/server/side-request.ts) matches: no tools + exactly one user message + any non-empty system text. Both call sites opened on agent !== "main":

  • src/server/handle.ts:1073 - the sideRequestLike disjunct
  • src/server/handle.ts:2210 - the lane-side dshSingleShotSidecar intent

dsh's native client never stamps x-bili-plugin-agent - only x-bili-plugin and x-bili-plugin-conversation (src/agent/dsh-native.ts:1784-1785, :2412). So pluginRequestAgentHeader(req.headers) returns undefined, and undefined !== "main" is always true. A conversation's first turn (system + one user, no tools yet) therefore rides the #388 verbatim side lane, the kernel never sees the body, and the durable-state carriers never get their BLOCKED refs.

Evidence

Six suites are red on pristine 0aace2f203b2da9065fd53c63f4be0c0ab03c90c (detached worktree, farm-linked node_modules, rebuilt kernel/dist):

suite pristine master
tests/issue2419-dsh-skill-catalog.test.ts 3 / 1
tests/issue2446-dsh-mcp-catalog.test.ts 3 / 1
tests/issue2447-dsh-workspace-instructions.test.ts 3 / 1
tests/issue2481-dsh-runtime-context.test.ts 3 / 1
tests/issue2817-crosswire-persona-fold.test.ts 0 / 1
tests/issue5403-watermark-fastpath.test.ts 0 / 1

Bisect over the 46 commits (each step git reset --hard + kernel rebuild):

SHA 2446 2817 5418
c9ba48566 (previous master) 4/0 1/0 1/0
47df07f05 4/0 - 1/0
e4c50ef0b 3/1 0/1 0/1
0aace2f20 3/1 0/1 0/1

The flip is exactly 8de4c37f8 (Merge pull request #5687), whose second parent 01fcc5d689c7dd5a7b46125f861263f90a1bd572 is the generic gate. That commit's own check-runs were {"cancelled":46,"failure":9,"skipped":18,"success":27} - merged red.

Probe

pluginRequestAgentHeader(no agent header) = undefined
sideAgent !== 'main' -> true                    (gate OPEN)
isDshSingleShotSidecar(no tools)   = true

The four durable-carrier suites send { "content-type": ..., "x-bili-plugin": "dsh", "x-bili-plugin-conversation": CONV } and a body of { model, max_tokens: 64_000, messages: [ {role:"system"...}, {role:"user", content: MESSAGES} ] } - a textbook first main turn.

The fix

A genuine utility sidecar differs from that turn in two independent ways, and the patch requires both:

  1. Small fixed output budget - hasSingleShotBudget() requires max_tokens | max_completion_tokens | max_output_tokens present, positive, and <= 8192. Real presets pin a small number (prompt-enhance sends 4096); a main turn either omits the field (openai wire) or sizes it from the conversation (DSH: If the first request of a session originates from a bypass call, compression for the entire session is permanently | DSH: If the first request of a session originates from a bypass call, compress for the entire session is permanently inv | DSH:会话首个… #5656's own residual turn sends 64000).
  2. No durable-state marker - carriesDurableState() screens the user text against dshCarrierRawMarkers, the table src/fold-reconcile.ts:142 already uses. A carrier body is by definition a main turn's injected context.

Both call sites now gate on hasSingleShotBudget(parsed) && isDshSingleShotSidecar(protocol, parsed).

Tests

suite after
issue2419 4 / 0
issue2446 4 / 0
issue2447 4 / 0
issue2481 4 / 0
issue2817 1 / 0
issue5403 (watermark) 1 / 0
issue5656 5 / 0
side-lane-invariants 15 / 0
issue5658 2 / 0

npx tsc --noEmit = 0; all four gates (check-unused-exports, config-surface-guard, lifecycle-ledger-guard, check-test-import-graph) = 0; gen-config-docs generate is a fixpoint.

Negative control: reverting only the two source files (keeping the test changes) re-reds 2446 (3/1), 2817 (0/1), and 5418 (0/1) - so the source change is what carries the fix.

Two intentional test edits

Scope

4 files, +47/-4. No kernel change, no config-surface change, no new dependency. Fixes the regression introduced by #5687.


powered by dsh

@ranxianglei ranxianglei changed the title fix(#5687): a tool-less MAIN turn must not be mistaken for a dsh sidecar - restores the BLOCKED-ref and wire-byte contracts [PR] fix(#5687): a tool-less MAIN turn must not be mistaken for a dsh sidecar - restores the BLOCKED-ref and wire-byte contracts Nov 5, 2026
@Louie0806

Copy link
Copy Markdown
Contributor Author

CI note: the two red shards are the known msgid-lane-flow settle flake

Head 427778b14 finished 35 success / 2 failure / 14 skipped. The two failures:

job shard failing test
127068995769 test (ubuntu-latest, 22, 1) msgid lane flow: multi-block wire content degrades to derived ids, never a sticky 400
127068995596 test (ubuntu-latest, 24, 1) msgid lane flow: pin carries client ids into rows; edits append fresh rows (no swap, no 409)

Different tests of the same file, on different shards, with different assertion messages - the signature of a settle-timing flake, not a deterministic regression.

This patch cannot reach those bodies

tests/msgid-lane-flow.test.ts sends

{ conversationId, sinceSeq, resync, msgIds, path: "/v1/messages",
  request: { model: "claude-test", max_tokens: 1024 },
  messages: [ { role: "user", content: [{ type: "text", text: "seed" }] } ] }

No system field anywhere. isDshSingleShotSidecar bails on its carrier guard (src/server/side-request.ts:238):

if (!systemCarrierTexts(p).some((t) => t.trim().length > 0)) return false;

Probe in this worktree:

systemCarrierTexts: []
isDshSingleShotSidecar: false
top-level max_tokens: false | nested: 1048 -> request.max_tokens = 1024

false before and after the patch: the gate is unreachable for those bodies, so neither hasSingleShotBudget nor carriesDurableSignal can change their outcome. The patch also only ever removes requests from the side lane; it never adds one.

Pre-existing flake

tests/msgid-lane-flow.test.ts:103 guesses the debounced save with a fixed sleep:

settle: async () => { await new Promise((resolve) => setTimeout(resolve, 60)); }

while :60 sets new SessionStore({ ..., debounceMs: 15 }). Under shard contention a 60 ms guess loses the race and the row read precedes the flush - exactly the two assertions seen here (an edit lands as a FRESH row ... 3 !== 4, subsequent clean deltas pin client ids again).

Local: 10/10 green in this worktree (8/8 with the source change reverted). It is not in scripts/ci-failure-shapes.mjs, so CI does not auto-retry it.

Recommendation: either add the msgid lane flow signature to the retry shapes, or make settle() poll for the expected row count instead of sleeping a fixed 60 ms (the pattern tests/snapshot-shadow.test.ts:173 already uses for unifiedTailSeqs).


powered by dsh

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

查重:不重复。 检索 open+closed issue/PR 均无同主题条目;本条唯一血缘是 #5687 → 本 PR,不存在并列的第二个 [PR] 在修同一件事。

标签: bug dsh scope/wiring p1(保留系统 pr)。理由:#5687 的回归让 dsh 每个会话的首个主回合被误判成一次性 sidecar、走 verbatim side lane,内核从未处理该回合 → 持久上下文拿不到 BLOCKED ref → 压缩停摆、上下文只增不减直至 413——属核心能力整体停摆 + 上下文失控增长类,判 p1;改动落在请求管道的 side-lane 准入门(src/server/),属 scope/wiring;仅涉及 dsh 车道。

以下按八问给独立审核结论(我自己读了 diff 与 CI 日志,未照抄 PR 描述):

  1. 是什么问题:[PR] fix: unknown dsh one-shot sidecars steal the raw-key anchor and kill compression (context-explosion root cause) #5687 为挡未知 dsh 一次性 sidecar 抢 raw-key anchor,新增了宽松判定 isDshSingleShotSideCar(无 tools + 恰好一条非 system 消息且有内容)。但 dsh 原生客户端从不打 x-bili-plugin-agent,导致 undefined !== "main" 恒真,于是会话第一个主回合(system + 一条 user、尚无任何 tools)也被误判成 sidecar,走了逐字 side lane。

  2. 什么原因导致的:根因是那个判定只用了「形状」这一个信号,而 dsh 主回合在开局时恰好也长这样(system + 单条 user、没 tools)。缺的是一个正交信号来区分「真 sidecar」和「还没长出 tools 的主回合」。

  3. 影响范围与严重程度:dsh 车道全量用户、每个新会话的第一个主回合都中招(触发面 = 所有 dsh 对话开局)。后果是压缩对首回合失效、持久载体拿不到 BLOCKED ref,进而上下文只增不减、最终 413 拒收——用户不可用级(p1)。master 上因此红了 6 个回归套件(issue2419/2446/2447/2481/2817/5403)。

  4. 怎么修复的:把准入收紧成两个独立信号同时满足才走 side lane:① hasSingleShotBudget(parsed)——输出预算字段存在且 0 < budget ≤ 8192(真 sidecar 预设如 prompt-enhance 发 4096;主回合要么省略该字段、要么按会话规模取值如 64000,天然 >8192);② 用户内容不含任何持久状态标记(复用 dshCarrierRawMarkers——载体正文按定义就是主回合注入的上下文)。两个调用点(sideRequestLike 分支 + dshSingleShotSidecar intent)都补上了预算条件。方向对:用「形状 + 预算 + 载体标记」多重证据取代单一形状证据,治的是判定本身,不是在下游打补丁。

  5. 是否有回归问题:逐路径清点——改动只在「是否走 side lane」的准入处 AND 了一个更严的前置条件,使更少请求进 side lane、更多走完整管道;对原本就路由正确的请求零行为变化。负向对照成立:PR 撤销了旧断言「tool-less turn 1 rides side lane」(refs==0 && reqs==0),改为断言它走完整管道(refs>=1 && reqs>=1),正是被 [PR] fix: unknown dsh one-shot sidecars steal the raw-key anchor and kill compression (context-explosion root cause) #5687 破坏、由本 PR 恢复的那条契约。无 fail-fast 变吞错、无阈值/时序/输出格式漂移。唯一需披露的行为变更:tool-less 首个主回合从「误走 side lane」改为「走完整管道」——有意且必要的恢复,非漂移。

  6. 是否破坏缓存:不破坏。修复恰恰是在恢复前缀缓存稳定所依赖的 BLOCKED-ref 契约(主回合重新进入内核、正常铸造 ref);side-lane 路由键未变,无缓存失效策略变化。

  7. 是否改了设计方向:没有。仍在 标题生成等侧请求污染主会话状态:prepareAnthropic 缺 isTitleGen 守卫、快照无条件覆盖、survivedCount 每请求空转 #388 side-lane 框架内收紧准入谓词,未改架构/边界/数据流。

  8. 是否引入新的配置:没有。SINGLE_SHOT_SIDECAR_MAX_BUDGET=8192 是模块私有常量(不进 config surface),无新 env/config/默认值。

CI 核查(关键):11 个 test shard 中只有 2 个红,且都是 ubuntu 的 shard 1(node22 与 node24)。我拉取了两个失败 shard 的完整日志逐行确认——它们挂的都是 tests/msgid-lane-flow.test.ts,但各自挂在不同的用例上(node24-s1 挂「pin carries client ids into rows; edits append fresh rows」、node22-s1 挂「multi-block wire content degrades to derived ids, never a sticky 400」),两边 TAP 都是 tests 3505 / pass 3481 / fail 1 / skipped 23。同一文件在不同 node 版本上挂不同断言 = 典型时序 flake,不是确定性回归;而且这个文件与本 PR 的 diff 完全不相交(本 PR 只动 side-request gate,msgid incremental-lane 的行落盘逻辑零共享代码路径),结构上不可能由本 PR 引入。反过来,6 个目标 dsh 套件不在任何一个红 shard 里(两个红 shard 内 0 命中),它们落在绿的 shard(ubuntu s2/s3 + windows 全部 exit 0 = 全过),即已转绿。我已触发这两个失败 shard 的重跑(rerun-failed-jobs,HTTP 201),清掉这个 flake 后整条应转绿。

判定:本 PR 方向正确、diff 干净(单 commit、4 文件 +47/-4、无 kernel / config-surface / 依赖变更)、目标契约已恢复、无回归。可合——目前唯一的 CI 红灯是与本 PR 无关的 msgid-lane-flow 时序 flake,重跑后应绿;若重跑仍偶发红,那是独立的既有测试基建问题,归 CI 总控 #4599 跟进,不应阻塞本 PR 合并。(合并权在你,我不自行合并。)

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

补充:已触发的重跑跑完了——整条 CI 转绿(run conclusion = success,12 个 test job 全过,含之前红的 ubuntu node22/24 的 shard 1)。这印证了上一条的判断:msgid-lane-flow.test.ts 那次是时序 flake(重跑即清),与本 PR 无关。

至此本 PR:目标契约(BLOCKED-ref / wire-byte)已恢复、6 个 dsh 回归套件转绿、无回归、diff 干净、CI 全绿。可合。合并权在你。

@ranxianglei ranxianglei added bug Something isn't working dsh p1 scope/wiring labels Nov 5, 2026
@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

🔶 需要决策(本车道无法自清这 2 红:需人工重跑 + durable 项归哨兵)
(ai: vllm-qwen/qwen3.8-27b)

结论先行:这 2 个红分片不是本 PR 的代码回归,而是已登记的 msgid-lane-flow 落盘时序(settle-race)负载 flake。本 PR 的修复方向正确、5 个继承红家族已转绿,只差一次人工重跑即可转绿。

为什么判定为 flake(证据)

需要决策 / 行动项(选项 A/B/C)

  • A(推荐,默认):owner/author 在 run 41974076654 点「Re-run failed jobs」(仅 2 个红分片)。零代码改动;本地+windows 已证树是绿的,重跑大概率转绿。
  • B:durable 收敛——把 msgid-lane-flow 及另 3 处固定 sleep settle(tests/seq-interval-lane.test.ts:122 / tests/incremental-lane.test.ts:110 / tests/issue5155-incremental-per-turn.test.ts:167)统一改为有界轮询,或在 ci-failure-shapes.mjs 注册该签名走自动重试。属哨兵/ci-fixes 收敛项(floor 903 已挂起),不宜塞进本 wire-contract PR(单一 scope 纪律)。
  • C:merge origin/ci-fixes —— 否决/no-op(ci-fixes tip 已是本 PR base 的子集,floors 934/938/941)。

默认若无人拍板:A。

结构化八问(本次 run 做了什么)

  1. 是什么问题:该 PR 的两个红分片不是代码回归,而是已登记的 msgid-lane-flow 落盘时序负载 flake。
  2. 什么原因导致的:SessionStore ack-debounce 落盘在 4 路分片 CPU 争用下,afterNextFlush 返回后新行对新建只读连接仍偶发不可见(debounce/coalescing 竞态)。与 PR 无关——PR 只收窄 sidecar 谓词,src/incremental-lane.ts(服务 /__bili/plugin/turn)不直接查该谓词,且失败断言是 timing 读取而非路由结果。
  3. 影响范围与严重程度:仅 CI 稳定性(flaky test),不影响任何运行时行为;触发条件 = 高负载分片下的偶发竞态;严重度 = CI 噪音(p3 级 flake),非功能缺陷。
  4. 怎么修复的:本次未改代码(判定为非 PR 引入的既有 flake;修法归属见选项 A/B)。验证:本地单文件 6/6 全绿、windows-22-1 同文件全绿、5 个继承红家族在本 PR 下已转绿。
  5. 是否有回归问题:无。本 PR 未触碰 persist.ts / 测试时序;BLOCKED-ref / [Bug] dsh 车道切模型 fork 出的 _sub: 会话不继承父会话 fold 块:上游上下文从 ~83K 瞬间膨胀到 794K、命中归 0、节省转负(0.1.187/0.1.188) #2817 / [Bug][dsh] Plugin lane performs a full re-parse and resends the entire body every round (81 MiB → hundreds of MB AST), w | [Bug][dsh] plugin 车道每轮全量解析重发 body(81 MiB→数百 MB AST)是 #5403 OOM 的生产者:用水位线断言替换逐条复核,服务端只解析新增尾段 #5418 由本 PR 恢复并转绿。
  6. 是否破坏缓存:不涉及(纯 CI flake,无任何运行时/缓存改动)。
  7. 是否改了设计方向:不涉及。
  8. 是否引入了新的配置:不涉及。

收工判定:本 PR 代码无需改动;CI 转绿仅需一次人工 Re-run failed jobs(选项 A)。本车道无权限自清(Actions rerun API 返回 403;PR head 在外部 fork,bot 对其无 push),故停手交接。注:needs-decision 标签在本环境无法机械应用(标签 API 端点未实现、tools/add-label.sh 缺失),以本评论作为 stop/handoff 信号——请勿再对本车道自动重试(会撞同样的权限墙)。durable 项已记入 #4599。

@ranxianglei ranxianglei left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

(ai: vllm-qwen/qwen3.8-27b)

Review conclusion: APPROVE

Reviewed independently against base 0aace2f: read the linked issue (#5687), the full diff (4 files, +47/-4), both call sites, the durable-marker table, and the dsh client stamping surface; verified behavior locally (targeted suites only, per house rules).

Direction (original issue)

The reported defect is real and the root cause is correctly located. #5687's gate discriminates "utility sidecar" from "main turn" using no tools present as the load-bearing signal — but a tools-disabled dsh conversation has no action surface on turn 1, where its body shape (system + one user blob) is byte-for-byte the sidecar shape. The first main turn therefore rides the #388 verbatim side lane: the kernel never sees it, no refs are minted, and the BLOCKED-ref (#2419/#2446/#2447/#2481) and wire-byte (#2817/#5403) contracts reset for the session. Fixing the sidecar DEFINITION (what makes a request a utility sidecar) rather than patching symptoms is the right layer.

How the fix holds

Two independent signals, AND-ed at both call sites (src/server/handle.ts:1074-1075 and :2211-2212), each true of utility sidecars and false of main turns:

  1. hasSingleShotBudget — top-level max_tokens ?? max_completion_tokens ?? max_output_tokens numeric, > 0, <= 8192 (host preset: prompt-enhance 4096). Main turns omit the field (openai wire) or size it from the conversation (64000).
  2. carriesDurableState() veto inside isDshSingleShotSidecar — user string / content-array text screened against the existing dshCarrierRawMarkers table (src/durable-message-guards.ts:314, 7 markers). Type-only import, no circular dependency.

Fail-safe direction is correct: any doubt (missing field, non-number, oversized budget, marker hit) resolves to the FULL pipeline — the bug was over-diversion, so erring toward under-diversion is the safe side.

Regression sweep (existing behaviors on the touched paths)

  • Title-gen (#2503) and auto-review (#4438) sidecars: separate pinned gates, untouched — verified by grep; issue5656 e2e phases 1/3 confirm prompt-enhance sidecars still ride the side lane (budget 4096, no markers, refs==0/reqs==0).
  • Main turns WITH tools: already vetoed by the gate pre-change; unchanged.
  • Turn 2+ replays: vetoed by the single-shot body shape; unchanged.
  • Proxy mode and non-dsh plugin lanes: both call sites require the dsh lane (live x-bili-plugin-agent stamp or sticky session.metadata.pluginAgent === "dsh"); unchanged.
  • Kernel / wire / persistence: untouched (no kernel-change declaration, no kernel/ diff).
  • Local evidence: on pristine master the issue2446 suite FAILS (not ok 4 - session-level: the dsh lane stamps the guard onto the effective config) — negative control reproduces the reported defect; at the PR head all six carrier suites + issue5656 + side-lane-invariants pass (21/21 after my additions below).

Behavior change disclosure (old -> new)

  1. dsh tool-less first MAIN turn carrying a conversation-sized budget or a durable-state marker: verbatim side lane (no refs, no compression state) -> full pipeline (refs minted, compression alive). This is the intended contract restoration.
  2. Residual (accepted, documented in-code): a hypothetical sidecar whose pinned budget exceeds 8192 or omits the field would now fall to the full pipeline and could claim the raw-key anchor if it arrives first. No known dsh preset sits in that band (prompt-enhance 4096; title/auto-review have their own pinned gates). A tool-less, marker-free turn 1 with a genuinely small (<=8192) budget still rides the side lane for that one turn — tiny, nothing to compress; the updated comment states this honestly.
  3. Report-only asymmetry: hasSingleShotBudget does not recognize the Google-wire maxOutputTokens. dsh speaks anthropic/openai wires today (verified: no google/generateContent support in src/agent/dsh-native.ts), so no live traffic is affected; adding a speculative field would violate evidence-per-client discipline. If a future dsh build gains a google-wire sidecar, the budget screen silently degrades to full-pipeline (pre-#5687 behavior, no data loss).

Tests

Pinned in BOTH directions per #3617: sidecars keep the side lane (positive e2e), tool-less main turns stay on the full pipeline (negative e2e asserting refs>=1 && reqs>=1), plus the six carrier suites as the regression net. Assertions inspect real session state — no tautologies.

Diff is clean: every line serves the fix, no lockfile/generated churn.

已顺手修:三处注释与收窄后的事实不符(isDshSingleShotSidecar 文档注释拼写、Residual 段仍描述已被本 PR 废除的「首轮走 side lane」行为、测试文件两处 stale 注释)+ hasSingleShotBudget 缺边界单元测试行(8192/8193、三个字段名、缺省/零/负/数字串/null)——commits 78c9db9(fix: align the single-shot sidecar doc comments with the narrowed residual)、c769bab(test: update stale side-lane comments and pin hasSingleShotBudget boundary rows),已推到本 PR 分支;本地定向复跑 21/21 绿。新增 commit 仅含注释与纯增量测试行,CI 将在新 head 上重跑。

Check states: mirror cache at 427778b reports failed=0 / pending=0 (success: lock-sync, guards, matrix shards incl. the previously-flaky msgid-lane-flow rerun, e2e lanes; many jobs skipped per matrix design).

Structured eight questions

  1. 是什么问题:dsh 会话的「无工具首轮」被误判成一次性侧车请求(标题生成/提示词改写那类),被导进逐字旁路车道,压缩引擎从此看不见这个会话——ref 不再铸造、compress/decompress 全部失效。
  2. 什么原因导致的:#5687 的门控用「没有工具」作为主回合 vs 侧车的唯一判别信号;无工具会话的第一轮该信号整体消失,而侧车形状(system + 单条 user)恰好与主回合第一轮逐字同形。
  3. 影响范围与严重程度:dsh 车道、禁用工具的会话、首轮即中招;整个会话压缩能力永久失效(不是体验瑕疵,是该会话核心能力停摆)。
  4. 怎么修复的:把侧车定义收紧为两个独立必须同时成立的信号——小固定输出预算(<=8192,宿主预设 4096)+ user blob 不含持久状态标记(复用 durable-message-guards 既有 7 标记表);任一不满足即按主回合理由走全管道。失败方向安全:存疑即全管道(bug 是过度分流,修复宁可少分流)。
  5. 是否有回归问题:逐项审过——标题生成/自动审查独立门控不受影响;带工具主回合原本就被门控拒绝,不变;第 2 轮起重放不变;代理模式与其他插件车道无 dsh 门控,不变;kernel/wire 未触碰。本地实测:master 上 issue2446 套件红(负向对照复现缺陷),PR head 六个契约套件 + issue5656 + side-lane-invariants 全绿。有意行为变更已在上方披露(旧值→新值 + 原因)。
  6. 是否破坏缓存:没有。恢复的正是 BLOCKED-ref 契约(#2419/#2446/#2447/#2481),它稳定前缀缓存身份;缓存/重试/游标策略本身未变。
  7. 是否改了设计方向:没有。只收紧既有门控的定义,架构/边界/数据流未转向。
  8. 是否引入了新的配置:没有。常量模块私有(SINGLE_SHOT_SIDECAR_MAX_BUDGET=8192),不暴露 config/env。

判定:可合。

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

PR #5709 审核完成:APPROVE(review: https://github.com/ranxianglei/billion-context/pull/5709#pullrequestreview-5782333294)。独立审核:方向正确(把侧车定义收紧为「小固定输出预算 + 无持久状态标记」双信号,失败方向安全)、回归逐项审过无破坏、本地负向对照复现 master 缺陷 + PR head 定向套件全绿;镜像缓存 failed=0/pending=0。已顺手修三处与事实不符的注释 + 补 hasSingleShotBudget 边界测试行,commits 78c9db9 / c769bab 已推到 PR 分支,CI 将在新 head 重跑。无 kernel 触碰、无新配置、无需决策项。

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)
✅ CI 已转绿:本 PR 的两个红分片都是非确定性负载 flake,已通过 rerun-failed-jobs 重跑清除。GitHub 侧 run 41999250333(attempt 2)= conclusion: success,0 个失败 job,head c769babfa。

发生了什么

  • 新 head(c769babfa)相对上一 head 只多了两个提交(78c9db988、c769babfa):注释对齐 + 新增一个 hasSingleShotBudget 边界单测,未触碰任何压缩/重启/sidecar 路由逻辑(行为零变化)。
  • 两个红分片各挂一个不同的测试,均为高负载下的时序竞态:
    • test (ubuntu-24-1):msgid lane flow: pin carries client ids into rows…(落盘 settle-race,与上一 head 同一签名)。
    • test (ubuntu-22-3):restart survival (#5631) → dsh lane (openai chat shape),断言 expected 200 actual 502,错误体 preflight_compress_failed: context ~1602208 tokens exceeds the model window 391808 … 4 compressible range(s) still visible —— 多轮 agent-host 重启循环里某次 preflight 压缩未及时落地,上下文涨穿窗口。
  • shard 号从 (22,1)/(24,1) 变到 (22,3)/(24,1),是因为本次 diff 改了文件权重、LPT 重新分片把这两个文件挪到了更重的分片,抬高了 flake 概率。

为什么判定为 flake 而非回归(证据)

  • 本地对新 head 定向跑这两个文件均全绿:msgid-lane-flow 6/6、issue5631-restart-survival 3/3(含 CI 挂掉的那个 dsh lane (openai chat shape) 子测试)。
  • #5631 在上一 head(427778b14)也是绿的(上一次 run 只有 2 个 msgid-lane-flow 红)。
  • 本 head 的 diff 与失败路径不在一条因果链上(纯注释+单测)。
  • 处置 = 重跑而非改测试:CI wrapper 把两处都判为 concrete「不自动重试以免掩盖真回归」,这是对的;正确动作就是重跑,结果也证实了。

结构化八问

  1. 是什么问题:两个红分片是负载 flake(msgid-lane-flow 落盘竞态 + New test: after repeatedly killing (dsh, pi agent) and restarting, the compression state of long sessions must survive a | 新测试:反复杀(dsh、pi agent)并重启后,长会话的压缩状态必须存活、缓存命中必须能恢复——宿主 CI 与 bili-gate 两边补自动化断言 #5631 重启循环压缩未及时落地),非代码回归。
  2. 什么原因导致的:4 路分片 CPU 争用下的时序竞态;与本 PR 改动无关(diff 仅注释+单测)。
  3. 影响范围与严重程度:仅 CI 稳定性,不影响任何运行时行为;触发条件=高负载分片;p3 级噪音,非功能缺陷。
  4. 怎么修复的:未改代码;本地定向验证两文件全绿后,对 run 41999250333 触发 rerun-failed-jobs(HTTP 201)重跑两个红分片。
  5. 是否有回归问题:无。New test: after repeatedly killing (dsh, pi agent) and restarting, the compression state of long sessions must survive a | 新测试:反复杀(dsh、pi agent)并重启后,长会话的压缩状态必须存活、缓存命中必须能恢复——宿主 CI 与 bili-gate 两边补自动化断言 #5631 上一 head 亦绿;重跑后整条 run = success、0 失败 job。
  6. 是否破坏缓存:不涉及(纯 CI flake,无运行时/缓存改动)。
  7. 是否改了设计方向:不涉及。
  8. 是否引入了新的配置:不涉及。

收工判定:GitHub 侧已全绿,PR 可合并(请 owner 自行 merge)。
⚠️ 附注:e-work 镜像的 upstream-checks 缓存没有反映这次 rerun 的新 check-run(仍显示 failed=2),属镜像滞后;若因此再次唤醒本车道,请直接以 GitHub run 41999250333 为准(已绿),勿重复重跑。durable 项(让这两类 settle 在分片争用下不再抖)已记入 #4599 归哨兵裁量。

@ranxianglei ranxianglei left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

(ai: vllm-qwen/qwen3.8-27b)

Round-2 review @ c769babfa(我在分支上落了两个顺手修 commit 后的复审触发)

自上一受审 head 427778b14 以来的 delta:只有我的两个 house-rule 顺手修 commit —— 78c9db9(src/server/side-request.ts 文档注释对齐;已核实零非注释行改动)与 c769bab(陈旧测试注释修正 + 新增纯函数单测钉住 hasSingleShotBudget 边界行)。零语义变化;以下完整结论由我独立首轮评审沿用,重新锚定到本 head。

正确性(对 base diff 的独立审读)

缺陷(#5687):dsh native 客户端从不打 x-bili-plugin-agent 头,通用 single-shot-sidecar gate 因此把 dsh 会话的第一个无工具主回合(system + 1 user、尚无工具)误判为 sidecar,整回合走逐字旁路车道——内核没看到正文,durable carrier 丢 BLOCKED ref,wire-byte 契约被重置。修复在两个调用点(src/server/handle.ts:1074、src/server/handle.ts:2211)给 gate 追加两个独立判据:小输出预算(hasSingleShotBudget,数值 >0 且 ≤8192)+ gate 内部的持久状态标记否决。两个判据都朝全量管道方向失败(fail-safe,宁多压不漏压)。title-gen 与 auto-review 保留各自独立的钉死 gate。无 kernel/ 改动、无配置面(8192 常量为模块私有)、无新依赖、无 wire 形状变化;proxy 模式与非 dsh 插件车道不受影响。代码过 ⑤b 整洁清单(命名达意、文档注释指向测试、无死代码、风格一致)。

测试有效性

双向钉住(#3617 纪律):sidecar 保持旁路车道(issue5656 e2e,budget 4096、无标记);主回合保持全量管道(负向 e2e,budget 64000,断言 refs≥1 && requests≥1;六个 carrier/wire 套件)。新增单测覆盖边界(8192 含 / 8193 不含)、三个字段名、缺省、零/负数、非数值 fail-safe。阴性对照已验证:pristine master 上 dsh skill-catalog 套件按 bug 报告所述精确变红;本 head 上六个套件 + 两个 side-lane 套件本地定向跑全绿。

本 head 的 CI

两个分片初红,日志级诊断:(a) msgid-lane-flow.test.ts:139 3 !== 4——settle 时序 race,与前一 head 已知 flake 字节同签(当时重跑即绿);(b) issue5631-restart-survival.test.ts dsh 子测试——post-restart preflight race(约 12s 后 502 preflight_compress_failed)。两个文件 diff 均未触碰,且 PR 的全部语义面已在前一 head 被 CI 完整执行过、这两处当时通过——判定为非确定性 flake,非回归。CI 哨兵已就地重跑:run 41999250333 conclusion=success;镜像缓存本 sha:failed=0、pending=0。

行为变更披露(旧值→新值)

  1. 带会话级大预算或任何持久状态标记的 dsh 无工具首主回合:逐字旁路车道 → 全量管道。有意变更——本 PR 存在的目的即是恢复此契约。
  2. 假设中预算 >8192 或无预算字段的 dsh sidecar:旁路车道 → 全量管道(若其先于主回合触发可能认领 raw 会话键锚点)。接受的残留:无已知 dsh preset 落在该区间;title-gen/auto-review 不受影响(独立 gate)。
  3. 仅报告:hasSingleShotBudget 读 anthropic/openai 字段名;假设的 google-wire dsh 客户端需要 maxOutputTokens。降级方向为全量管道(= pre-#5687 行为,无数据丢失)。不在本 PR 扩展——现无此类客户端存在的证据。

八问

  1. 是什么问题:dsh 会话的第一个无工具主回合被误判成一次性 sidecar,整回合走逐字旁路车道,压缩内核根本没看到正文。
  2. 什么原因导致的:dsh native 客户端从不打 x-bili-plugin-agent 头,旧 gate 里 undefined !== "main" 恒真;仅凭「system+1 user、无工具」的单发形状不足以区分 sidecar 与主回合。
  3. 影响范围与严重程度:全部 dsh 会话的首回合——BLOCKED-ref 契约(#2419/#2446/#2447/#2481)与 wire-byte 契约(#2817/#5403)在该回合失效,master 上六个对应套件红;特定条件(dsh 车道首回合)下核心承诺失灵,严重度高。
  4. 怎么修复的:给 gate 在两个调用点追加两个独立判据——小输出预算(≤8192)+ 持久状态标记否决;两判据均朝全量管道方向失败(fail-safe)。
  5. 是否有回归风险:逐项审过的既有行为——title-gen/auto-review 各自的钉死 gate:未动;proxy 模式与非 dsh 插件车道:不受影响(gate 限定 dsh);两种压缩模式:均已推演;wire 形状:未变。CI 两红分片经日志级诊断为已知时序 flake(diff 未触碰的文件;语义面已在前一 head 全量 CI 验证且该两处通过),哨兵就地重跑后全绿(run 41999250333 success;镜像缓存 failed=0/pending=0)。
  6. 是否破坏缓存:不破坏——本 PR 正是恢复 BLOCKED-ref 与 prefix-cache 契约的修复;side-lane 流量只减不增。
  7. 是否改了设计方向:未改——沿用「证据白名单」(evidence-per-client)纪律,仅把 dsh sidecar 的形状证据从单一形状补全为「形状 + 小预算 + 无持久标记」三要素。
  8. 是否引入了新的配置:无——SINGLE_SHOT_SIDECAR_MAX_BUDGET 为模块私有常量,不进配置面,无 env/CLI 新增。

判定:可合。 无 kernel/ 改动、无 kernel-change 声明、无配置面变更;授权边界不涉及。

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

复审完成(head c769bab):APPROVE 已重新提交(https://github.com/ranxianglei/billion-context/pull/5709#pullrequestreview-5784366060)。delta 核实 = 仅我上一轮的两个顺手修 commit(注释对齐 + 确定性单测行,零语义变化);初红两分片经作业日志诊断为已知时序 flake(msgid-lane-flow.test.ts:139 settle race——与前一 head 同签;issue5631-restart-survival dsh 子测试 post-restart preflight race),diff 未触碰这两个文件且语义面已在前一 head 全量 CI 验证过,CI 哨兵已就地重跑转绿(run 41999250333 success,镜像缓存 failed=0/pending=0)。CI 状态行已按惯例补到 #4599。无 kernel/ 改动、无配置面变更、无待决策项——不阻塞合并。

Louie0806 added a commit to Louie0806/billion-context that referenced this pull request Nov 5, 2026
…ual realignment, ranxianglei#5688 output_config dedupe, ranxianglei#5637 acp_delegate stand-down

master advanced 6ddade1 -> 9a2d51d with 14 commits. The one that matters
for this lane is 0470bec (ranxianglei#5718), which realigns five dsh regression pins to
the ranxianglei#5657/ranxianglei#5656 single-shot-sidecar residual: the four durable-carrier suites
now take a second turn and assert on "the first full-pipeline turn", and
issue2817 re-bases stats.requests from 9 to 8.

That is the opposing route to ranxianglei#5709 (which vetoes the misfire in source
instead), but the two do not collide textually: ranxianglei#5718 touches only test files
this lane does not carry, so the merge is clean. Verified on the merged tree
that both routes' assertions now hold simultaneously.
ranxianglei pushed a commit to mariopasquali/billion-context that referenced this pull request Nov 6, 2026
…ake, ranxianglei#5743 ubuntu-24 shard)

msgid lane flow: pin carries client ids... failed at tests/msgid-lane-flow.test.ts:139
with 'an edit lands as a FRESH row' 3 !== 4 on head 4c8a2b5 (run 42218432005).
Same signature as the two reds on head 9c3faf3 and PR ranxianglei#5709 — all went green
on rerun; sibling subtests and the other ten shards passed here. The store's
afterNextFlush verdict is scoped to writes currently queued or in flight, while
the lane wrap-up floats behind the ack (ranxianglei#5155/ranxianglei#3798), so the resync's fresh row
can settle one flush cycle after the first verdict on loaded runners. Bounded
re-probe (four settle cycles, 25 ms spacing > 15 ms debounce) before the strict
assert: a row that never lands still fails, just later — no weakening.
ranxianglei added a commit that referenced this pull request Nov 13, 2026
…ed residual (#5687 follow-up)

The batch's #5709 (PR by Louie0806) narrowed the accepted residual ride of a
tool-less turn 1 onto the verbatim side lane: it now ALSO requires the small
pinned one-shot output budget (utility sidecars pin 4096; agent main turns
omit the field). The fixture's turn 1 omitted max_tokens, so it now correctly
rides the MAIN lane and stats.requests counts from turn 1 — 9 instead of 8.

Turn 1 now carries max_tokens: 4096 so the fixture keeps exercising the
residual path the count pins; the cross-wire persona/fold assertions are
untouched. CI: issue2817-crosswire-persona-fold '9 !== 8' on batch4.
@ranxianglei

Copy link
Copy Markdown
Owner

Landed via batch PR #6482 (merged) — closing as superseded.

@ranxianglei ranxianglei reopened this Nov 14, 2026
@ranxianglei
ranxianglei force-pushed the 2026-11-05_single-shot-sidecar-carrier-veto branch from c769bab to 2153152 Compare November 14, 2026 01:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working dsh p1 scope/wiring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants