Repository navigation
fix: don't arm the auto-fold backoff on pure queue-drops (#2662) - #2665
Conversation
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.3027-pr.2665.22203a9This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr2665.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 PR #2665 review([PR] 类型:不重做,拉分支逐行核对代码 + 核查 CI) 结论先行:方向正确、修在根因、测试有牙、diff 干净,可合并——待两个 Windows 单测矩阵 job 转绿即合(新增测试正跑在那里)。我顺手推了一个标注的 cosmetic commit( 结构化八问
行为变更清单(必须披露 old→new)
测试有效性(§④:真测试还是假测试)
小问题处置
CIreview 时点(head 收工判定可合并——待新 head 的 CI(尤其单测矩阵)转绿即合。方向对、修在根因、双压缩模式都考虑过、行为变更已披露、测试有牙、diff 收敛到目的本身。 |
The two auto-fold backoff arm sites keyed off compressedRanges/fold progress only, so a batch dropped by the saturated shared pool before any summary call dispatched (executeBatch status deadline/cancelled, attempts=[]) looked identical to a real provider failure and cost the session 10 minutes of auto-fold (AUTO_FOLD_BACKOFF_MS) exactly while the host was congested. Propagate dispatch telemetry from ConfiguredSummaryPlan.stats through PreflightResult.externalDispatch, add the externalQueueDroppedAll predicate (calls>0 && attempts===0), and let both growth-fold arm sites distinguish scheduler congestion from chain failure: pure queue-drops log a distinct warn and do NOT arm the cooldown, so auto-fold retries on the next turn. Provider failures (>=1 attempt dispatched) and classic non-external preflights behave exactly as before.
9542112 to
9681b01
Compare
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.273-master.2e95ed4 # this exact build
npm install -g billion-context@master # always the newest merged build
|
Closes #2662
来源: #2657 分析 external-summary 并发池配置化时发现(issue 自带来源标记)。相关但不同机制:#2661(池大小可配置——缓解拥塞本身)、#2639(deadline harvest)——均不在本 PR 范围。
Behavior change disclosure (old → new)
Old: a growth-armed auto-fold request that ended with zero folds (site A) or short of
autoFoldTargetTokens(site B) ALWAYS armed the 10-minuteAUTO_FOLD_BACKOFF_MScooldown — regardless of why nothing folded. A batch dropped by the saturated process-wide pool before any summary call dispatched (executeBatchstatusdeadline/cancelled, allattempts=[]) was indistinguishable from a real provider failure, so congested hosts lost 10 minutes of auto-fold per pure queue drop — the oscillation #2657's reporter observed (32/402 batches, allattempts=[]).New: dispatch telemetry flows from
ConfiguredSummaryPlan.statsthroughPreflightResult.externalDispatchto both arm sites. A pure queue drop (calls > 0 && attempts === 0) logs a distinct warn line ("no summary attempt was ever dispatched … congestion, not a chain failure — NOT backing off") and does not arm the cooldown; auto-fold retries on the next turn. Any fold that actually dispatched at least one candidate call (provider error / timeout / invalid summary) arms exactly as before. Classic non-external preflights are unchanged (externalDispatchabsent → predicate false).Why: a queue drop is scheduler congestion — transient by nature, cleared by the pool draining. Cooling down for 10 minutes punishes the session exactly while the host is most loaded. The backoff exists to cool down against chain failures, which requires evidence that a call was attempted.
Changes
src/external-summary-runtime.ts:ConfiguredSummaryPlan.stats = { calls, attempts }incremented insummarize()(both the early-return deadline path and post-batch);_executorForTestseam for deterministic pool saturation.src/preflight.ts:PreflightResult.externalDispatch?: { calls, attempts }, set when a chain ran.src/external-summary-surface.ts:externalQueueDroppedAll(dispatch)predicate with policy docstring.src/server.ts: both growth-fold arm sites split into queue-drop (distinct warn, no arm/markDirty) vs existing behavior (warn +armAutoFoldBackoff+markDirty).Tests
auto-fold backoff: a pure queue-drop (zero dispatched attempts) does NOT arm the cooldown — the next turn retries(tests/external-summary-autofold.test.ts): saturates the real pool with 4 holders, asserts ZERO HTTP summary calls on turn 1 (pure-drop proof), releases the pool, then asserts turn 2 DOES dispatch and fold (old code would show 0 external calls here).calls>0, attempts=0; dispatched-but-failing attempts are NOT queue drops;externalQueueDroppedAlltruth table.false && queueDroppedAll) makes the new e2e fail withbackoff must NOT have armed on pure queue-drops; expected external calls on turn 2, got 0— the test pins the regression.tests/external-summary-*.test.ts+tests/*preflight*.test.ts→ 278 pass / 0 fail / 1 gated skip; typecheck clean. Full suite left to CI.Scope notes
PreflightResult(an internal value, not a wire artifact). The exception applies wherever the growth-fold arm sites run — the only placesAUTO_FOLD_BACKOFF_MSis armed.