Skip to content

[PR] merge: tier-4 train — dsh/cache domain rework (7 PRs incl. p1 #3307/#3301/#3890); kernel straggler from #3680 reverted per boundary - #4572

Merged
ranxianglei merged 17 commits into
masterfrom
2026-10-24_tier4-dsh-train
Oct 24, 2026
Merged

ranxianglei merged 17 commits into
masterfrom
2026-10-24_tier4-dsh-train

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

这是什么

第四列车:dsh/缓存域的 7 个 PR 重放(含 3 个 p1)。合并方式请选 Merge commit。

车上清单

原 PR 修的 issue 重放要点
#3474 #3472 MCP structuredContent 全文;live-files 注册并集
#3555 #3536 favicon 空图标声明(master 版页面为超集,取 PR 侧)
#3247 #3243 promptPack 工具描述 + #3252 绑定注记双层包装;测试断言改 startsWith
#3333(全 7 提交) Closes #3307 (p1) acp-cache 报告 WIRE/UPSTREAM/RESTART 分节 + V 基数换活视图(P1)+ 折叠重付归因(P2-A);与 master #4227/#4224 的并集 map 织合,测试夹具 id 对齐生产语义(两视图同 id)
#3316 Closes #3301 (p1) wire 形状翻转后从统一存储分解行重建锚;ReconcileOptions 双选项并集、shadow facade 适配 #3931 后端架构
#3680 Closes #3675 compress 键误放 route root 的静默失效警告;与 master #3632 同区域并集。注意:该分支堆叠了一个 kernel 提交(#3538 提示词变更),已按 Kernel Boundary revert,留在 kernel 人工轨道
#3902 Closes #3890 (p1) 父进程死确认(连续探针);import 并集

边界声明

验证

#3307 5/5、#3301 22/22、#3243 3/3、#3472 6/6、cache-ledger 族 7/7;全量以 CI 为准。

关单

Closes #3472, Closes #3536, Closes #3243, Closes #3307, Closes #3301, Closes #3675, Closes #3890

未上车(下趟列车5的料)

#3045 #3440 #3460 #3592 #3746 #3880(挑失败需 merge 收编) #3951 #3954 #3907 及 4044/4061/4062/4263/4136-4142/4410/4442 等重活

awork and others added 16 commits October 24, 2026 22:14
…3243)

handlePluginManifest now takes an optional ToolPrompts surface and applies
it to the ACP core tool arrays exactly like the wire injector; the admin
manifest endpoint resolves it from the global compress settings via
resolveCompressSurfaceDetailed. Registered plugin tools previously always
carried kernel-default descriptions regardless of compress.promptPack —
now they follow the top-level pack. Provider/model-level promptPack still
shapes per-request system prompts only (the manifest has no route/model
context, #1192 conservative boundary). Regression tests pin lean-pack
descriptions on all three wires, unchanged defaults without a pack, and
the route-level-only boundary.

(cherry picked from commit e5d2470)
wire/upstream/restart already carried per-event data in the cache report
(switchEvents / restartEvents) but handleAcpCache only ever rendered their
aggregate counts in CACHE INVALIDATION — no per-line timestamps, so
seam-vs-restart cross-checks (e.g. #3416 273->28 vs the 10 restart/refork
events) were impossible to run off the report. Surface them exactly like the
existing MODEL/KEY/PROMPT/PROJECTION sections. Refs #3307.

(cherry picked from commit 5bdc878)
A host metadata-table refresh can re-serialize every past thinking turn of
one session in a different wire form (reasoning_content field vs reasoning
spliced into content), minting new ids for unchanged content. Fold re-anchor
then reports 'covered id(s) missing with no anchor match' on every request:
the turn-key pass only understood bare-concat merges, and pre-#2644 anchors
lack p/x entirely — while the wire-side backfill can never fire because the
flip puts the old id off the wire on the very pass that also rolls the order
backbone forward without it.

- fold-reconcile: extractThinkingMerge mirrors the kernel's demoted-thinking
  FORMS so merged-form cores register the same turn keys as split-form
  anchors (turnContexts + Pass 3 candidate side); ReconcileOptions.storedMessages
  rebuilds eligible legacy anchors from stored decompositions BEFORE the plan
  runs, so the flip pass itself claims.
- storage: UnifiedStore.messagesForIds (+seq±1 neighbors for rc-pair
  adjacency), shadow/persist pass-throughs gated on full mode.
- new fold-decomposition-lookup: per-pass capped lookup with a tried-set
  (index absence is stable, index unavailability retries).
- import entry: record/session/ingest carry an optional decompositionLog
  (external converter payload) interned first at ingest; consume-once at
  save keeps the #3133 delta fast path intact; buildRecord never emits it.

No new config surface. Additive optional fields only (ReconcileOptions.
storedMessages, LegacySessionLike.decompositionLog, PersistedSession.
decompositionLog) plus an internal metadata bookkeeping key foldStoredTried.
No kernel/ changes.

Fixes #3301

(cherry picked from commit b5756bb)
…re force-exit (#3890)

Two independent defects made the proxy self-terminate on Windows while its
parent lived on (12 events in 2.5h against one live pid):

1. The watchdog removed a watched pid from the set on a SINGLE failed
   kill-0 probe; the empty-set grace window that followed never re-probed,
   so one transient OpenProcess failure (Windows maps every non-ACCESS_DENIED
   failure to ESRCH — indistinguishable from a real death) force-exited the
   proxy ~6s later. Death now requires WATCHER_DEAD_CONFIRM_TICKS (=3,
   ~4-6s at the 2s tick) CONSECUTIVE failed probes; any live probe resets the
   streak. Heartbeat-expiry removal (#3544) keeps its immediate semantics.
   First failure of an episode logs the errno ([watchdog] kill-0 probe failed
   for pid N (code=...)) and recovery from a false alarm logs one line, so
   field episodes can be attributed. probePid() in instance.ts carries the
   errno; isPidAlive() is unchanged.

2. shutdown()'s hard backstop force-exited 10s after the signal regardless of
   live connections, cutting in-flight upstream streams mid-response. While
   connRecords are still alive the window now RE-ARMS, bounded by
   SHUTDOWN_DRAIN_MAX_PASSES (=10, worst-case total drain ~110s); then it
   force-exits exactly as before (the zombie backstop is preserved). Idle
   keep-alives don't hold the proxy — the keep-alive reaper clears them within
   one window, so a healthy drain still exits promptly.

Behavior changes (old -> new):
- owner-death -> exit latency: +up to ~6s (confirmation window)
- shutdown backstop: unconditional 10s force-exit -> re-arms up to 10 extra
  passes while liveConns > 0, worst-case ~110s total, then force-exit as before
- new log lines: [watchdog] kill-0 probe failed / pid N alive again /
  extending drain k/10

Tests: new suite pins tickWatchedPid (blip <3 survives, 3rd consecutive
removes, recovery resets, heartbeat path unchanged, dead pids never take the
heartbeat fast path) plus a LIVE child-process test proving the backstop no
longer force-exits at 10s with a connection held open (verified to FAIL on
pre-fix master: 'pre-#3890 behavior force-exited at 10s'). claude-native
live-lane deadlines re-sized 15s->30s and the watcher-route grace phase
re-timed for the wider confirmation window (ACP_TEST_CLAUDE_NATIVE-gated).

(cherry picked from commit 3b8e4b3)
)

detectSeam pushes both the #3023 client-side rewrite and the legacy suspected-rebuild fall-through into one shared capped ring (led.seamEvents); formatSeam's CACHE SEAM section iterated every event without filtering, so a host-owned client rewrite was also listed under the 'suspected mid-history prefix breaks' header. List only non-client events there so the two sections stay disjoint.

(cherry picked from commit 4db43b0)
…on forensics

start_ref, so the V' fallback is not the trigger: decomposeSample drops the
fold when bestX = prefixTokensBeforeRef(start) >= billed input, zeroing
structuralExcess. That value is in-memory (tokenSnapshot) and never persisted,
so it cannot be reconstructed from the blocks table after the fact.

Emit one [acp-compress-obs] fold-attribution line per fold carrying the actual
X per block plus the same-space view tokens V/Vp. Cross-referenced against the
ledger's billed input it separates the two candidate inflation sources: unit
scale (kernel chars/4 estimate vs provider-billed tokens) vs view identity
(snapshot tracked on a larger view than the shrunken outbound). Pure logging;
no behavior change.

(cherry picked from commit cfb2d31)
…view-factor forensics

(cherry picked from commit 3a1541c)
…end (#3307 P1)

V now measures the LIVE context being managed (ctx.messages / processedMessages, what gets billed next); applyCompression still runs on compressMessages (raw boundaries, #2627) so fold geometry is unchanged. The fold-attribution log now reports V(live) vs Vraw(inbound) so one capture shows the collapse.

Behavior change (intended, disclosed): in stateless-client proxy sessions shrink% rises from the degenerate ~1% to its true value; the degenerate-fold gate (DEGENERATE_FOLD_COVERAGE=0.8) and the maxShrink advisory go from effectively-never-firing to firing correctly; postCtx and the next-request cache ceiling are computed from the live view. Unchanged when there is no separate raw resend (messages == compressMessages), which is what every existing unit test exercises.

Regression: tests/issue3307-fold-view-basis.test.ts pins V = live view across single/multi-level folds, verifies Vp === V - S (same-view net change), and keeps the messages==compressMessages baseline unchanged.
(cherry picked from commit e31661f)
…nflated snapshot (#3307 P2-A)

#3307 P2-A: the snapshot-based fold prefix X (prefixTokensBeforeRef over the client un-shrunken resent history) exceeds the billed input for a stateless proxy client, so decomposeSample zeroes structuralExcess and the fold re-pay falls into the unattributed seam bucket. When a genuine bili-side mid-history break is present, measure the stable prefix off the wire (byte-LCP of this outbound vs the previous, scaled to billed input) and min() it into X before decomposeSample, so the fold is credited again instead of crying a false seam.

Gated to mid-list breaks only (a tail append lands the LCP near the end -> xMeasured ~= input -> no effect) and never on a client-side inbound rewrite (#3023), whose earlier divergence would understate and mis-credit the fold. Host-side only -- no kernel change; decomposeSample is called as-is with the corrected firstFoldStartTokens.

Regression: tests/issue3307-fold-attribution-wire.test.ts pins attribution for the inflated-X mid-history fold plus both guards (tail-append not credited; client rewrite stays client-side, not fold).
(cherry picked from commit da6834e)
…shrank it) (#3307)

The multi-level P1 test held the live view constant across folds, so it did not cover the re-fold topology the #3307 GO called out (a fold whose live view already embeds an earlier summary and is smaller than the raw resend). Add a case that shrinks ctx.messages after fold-1 and asserts fold-2 V tracks that current view, never the raw resend or a stale snapshot.

(cherry picked from commit fad2033)
@ranxianglei ranxianglei changed the title merge: tier-4 train — dsh/cache domain rework (7 PRs incl. p1 #3307/#3301/#3890); kernel straggler from #3680 reverted per boundary [PR] merge: tier-4 train — dsh/cache domain rework (7 PRs incl. p1 #3307/#3301/#3890); kernel straggler from #3680 reverted per boundary Oct 24, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📦 Merged Build Published

This merge to master was published as 0.0.823-master.2e70520 (rolling master tag).

npm install -g billion-context@0.0.823-master.2e70520  # 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.

@github-actions

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-10-24_tier4-dsh-train (fb34510)

Latest build — install this exact version

npm install -g billion-context@0.0.5530-pr.4572.7ad0812

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

Recent builds (commit → version)

commit version build
fb34510 billion-context@0.0.5530-pr.4572.7ad0812 build

Download artifact

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

Install instructions are refreshed on each push.

ranxianglei pushed a commit that referenced this pull request Oct 24, 2026
…small fix)

DecompositionSource (fold-decomposition-lookup.ts) and WatcherTickDecision
(server.ts) are referenced only inside their own files - zero external
usages across src/tests/kernel/pi-subagents. The unused-exports gate flags
both INTERNAL_ONLY once the #4572 train landed on master. Dropping the
export modifier is behavior-neutral (typecheck clean); StoredRow stays
exported (has an external consumer).
ranxianglei pushed a commit that referenced this pull request Oct 24, 2026
…from #4572 train (#4559 small fix)

The train added the external-summary config surface but the committed
generated docs predate it, so docs-sync regenerated one new table row
(compress.externalSummary) in each of the four derived files. Mechanical
regeneration via tools/gen-config-docs.mjs - no hand edits.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The favicon.ico request in the dsh settings panel is being routed into proxy forwarding (hitting upstream and returning | dsh 设置面板里的 favicon.ico 请求掉进代理转发(打到上游 403),面板静态资源路径应全部由管理面自答 MCP shim: success structuredContent carries only outcome, dropping the report body on structured-preferring hosts | [Bug][mcp] 成功结果附带的 structuredContent 只有 outcome,导致宿主丢弃 acp_status / acp_cache / search_context 的正文 [cache] Similar cache seams still detectable after #1548 / #1551 / #1554: v0.1.197, 21 samples / 1.14M tok | [cache] #1548 / #1551 / #1554 之后仍可测到同类缓存接缝:v0.1.197,21 样本 / 1.14M tok After an interleaved metadata refresh, the entire history of the same session is resent in a different form, and already-collapsed content fails to re-anchor. | interleaved 元数据刷新后,同一会话整段历史换形态重发,已折叠内容 re-anchor 认不回来 [Bug][pi] Model-level promptPack config not propagated to compress tool description (only top-level compress.promptPack is honored) | [Bug][pi] model-level promptPack 配置不达 compress 工具描述面(只认顶层 compress.promptPack)

1 participant