Repository navigation
feat: 辅助请求经 anchor affinity 路由到 side-passthrough(#1307 根治,#1309 拍板方案) - #1431
ranxianglei wants to merge 6 commits into
Conversation
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.1746-pr.1431.be3d0fbThis exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr1431.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 Review complete — direction check, regression audit, code/test review, plus one small direct fix. ① Direction (vs #1309 owner decision, floor 8)Implementation matches the approved design point-by-point:
② Regression audit — existing behaviors touched by the diff
No unintended regressions found. The one real behavior change (aux class: full pipeline → side-passthrough) is disclosed old→new and is the owner-approved change itself. ③ Code review findings
④ Test effectivenessStrong teeth, not ceremony: each pinned edge rule has a dedicated unit test (no-poisoning bootstrap, fail-safe fallback incl. front-trim ⑤ Diff cleanlinessSingle feature commit (+ my labeled one-line-scope fix commit above). No version bump, no lockfile churn, no unrelated files, no whitespace noise. Branch was behind master only by the v0.1.158 release commit (version-only) — no real staleness; GitHub reports mergeable. One coordination note: Evidence: CI on 中文一句话总结: 按 owner 在 #1309 拍板的 anchor-affinity 方案审查了辅助请求的 side-passthrough 路由——方向与批准设计逐条吻合、既有行为(#388/#546/#1075/#1312/orphan-GC)均无回归、新测试有真断言且钉住了全部边界规则;顺手修了 413 报错文案对辅助请求的误述(已推送 |
[bot] 🏷 Follow-up: CI on final head 中文一句话总结: 最终 head |
|
Deep-review complete — one significant efficacy hole found and fixed on-branch (rebased onto current master + review commit). Verified
Fixed on-branchF1 (significant): F2: e2e for the true discriminator boundary — a 2-message request carrying a recognized anchor message runs the full pipeline (overlap beats the ≤2 gate); previously only unit-tested. F4: naming disambiguation comment (anchor view vs #1312's remembered view). Gates on-branch: typecheck clean, Non-blocking follow-up
Ready to merge once CI is green. Fixes #1309; supersedes the #1312 stopgap path going forward. |
…vs-remembered naming (#1431 review) - F1: extractWireTexts treated content:null/absent as unrecognized and abandoned the whole view — but content:null is the canonical agent shape for tool-calling assistant turns (our own e2e fixtures send it), so the anchor was never recorded and auxiliary routing stayed silently inert for exactly the sessions it targets. Null/absent now contributes empty text (mirrors the array branch skipping non-text parts; identity rides role + position). - F2: e2e the true discriminator boundary — a 2-message request carrying a recognized anchor message runs the full pipeline (overlap beats the ≤2 gate), not side-passthrough. - F4: one-line comment distinguishing the anchor view (side-request.ts, routing) from the remembered view (#1312 plugin.ts store, write guard).
…extraction (#1431 review) The review fix for content:null (F1) covered the openai/anthropic messages[] branch of extractWireTexts, but the responses input[] branch still returned undefined for a message with null/absent content — the same root cause: one unrecognized message abandons the whole view, so recordAnchorView never runs and routing stays silently inert. content:null is the canonical shape of tool-calling assistant turns on that wire too, and src/loop/adapter-responses.ts already treats non-string/non-array message content as no-text rather than fatal. Parity fix + regression units pinning null/absent content to empty text for both wires.
d33c8d4 to
4d9edeb
Compare
Verification of the deep-review round complete — F1 confirmed significant and correctly fixed, plus two corrections worth recording before merge. F1 — mechanism independently confirmed, fix validReproduced the reasoning against the pre-fix code: the chat-wire loop's Two notes on F1's coverage:
F2 — verified real teethThe boundary e2e sends a 2-message request containing one recognized anchor message and asserts the full pipeline ran (ref 26→27, replay assertion updated 27→28) — overlap beating the ≤2 gate is genuinely pinned, not just unit-tested. Gates on final head
|
|
⏸️ Parked pending the #1314 fact-finding (owner decision). This PR implements the session-identity half of #1314's scope; the OTHER half — whether large auxiliary (auto-review) requests themselves need compression — is disputed and under factual investigation by ework in #1314 (comment). Why hold: if the investigation overturns the current shape assumption (side = no-tools, ≤2 messages, fire-and-forget), the discriminator semantics and the side lane's capability may change — merging now risks reworking the routing twice. The routing's core value (protecting the main session's bookkeeping from aux traffic) is not disputed and will survive any outcome. Out of the merge queue until the #1314 report lands and the owner decides. |
收到,PR 保持 parked、退出合并队列,等 #1314 报告落地后由你拍板。期间分支无需任何动作。 Parked-state notes (so the hold costs nothing later):
No action from me until you un-park. 中文摘要:确认 PR 按 owner 决定 parked(等 #1314 事实调查与拍板),分支停在最新 master 上 CI 全绿;若形状假设被推翻,改动面集中在 side-request.ts 的判别常量与对应测试文件,隔离机制本身不受影响。 |
…te with #1699 agent-intent side routing
|
这个是让auto review穿过不压缩 不是设计目的 关闭 |
Fixes #1309
#1307 止血(#1312)落地后遗留的根因隔离——按 owner 在 #1309 批准的 anchor affinity 设计实现。交叉链接:#1307(源头)、#1314(canonical 根因线程)。
改了什么
正常预算的辅助请求(DSH auto-review / classifier / title-gen:同 session key、无工具、≤2 条消息、全新合成内容)现在路由到既有 #388 side-passthrough 分支:不分 ref、不写 snapshot/remembered、不动 usage/nudge baseline、不喂 orphan-GC。#1312 的写点护栏保留为 routing 之后的 defense-in-depth。
判别器(owner 拍板:anchor affinity 为主,resend latch 降为 bootstrap 信号)
单一决策点
isAuxiliaryRequest(src/server/side-request.ts),当且仅当全部成立时判为辅助 side 请求:anchor 记录
recordAnchorView是 sticky 的:<3 条的视图既不 bootstrap 也不收缩 anchor——pre-main 的 side-shaped 请求无法污染 anchor(pinned edge rule ①)。affinity 失败一律落回今天的完整 pipeline,绝不落入隔离:把主对话误判为 side traffic 是不可恢复的,而让 side 请求漏隔离只是 #1308 时代的现状(pinned fail-safe 方向)。用 membership 而非 positional-prefix 是刻意的:positional LCP 会把 front-trim/编辑过的主轮次(
[tailKnown, new],LCP=0)送进 side lane;membership 让 trim/edit/retry 留在完整 pipeline,同时仍抓住「全新合成 blob」这一生产 review 形态。行为变更披露(旧 → 新)
关于 #1309 标题里的「与 #1075 冲突」:本设计下该冲突消解——#1075 的 light-client e2e(单条主轮次 + side 请求)永远不会 arm latch,其钉死的行为(完整 pipeline、恰好消费一个 ref)逐字保持;
tests/fix-1075-side-request.test.ts在本 PR 中零改动(已验证 diff 为空)。当初 naive shape 分流导致 38 fail 的根因正是这类会话被误分流;latch+anchor 双门保证它们不受影响。另:rebase 时发现 master 已有
reapOrphansLogged(#1206)补上了 orphan-GC 静默 deactivation 的可观测性缺口,我初版里重复的 GC warn 日志已丢弃,本 PR 不改 src/orphan-gc.ts。已知残留 corner(披露,有界)
latch 之后永久把视图 trim 成 ≤2 条全 novel 消息的客户端会被隔离。有界:#1312 护栏仍保护 remembered snapshot,客户端一旦重新发送历史即自愈。已知生产客户端中无此形态。
Pinned edge rules(对应 owner 决定逐条钉测试)
tests/issue1307-side-snapshot.test.ts绿(其 first-write 契约刻意不动——routing 层 gating 取代而非替换它)。证据
tests/auxiliary-side-routing.test.ts,含 2 个过真实 proxy 的 e2e:openai-wire storm 断言连续 3 个 aux 请求下 refs/snapshot/blocks 冻结 + 后续主轮次与 replay 正常恢复;plugin-mode [bug] #388 的侧请求隔离只认「输出预算 ≤ 200」,1 条消息的审查请求冲掉remembered快照,长会话里 plugin 路径的compress全败(Requested range(s) cannot be anchored) #1307 复现断言 aux 风暴下 remembered anchor 存活);build OK。git diff origin/master -- tests/fix-1075-side-request.test.ts= 空。