Repository navigation
[PR] Batch-B integration: fold budget/eligibility — merge #3353 #3943 #3952 #3867 #2660 #3677 (#3916) - #3971
Conversation
…y turn The kernel's range selector keeps advertising spans whose messages are all already covered by active blocks or locked as live checkpoint carriers; the apply side rejects them with the structural 'no new compressible messages' verdict. Preflight's skipSet was per-invocation only, so every request re-derived the same candidates, re-previewed the same dead span, and re-rejected it forever -- wasting per-request work, spamming logs, pinning the auto-fold target above its floor, and (during the 10-minute backoff) resurrecting classic nudges that pushed the model into compress calls which were atomically refused. Remember structural preview verdicts per session (session.metadata, persisted) keyed by startRef:endRef; while the recorded active-block snapshot is unchanged the span can never fold through plain refs, so it is filtered out of candidate lists (preflight walk + relaxed probe) and of the nudge-advertised ranges on all four protocol surfaces. Any block lifecycle change wakes the entries for one re-preview. Structural verdicts are also added to the invocation skipSet (no intra-invocation re-preview), and the auto-fold no-progress backoff only arms when foldable candidates actually existed -- a lean steady state now forwards without backoff instead of cycling backoff -> classic nudge -> refused compress.
…gression Unit suite covers verdict parsing (both wordings, multi-id, truncation, negatives), record/cap/evict, snapshot-subsumption invalidation, exact-key filtering, and metadata persistence round-trip. The integration test builds the minimal production geometry (checkpoint carriers adjacent in the pruned view but separated by covered raws in the full-log history) and asserts: invocation 1 previews+rejects+remembers the dead span exactly once while the foldable tail still folds; later invocations never re-nominate it; an all-dead candidate set reports hadFoldableCandidates=false.
…ate) CI's unused-exports gate (#1440 P6) flagged buildDeadSpanFixture as INTERNAL_ONLY — it is exported but every reference sits inside its own file. Drop the stray `export`; the fixture is consumed only by this file.
A committed fold must never leave a previously-covered message without ANY covering block. On full-resend hosts the kernel's turn-integrity gate judged splits against the fold's own set instead of post-fold coverage, so ids carried by non-consumed sibling blocks were withdrawn from the new block while their source blocks got deactivated - they lost ALL coverage, the processed view doubled (253->519), the local estimate blew past the model window and preflight fail-fasted forever while upstream still had headroom (566K/750K). Add a pre-commit backstop in applyRanges (both relay and plugin lanes share it): measure active-block coverage before vs after on the clone returned by applyCompression; if any previously-covered id loses every covering block, refuse the fold BEFORE committing - state untouched, prefix cache untouched, receipt tells the model why and how to retry. Healthy folds never trip it: fresh folds add coverage, refolds preserve it, integrity withdrawals only touch direct ids of the folded range. Behavior change (disclosed): folds that used to commit while regressing coverage (and then brick the session behind permanent preflight rejections) are now refused with outcome 'refused' / reason 'gate:coverage-regression'. Nothing else changes: the refusal happens strictly before the state commit, so accepted folds, receipts, logs and the #2748 net-shrink gate are untouched. Refs #3322 (root-cause kernel fix follows separately under owner approval).
…ake the clientHint lane comment match sniff reality Review of #3677: the writeOutputBudget block left one indent level deeper than its surroundings after the collapse edit (cosmetic); the call-site comment claimed non-plugin dsh traffic identifies through the sniffed hint, but sniffScanClient yields claude/opencode or a raw UA prefix — never a normalized "dsh" — so the clientHint arm is defensive and matches only a literal "dsh" wire identity. No behavior change.
… reopen oversized forwards (#3846) A locally refused over-window request (deterministic exhaustion -> 413, payload never forwarded) was re-forwarded on retry once the usage baseline demoted to an estimate (preflight-rebuild anchor or failure shrink): probeForEvidence saw baselineFloor=0, ran BEFORE the #726 dead-end check, and forwarded once for 'evidence' - billing the full payload upstream. Growing bodies also defeated the dead-end body-hash key, so every turn re-probed (prod: 606K/620K/633K input tokens, 32K cached each). - noteLocalRefusal() records {origin,model,window} at all three local-413 sites (probe doomed-bytes gate, fresh-session doom gate, final deterministic-exhaustion fail-fast); plain JSON in session.metadata, capped at 16 records, deduped per scope keeping the widest window; survives restart via existing metadata persistence. - localRefusalCovers() suppresses the four forward-once escapes (estimate-only probe, image arbitration immediate+post-fold, #1839 rebuilt-view divergence, #3146 fresh-session escape) at the same or tighter window for the same origin+model. Fitting payloads still forward; other origin/model/larger-window evaluated independently. Evidence is NEVER written into lastInputTokens/Source (it is not upstream usage). No config surface added; kernel untouched.
…3918) The empty-view compress refusal (#3126) promised the view self-heals on the next model request. That promise holds only when the reloaded session survives between requests: releaseInFlight's discharge evicts any session whose live weight plus the other residents exceeds the byte budget, so a large image session ping-pongs out after every cycle and the identical refusal repeats forever - the incident's 444 MiB session under the 512 MiB default against an 87.5 MiB peer. Stamp each eviction with the session's live weight (measurable only at that moment; a disk reload under-measures by exactly the transient mass) and export residentPressure(). When weight + other residents > budget, the receipt and the operator log name the permanent case and give the exits (close the peer / raise sessions.residentMaxBytes) instead of advising an impossible retry. The transient case keeps the exact original wording. The map is advisory-only, capped at 256 entries.
…#3918) A preflight walk that exhausts its summarization budget AFTER committing real folds was reported 502 retryable=false - 'doomed' - although the folds persist in the session and the next attempt starts from a smaller baseline and continues the fold (the incident ran 64 effective folds, every round declared terminal). Non-deterministic exhaustion with compressedRanges > 0 now reports retryable=true and appends a progress note (ranges folded, tokens short of the window). Zero-progress exhaustion keeps today's terminal verdict and dead-end cooldown; deterministic exhaustion keeps its 413 path byte-identical.
The interface is only consumed as the inferred return type of residentPressure() across modules; no importer names it. Dropping the export satisfies the unused-exports CI gate without a waiver.
…t wall, not the window (#3918) Review fix-up for the new ffDetail sentence: limit can be window minus completion reservation (#3450), so naming the gap "short of the window" would repeat the #3663 confusion class in a brand-new string. Uses the subsystem's own term ("gap to the target", src/preflight.ts).
Dual-instance split-brain was invisible by design: the existing defenses (#394 registration warning, #2401 slow-tick peer rescan) fire at STARTUP only, and the actual 'same session committed by two live processes' event produced zero signal — the #3909 incident was found by hand-diffing [v=...] tags in the shared log. F1 (client): noteRoutedOrigin now logs one error line per foreign origin into bili.log on lanes without an owner hook (spawn mode). A baked /bili/ URL passing through to a different origin than state.origin means one conversation is riding two instances. Warn-only: spawn mode has no recovery policy so it never rebinds; attach-lane owner-hook behavior is untouched. F2 (server): each instance records recently committed session ids under <state>/writers/<instanceId>.json (throttled atomic-rename writes, 10-minute contest window, 128-entry cap, stale markers reaped at boot). Hooked at SessionStore.noteOwnCommit — the single choke point every persist commit flows through. Committing a session another LIVE instance committed within the window logs one [split-brain] error per 60-second verdict window naming both sides (pid/origin/version). Observability only: no routing, save, or wire behavior changes.
…rving one session (#3923)
…s every turn (#2638) # Conflicts: # src/preflight.ts # src/server.ts # src/server/prepare-anthropic.ts # src/server/prepare-google.ts # src/server/prepare-openai.ts # src/server/prepare-responses.ts
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.4749-pr.3971.88b63d2This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr3971.tgz
npm install -g packageInstall instructions are refreshed on each push. |
…from master-sync merge)
(ai: vllm-qwen/qwen3.8-27b) 查重:不重复——本条是该 PR 自身 docs-sync CI 失败的自动修复任务,非新问题报告。 已修复并推送: 结构化八问:
判定:docs-sync 修复完成(第 1/2 次尝试),等全量 CI 总判定;若其余车道再红,在本通道预算内继续处理。 |
|
CI 对照结论:本 PR 的失败项与 master 自身当前的红项完全重合,非本分支回归。 master 基线(run 39437368167 @ 860e617)同样失败:
本分支针对性验证(本机):161/161 折叠相关 + invariant-judge 28/28 + kernel #3939 钉 12/12 + tsc 0 + docs/unused-exports 双门 clean。合并时建议以这些门 + 与 master 的失败集 diff 为准,而非矩阵整体绿。 |
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.687-master.f57926c # this exact build
npm install -g billion-context@master # always the newest merged build
|
动机
#3916 B 类("折叠预算/资格判定")批量处理。6 个开放 PR 里 5 个的
src/server.tspreflight 区 hunk 互相包含/相邻,逐个 rebase 会级联冲突——按集成分支一次解算,merge --no-ff保留各 PR 完整提交链与署名。合入内容(6 PR)
progressContinues构造性互斥(f.deterministic同源反相),互补双保留#3847 舍弃:server.ts hunk(3034–3528)完全被 #3867(2645–3617)覆盖,且 3867 另含 320 行测试。
未合入
context_window_fordoes not unpackcontext_lengths; 500K window still falls back to 200K (#3262 follow-up) | Hermes context_window_for 未解包 context_lengths,500K 窗口仍回落 200K(#3262 follow-up) #3703)。验证(基点 1cc1cb8 + 已同步最新 master 550860e)
gen-config-docs generate无漂移;check-unused-exportsclean备注
localRefusals、preflightDeadRanges):只增不改,读侧带 shape 过滤,兼容旧会话文件。Closes #3322
Closes #3438
Closes #3846
Closes #3923