Skip to content

external-summary: consolidate #2646 + #2661 + #2723 + #2761 (fresh budgets, pool knob, concurrent batches, Go session header) - #2806

Merged
ranxianglei merged 13 commits into
masterfrom
2026-10-12_external-summary-consolidated
Oct 11, 2026
Merged

ranxianglei merged 13 commits into
masterfrom
2026-10-12_external-summary-consolidated

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

What

Consolidates the four open external-summary PRs — #2646, #2661, #2723, #2761 — into one reviewable stack (8 cherry-picked commits, conflict-resolved) plus two fusion fixes that only exist because the four land together. Each source PR was independently reviewed first; this PR is the rebased union on current master (d0cebb9) plus the cross-PR semantics.

Fixes #2639, fixes #2657, fixes #2667, fixes #2760.

Why one PR

All four touch the same three files (src/external-summary.ts, src/external-summary-runtime.ts, src/preflight.ts) and their semantics interlock: #2646 (fresh per-call budgets) × #2678 (multi-round batched preflight) interact in exactly the spot #2661's pool knob and #2761's plan plumbing pass through. Reviewer on #2661: "that stack, not this branch, delivers what CONFIGURATION.md promises."

The stack

Fusion fixes (new in this PR)

Worker-pool count uses the scope-aware effectiveConcurrency() (batch options raise the pool via beginScope), fusing #2661's resize semantics with #2678's worker pool.

Verification

After merge

Close #2646, #2661, #2723, #2761 as superseded (their content lives here verbatim or conflict-resolved); #2666 (reasoning tax) remains open and untouched — it needs a typed reasoning knob, deliberately not part of this stack.

@github-actions

github-actions Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-10-12_external-summary-consolidated (ff6a98e)

Option A — Install this exact build (recommended)

npm install -g billion-context@0.0.3116-pr.2806.f460f5a

This exact version is immutable and reproducible. The rolling pr tag tracks the newest test build across all PRs.

Option B — Download artifact

  1. Download the artifact from the Actions run
  2. Extract the tarball and install:
tar xzf billion-context-pr2806.tgz
npm install -g package

Install instructions are refreshed on each push.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 收到,开始按 PR Review 规范审这个整合 PR(#2806):①原 issue 方向核审(#2639/#2657/#2667/#2760)→ ②回归审查(三文件既有行为清单 + 四个源 PR 的语义交叉)→ ③代码逐段精读(fusion fixes f3c55ff/a47b574b 是重点)→ ④测试有效性 → ⑤diff 整洁度。同时核对本地分支与 GitHub head 一致、验证声明的定向测试面。结论会按结构化八问回复。

ranxianglei pushed a commit that referenced this pull request Oct 11, 2026
…ure detail

#2806 review follow-up: when a fold pass stops on the #2657 x #2678 fusion condition (whole batch settled deadline with zero dispatched attempts -> poolQueueDrop), the client-visible failure detail still carried the generic 'each was below minCompressRange, had an unusable summary, or failed to apply' cause even though nothing was ever attempted. Use accurate wording in that case only; all other scenarios keep their existing text (issue1372 + preflight-multi-range wording pins still pass).
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 Review complete — mergeable (head a47b574b: CI 15/15 green incl. all test matrices; local build + targeted battery green). One small review finding fixed directly on the branch (see below) → new head 6d1179aff, CI re-running.

Method — read the full 19-file diff in segments (hot zones: executor scope-pool + worker-pool, preflight nomination/batch/fusion-stop, http Go stamping, settings parse, wire-contract ledger), cross-checked every cherry-picked commit against its source PR by patch-id, and ran the targeted battery locally (not a substitute for CI, which is green).

① Source-issue direction (verified, not taken on faith)

Parity check (patch-id, all 8 cherry-picks): 4 verbatim (#2678 trio + the unused-export drop); 4 conflict-resolved, and each diff-of-diffs contains ONLY the documented resolution:

② Regression audit — existing behaviors on touched paths:

Behavior Verdict
Model-tool path budget semantics kept — single call; executeBatch's shared deadline still bounds the batch
Default runtime when knob unset byte-identical — base pool stays 4 (= old hardcode)
Non-Go outbound wire shape kept — sessionId field omitted when absent; no UA override off-Go (pinned by negative-control test)
Serial walk (single range, emergency digest, sub-2 nominations) kept — renderer/acceptance/net-accounting extracted byte-equivalent into commitFold; walk guards unchanged except the two documented additions (!poolQueueDrop, first-failing-range log)
#2662 backoff policy kept — invocation-level calls>0 && attempts==0 predicate untouched; provider failures (attempts>0) still arm backoff
Kernel / version / lockfile untouched; config-surface guard green (124 leaves)

Intentional behavior changes (all disclosed in the PR body, all verified in code): (a) long preflight folds may now run up to count×totalTimeoutMs instead of fast-failing at totalTimeoutMs; (b) a whole batch dying in the pool queue with zero dispatched attempts now stops the fold pass (walk included) instead of queueing more rounds behind congestion — next turn retries, no backoff; (c) batch failure log reports the first failing range, not slot 0; (d) batch worker count is scope-aware (effectiveConcurrency()).

③ Fusion fixes scrutinized: poolQueueDrop predicate (status==="deadline" && every entry attempts.length===0) fires on empty results too (nothing dispatched) and NOT on partial dispatch — consistent with #2662's invocation-level stats feeding externalQueueDroppedAll. Dense-prefix result assembly, stop-latch (no new dispatches after trip, late successes rejected), grow-only refcounted pool (values <4 validate but never shrink below base) all check out; isOpenCodeGoTarget is host + exact-segment bounded (/zen/go or /zen/go/…, case-insensitive host, /zen/golang excluded — tested).

④ Test validity: all four new suites have teeth — issue2639 (hermetic plan reuse across a lapsed budget; verified to fail without the fix in the source thread), issue2678 (real proxy E2E measuring actual request-interval overlap ≥2, failed-range retry counts, oldest-chunk-first-wave timing, block counts — each assertion fails under the corresponding old behavior), executor-parallel (pool bound, out-of-order alignment, cancel-latch dispatch counting, mocked-clock deadline prefix), WC-016 (validation-parity fake in the ledger per #1304, negative control proving no fabricated session id, BOTH-modes lanes, detection edge table). Rewritten 'ordered fallback chain' assertion is parallel-safe (per-target subsequence order) rather than pinning the bug.

⑤ Diff cleanliness: 19 files, every line in scope; no whitespace churn, no generated artifacts, docs en/zh mirrored.

Small fix pushed directly (小问题直接修, additive commit 6d1179aff): when a pass stops on the new queue-drop condition with zero folds applied, the client-visible failure detail still said "each was below minCompressRange, had an unusable summary, or failed to apply" — affirmatively wrong in exactly the pool-congestion scenario this PR makes diagnosable (nothing was ever attempted; the warn log had the truth but the advisory text didn't). Now names pool saturation in that case only; all other scenarios keep existing text (issue1372 + preflight-multi-range wording pins still pass; local preflight suite 146/146 + tsc clean).


结构化八问

  1. 是什么问题:不是单点缺陷,而是把四个已独立审核的 external-summary 缺陷/需求合并成一个可审整体——(a) 折叠计划构造期一次性时钟导致后续 range 饿死;(b) 进程级摘要池并发写死 4、无配置项,多会话主机成功率 ~7%;(c) 批内 range 严格串行、k 个 range = k 倍墙钟时间阻塞客户端请求;(d) OpenCode Go 摘要目标缺 x-opencode-session 恒 400。外加两个只有四者同落才成立的融合修复。
  2. 什么原因导致的:(a) ConfiguredSummaryPlan 把 deadline 缓存为构造时刻的墙钟点并被所有轮次复用(根因在时钟生产者,非超时表象);(b) 单例 new ExternalSummaryExecutor(4) 无旋钮(根因是表面缺失而非池机制错误);(c) executeBatch 逐个 await(根因在执行器调度形状);(d) 摘要路径只构造鉴权头、会话身份未穿线到请求生成点(根因在身份缺失,非上游问题)。
  3. 影响范围与严重程度:(a) 任何超总时限的 preflight 折叠静默丢弃后续 range——特定条件下完全失效(高负载长对话);(b) 多会话共享主机的 auto-fold/compress 大面积失败——体验级严重(7% 成功);(c) 多 range 折叠墙钟线性膨胀——特定条件下阻塞转发;(d) Go 摘要目标完全不可用。均为「特定条件下有问题」至「特定目标完全无法使用」,无数据损坏面。
  4. 怎么修复的:每次 summarize() 拿全新预算(删构造期时钟);引用计数式只增共享池 + concurrency 旋钮(1..32 默认 4,链值仅在自身工作期间抬升池);批内 worker 池(≤min(effectiveConcurrency, N),结果按索引对齐的稠密前缀,早停闩锁防新派发)+ 每轮多 range 提名(最老整块优先、不毒化多块 range);会话 id 从两个建计划点穿线,仅对显式 Go 目标盖 x-opencode-session + bili 自家 UA(绝不复制客户端入站头)。融合:整批零派发死亡即停折(下轮重试、不触发退避,与 auto-fold backoff arms on pure queue-drops (attempts=[]) as if the summary service had failed #2662 调用级谓词一致)+ /zen/go 段边界匹配。
  5. 是否有回归问题:无意外回归。逐项审过:模型工具路径预算语义不变、旋钮缺省时运行行为字节级不变、非 Go 出站线形不变(负向测试钉住)、串行 walk 路径渲染/验收/净账逐字节等价提取、auto-fold backoff arms on pure queue-drops (attempts=[]) as if the summary service had failed #2662 退避策略未动、kernel/version/lockfile 未触。有意的行为变更 4 处均已在 PR 正文披露且代码核实(见上表下方清单)。另发现并顺手修掉 1 处:纯队列丢弃停折时失败详情文案误指 minCompressRange(commit 6d1179aff)。
  6. 是否破坏缓存:不涉及。持久化格式、去重键、增量游标均未触碰;Go 头部只加在出站摘要调用上,主模型路径与前缀缓存敏感字节(头 system 消息、acp_summary 载体)不变。
  7. 是否改了设计方向:无架构转向——四者全部骑在既有机制上(compress 三级级联、执行器池、wire-contract 台账 WC-016)。唯一扩展是 preflight 从「每轮一个 range」变为「每轮最多 4 个 range 批量提名」,这是 [Feature][preflight] fold several ranges in ONE summary call - preflight currently issues one request per range, sequentially, inside the session lock #2678 的功能本体,已按双压缩模式推理核实。
  8. 是否引入了新的配置:是——compress.externalSummary.concurrency(整数 1..32,默认 4,只增语义:<4 的值通过校验但永不缩池低于 4;不设 = 旧行为字节级一致)。CONFIGURATION.md en/zh 已同步 + Web 编辑器字段;无新 env(彻底整治环境变了滥用,除非必要都走配置文件 #2030 纪律);owner 已在 [Feature] expose external-summary concurrency as config — hard-coded ExternalSummaryExecutor(4) throttles every session on the host #2657 事前批准;config-surface-guard 绿(124 leaves)。

判定:可合。 head a47b574b CI 全绿(15/15,含 ubuntu/windows × node 22/24 矩阵);本地定向电池 external-summary*/preflight*/wire-contract*/issue2639/issue2678 = 320 跑 319 过 0 挂(1 gated skip),config-surface 12/12,tsc/build 干净。我补的小修 commit 6d1179aff 正在新 head 上重跑 CI(改动仅一处诊断文案,本地 preflight 套件 146/146 已过)。合并后请关闭 #2646、#2661、#2723、#2761(superseded,内容已在此分支逐字或冲突解决落地);#2666(reasoning tax)保持打开不动。合并动作本身按规矩留给人工:#2806

ework-agent and others added 13 commits October 11, 2026 23:17
ConfiguredSummaryPlan baked its budget as ONE construction-time wall-clock
point (`this.deadline = performance.now() + totalTimeoutMs`) and capped every
summarize() against it (`remaining <= 0 -> { status: "deadline", results: [] }`).
Preflight auto-fold builds ONE plan per invocation and reuses it across every
range and every round, so once ~totalTimeoutMs of wall-clock had elapsed since
construction, every later range returned "deadline (no result)" without ever
reaching the summarizer — the reported `completed 0/N ... batch=deadline (no
result)` volume. Each summarize() call is an independent batch and now gets the
full configured budget fresh; the model-tool path packs all ranges into one call,
where executeBatch's single shared deadline still bounds the whole batch.

Adds a hermetic regression test (local mock summarizer, real elapsed time) that
reuses one plan across two summarize() calls separated by >totalTimeoutMs and
asserts the later fold still dispatches and succeeds. Verified to FAIL on the
pre-fix code (later fold harvested by the stale deadline) and pass post-fix.
compress.externalSummary.concurrency (integer 1..32, default 4) sizes the process-wide summary pool: every session's preflight auto-fold and model-initiated compress calls share one ExternalSummaryExecutor, whose size was hard-coded at 4. The pool now grows to the largest value demanded by in-flight batches (refcounted scopes) and returns to base when they settle, so chains with different values can coexist; absent key keeps today's behavior exactly.
…gate

SUMMARY_CONCURRENCY_MIN/MAX and SummaryPoolOptions are referenced from no
other module — the gate requires them unexported.
…2667)

executeBatch awaited each work item end-to-end, so the pool bounded cross-session calls but never a single batch: k ranges in one summarize() call still cost k sequential round trips, and the shared per-pass deadline cut multi-range passes off with whole ranges never dispatched. Workers now pull indices from a shared counter so up to `concurrency` items are in flight; results stay index-aligned as the dense prefix of settled ranges, and an early stop (caller abort / any range hitting the shared deadline) latches the workers so unstarted ranges are never dispatched.
The preflight fold pass submitted one external-summary request per range, sequentially, inside the session lock: k viable ranges cost k x ~20-40s of user-visible stall before the shared 180s pass deadline cut the rest off (v0.1.191 evidence: fold passes median 59s, max 180365ms, ~1.85 ranges/pass). A round now nominates up to MAX_PREFLIGHT_SUMMARY_BATCH=4 disjoint ranges (oldest first, largest span each, same preview/content/chunking gates as the walk) into a SINGLE plan.summarize() call that the concurrent executor runs in parallel; successful summaries commit through the same apply path as the walk (commitFold), failed ranges fall through to the serial walk unchanged and get their halving/transient retries there. Log line reports real batch sizes (was hardcoded '1/1 range(s)'). Gated on the external lane and >=2 viable ranges; single-range, legacy-streaming, and emergency-digest paths stay byte-identical.
…nk ranges (#2678)

Review findings on the #2678/#2667 batch-fold change, corrected in place:

- Span selection: nomination took spans[0] of the REVERSED worklist — the
  newest tail chunk — while the mirrored walk pops the oldest full-budget
  chunk first. Now identical (spans.pop()).
- SkipSet poisoning: a rejected preview or empty render during nomination
  added the WHOLE range to skipSet, where the walk only continues to the
  next span. A sub-minimum newest tail therefore killed a range whose older
  chunks were foldable for the rest of the pass. Removed both adds.
- Call accounting: nominations reserved summaryCalls before knowing whether
  the batch would fire (≥2 nominations); a sub-batch set falls through to
  the walk, which reserves its own calls — double booking could trip
  budgetHit early. Reservations now commit only when the batch fires.
- rangesTried counted a range at both sites (nomination AND walk); now
  deduped per range key so the failure detail reports distinct ranges.
…2678)

- New E2E: a multi-chunk kernel range (same-role run with an over-budget
  message and a sub-minimum tail) must carry its OLDEST full-budget chunk in
  the first batch wave and keep folding chunk by chunk (≥5 blocks). Under
  the previous tail-first + poison behavior this fails: the range never
  enters any batch and only the tail range folds.
- New E2E: a batch-failed range is retried across later rounds (≥3
  attempts) while siblings keep folding.
- Corrected the header/test comments claiming every batch-failed range
  'falls through to the serial walk': while siblings fold, retries are
  re-nominations into later batches; the walk takes over only once the
  batch applies nothing in a round.
#2760)

OpenCode Go (/zen/go) rejects independent summary calls lacking a stable x-opencode-session header (HTTP 400 MissingSessionID). The external-summary path built only auth headers, so Go targets always failed.

Thread the session id through both plan-build sites (the compress-tool lane covers plugin+proxy modes; the preflight/auto-fold lane covers growth folding) and stamp x-opencode-session plus bili's own user agent at request generation for explicit Go targets only. It is derived from bili's own conversation id, never copied from the client's inbound session/auth headers. Non-Go targets and legacy preflight are untouched.

Adds WC-016 to the wire-constraint ledger as a header rule with a validation-parity fake and BOTH-modes regression tests.
…ueue

With fresh per-call budgets (#2639) plus multi-round batched preflight
(#2678), a queue-dropped round no longer ends the pass: every later
round builds a fresh-budget batch that queues behind the same holders,
serializing the whole turn behind pool congestion (observed: a 500ms
budget turn burning 2.5s of rounds and finally dispatching into the
freed pool mid-test). A round whose entire batch settles deadline with
zero dispatched attempts is scheduler congestion: stop the pass right
there — the serial walk is skipped for the same reason — and let the
next turn retry into a drained pool. Zero attempts keeps the #2662
no-backoff path (queue-drop != chain failure) intact.

Also disclose in CONFIGURATION(.zh-CN).md that the concurrency knob is
grow-only (values 1..3 cannot shrink the pool below the default 4) and
update the pool-saturation paragraph to the no-backoff semantics; fix
the stale 'ConfiguredSummaryPlan clock' comment in
external-summary-surface.ts (#2646 review).
isOpenCodeGoTarget matched any /zen/go* prefix, so a hypothetical
/zen/golang endpoint would also get the x-opencode-session stamp.
Match exactly /zen/go or /zen/go/... and pin the boundary with tests
(#2761 review, minor 1).
…ure detail

#2806 review follow-up: when a fold pass stops on the #2657 x #2678 fusion condition (whole batch settled deadline with zero dispatched attempts -> poolQueueDrop), the client-visible failure detail still carried the generic 'each was below minCompressRange, had an unusable summary, or failed to apply' cause even though nothing was ever attempted. Use accurate wording in that case only; all other scenarios keep their existing text (issue1372 + preflight-multi-range wording pins still pass).
…es (#2806 review)

fork-adoption-wires + issue2033-anonymous-anchor drive ANONYMOUS clients whose
identity rides prefix-affinity.json in the shared default state dir. Without
isolation they hydrate foreign chains written by sibling test files running
concurrently in the same CI job and co-write the file underneath each other;
once this stack added four more test files (incl. heavy multi-proxy e2e) the
interference flipped both suites' assertions on all four CI nodes while every
parent tree stayed green. Isolate with the established #2719 idiom.
…review)

The zero-block scan iterates EVERY forked session in the process-wide
table (src/session.ts module Map, cap 256 — no eviction at these sizes,
and setRegistryForTest is the models.dev catalog, not sessions). Sibling
wire scenarios above leave their adopted forked children in that table;
on loaded runners those children can carry blocks from load-shifted
compress demands, flipping the scan. Reset the table to this scenario's
scope before booting — same idiom as fork-side-request-lane.test.ts and
issue2407-google-khat-lane.test.ts. On clean runners siblings' children
stay block-less so the old global scan passed; the reset makes the
assertion immune to either outcome.
@ranxianglei
ranxianglei force-pushed the 2026-10-12_external-summary-consolidated branch from 6d1179a to ff6a98e Compare October 11, 2026 15:31
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 CI 红已定位并修复,新 head ff6a98e84 已推送,等 CI。

先更正我上一条回复里的错误:失败的不是 issue1372/issue2678(我读错日志),实际红的是两个 master 既有的匿名前缀亲和 e2e 套件(node-22/24 + windows 全挂,guards 全绿):

  1. tests/fork-adoption-wires.test.ts — "forkAdoption disabled leaves the responses fork at zero compression state"(blocks.length 1 !== 0)
  2. tests/issue2033-anonymous-anchor.test.ts — "[Gap] Anonymous failure fallback can bypass an existing usage-grade anchor #2033 A1: anchored anonymous session keeps sizing on the usage anchor after a failed turn"(anchor.kind 变 fallback)

按八问:

  1. 是什么问题:这两个套件在「同进程多场景 + 共享默认状态目录」下对全局状态敏感;stack 新增 4 个测试文件后 runner 负载/状态搅动上升,断言翻转。产品行为无变化。
  2. 什么原因导致的(分层):① 本 PR 代码不背锅——10 个提交逐行审计,batch 路径全部由 deps.externalSummary 门控(这两个套件都没配 externalSummary),commitFold 提取与原串行提交逐字节等价;② 真正的脆弱点:disabled-adoption 断言扫描的是全进程 forked session(src/session.ts 模块级 sessions Map,cap 256、这个量级不会 LRU 驱逐;测试里的 setRegistryForTest 其实是 models.dev 目录注册表,不是 session 注册表——命名误导),兄弟 wire 场景的 adopted 子会话留在表里,负载把 mock upstream 的一次性 compress 需求位移后,这些子会话也可能带块 → 断言翻;③ 两套件还共享默认 XDG 状态目录(CI 日志可见 hydrated N chain(s) 从 26 涨到 31——并行测试文件在共写同一个 prefix-affinity.json)。本地复现证实了②(探针 dump:断言时刻表里有 10 个 session,失败块来自兄弟场景残留)。
  3. 影响范围与严重程度:仅这两个 e2e 套件的可靠性(高负载/多文件并行时偶发翻转);对使用者零影响——纯测试改动,2 个文件 +35 行。
  4. 怎么修复的(两个独立标注 commit,均在 PR 分支上):
  5. 是否有回归问题:测试专用改动,不碰产品语义;tsc clean;定向 battery(external-summary*/preflight*/wire-contract*/issue2639/issue2678/settings)= 320 tests 319 pass 0 fail 1 gated skip;build OK。更早的小修 000abe052 只改 queue-drop 场景的 failure-detail 文案(旧文案在该场景是肯定性错误——说每个 range「too small/unusable」,实际一个 summary 调用都没发出过)。
  6. 是否破坏缓存:不涉及。
  7. 是否改了设计方向:不涉及。
  8. 是否引入新配置:不涉及(XDG_* 是标准变量,只在测试进程内设置)。

诚实声明:本机是舰队共享盒子(常驻环境负载),A1 的 anchor 漂移在本地仍 100% 复现(hermetic 之后也一样)——本地无法完全模拟干净 runner;hermetic 隔离针对的是 CI 日志实证的跨文件搅动向量,session-reset 修掉的是确定性污染路径。若新 head 的 CI 里 A1 仍红,下一步拿完整 TAP 错误定位 anchor 漂移的具体路径再处理,不会带红合入。

判定:等 ff6a98e84 的 CI 结果;绿则可合(原四源 PR 合并后按 issue 计划关闭,#2666 不动)。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 Review 收工 — 最终判定:可合并。

最终 head 64b6b7365(已 rebase 到最新 master 68e76757c,含 #2812 affinity 回归修复)。CI run 38152971887 13/13 全绿(9 guards + ubuntu/windows × 22/24 四个测试矩阵 job);mergeable=true, mergeable_state=clean。本地同树验证:tsc 干净、定向电池 320 tests(319 pass / 1 gated skip)、两个受害 e2e 套件 6/6 ×2 连跑。

结构化八问(覆盖整个 PR,不只 CI 事故):

  1. 是什么问题:审查对象是把 fix: give each external-summary summarize() call a fresh budget (#2639) #2646/feat(#2657): expose external-summary pool concurrency as config #2661/fix: fold several preflight ranges in ONE external-summary call (#2678, #2667) #2723/fix: stamp x-opencode-session on OpenCode Go external summary requests (#2760) #2761 四个 external-summary PR 合并成一个可审栈(8 个 cherry-pick + 2 个 fusion fix)。审查中另发现一个真实问题:新 head 首次推上 CI 后四个测试矩阵 job 全红。
  2. 什么原因导致的:PR 本体无缺陷——逐 commit 与源 PR patch-id 比对全部吻合(verbatim 或已披露的冲突消解:仅 [Bug][external-summary] batch deadline harvests queued ranges ("completed 0/N; batch=deadline (no result)") — per-range truth lost, whole-batch refusal, fold-reconcile drift #2639 保留 master auto-fold backoff arms on pure queue-drops (attempts=[]) as if the summary service had failed #2662 stats 行、[Bug][external-summary] ranges in one batch are summarized sequentially — concurrency only applies across batches (6 ranges = 85 s on the request path) #2667 一处 deliberate 改为 scope-aware effectiveConcurrency())。CI 红的根因与 PR 功能代码无关:两个匿名 affinity e2e 套件(fork-adoption-wires、issue2033 A1)既不隔离 XDG 状态目录、也不清进程级 session 表(setRegistryForTest 实际是 models.dev catalog 的 seam,命名误导),其断言全局扫描所有 forked session;本栈新增 4 个测试文件抬高了并发与状态搅动,把这条既有脆弱路径踩中。对触发 commit 做了逐行审计:无 externalSummary 配置时行为惰性,排除语义回归。
  3. 影响范围与严重程度:仅 CI 假红(测试隔离缺陷),无生产行为影响、无用户面影响。严重度:合并阻塞级,非产品缺陷。
  4. 怎么修复的:按仓库既有惯例修隔离而非改断言语义——① 两个受害文件加 hermetic XDG prologue(mkdtemp + 四个 XDG_*_HOME,test.after 清理,fix(#2601): model-switch lineage — churn-tolerant chain continuity + persona-fork routing follow #2719 idiom);② disabled-adoption 测试内补 _resetSessionsForTest() 把断言圈回本场景(fork-side-request-lane 等文件的既有 idiom);③ rebase 到含 fix(affinity): append-continuation rung + hv2 ladder preference (#2807 regressions) #2812 的最新 master(该修复正是同一 affinity 子系统的回归补丁,受害套件恰好压在这条路径上)。另有一个独立小修 commit:poolQueueDrop 零折叠失败详情文案从笼统 exhausted 改为明确点名池饱和(e1726517b)。
  5. 是否有回归问题:逐项过过——fresh budget([Bug][external-summary] batch deadline harvests queued ranges ("completed 0/N; batch=deadline (no result)") — per-range truth lost, whole-batch refusal, fold-reconcile drift #2639)、pool knob([Feature] expose external-summary concurrency as config — hard-coded ExternalSummaryExecutor(4) throttles every session on the host #2657)、worker-pool batch([Bug][external-summary] ranges in one batch are summarized sequentially — concurrency only applies across batches (6 ranges = 85 s on the request path) #2667/[Feature][preflight] fold several ranges in ONE summary call - preflight currently issues one request per range, sequentially, inside the session lock #2678)、Go session stamp(fix: stamp x-opencode-session on OpenCode Go external summary requests (#2760) #2761)、fusion stop-fold-on-queue-death、/zen/go segment-bound,全部只在其门控路径内生效;单 range/legacy 路径字节等价;describeExternalSummaryFailure 单结果批次输出不变;auto-fold backoff arms on pure queue-drops (attempts=[]) as if the summary service had failed #2662 invocation-level backoff 语义未被触碰。本地电池 + tsc + build + CI 全绿佐证。有意行为变更(各源 PR 已披露,此处汇总):summarize 预算从构造期共享 deadline 改为每次调用全新(长折叠最坏 count×totalTimeoutMs,不再 50s 快速失败);新增 concurrency 旋钮(默认 4,与旧硬编码相同,grow-only);batch 内并行(≤N ranges in-flight,失败序仍索引对齐);OpenCode Go 目标请求新增 x-opencode-session + bili UA(仅显式 Go 目标,其余 wire shape 字节不变)。
  6. 是否破坏缓存:否。prefix cache/fold cache/nudge 语义未动;Go stamp 是增量且按目标限定;session-id 线程化只进 plan 不进 wire 身份逻辑。
  7. 是否改了设计方向:否。完全沿用现有架构(scope 池、plan plumbing、三级 compress 级联),无边界转向。
  8. 是否引入了新的配置:是,一项——compress.externalSummary.concurrency(整数 1..32,默认 4,grow-only;走三级 compress 级联,按 彻底整治环境变了滥用,除非必要都走配置文件 #2030 纪律不设 env 变量;越界 fail-loud)。CONFIGURATION.md/.zh-CN + web editor 字段均已同步。迁移方式:无需迁移,默认值即旧硬编码值。

诚实备注:本机是共享舰队机,裸 master 在 ambient load 下同样会偶发这两个套件失败(非本 PR 引入,未在本 PR 处理;hermetic 化已消除跨文件状态串扰这一确定性污染源,残余 load 敏感性如再出现建议另行立项)。

合并后收尾(按 PR 正文):关闭 #2646、#2661、#2723、#2761 为 superseded(内容已逐字或冲突消解地收入本栈);#2666(reasoning tax)保持打开不动。合并操作本身按规约由人工执行:#2806

@ranxianglei
ranxianglei merged commit 1e71738 into master Oct 11, 2026
16 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

📦 Merged Build Published

This merge to master was published as 0.0.291-master.1e71738 (rolling master tag).

npm install -g billion-context@0.0.291-master.1e71738  # this exact build
npm install -g billion-context@master  # always the newest merged build

npm view billion-context@master prints the current version at any time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment