Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ Versions follow the merge of a `*_release-v*` branch; CI publishes to npm on tag
- **Fork 子会话不再因前缀漂移永久 409(#3741,owner 决策:门降 advisory)**:dsh/客户端 fork 出的子会话,其首个请求如果与继承的有序前缀不匹配(升级换代重排消息 id、宿主改写 body 等),过去直接 409 且被拒请求不计数——重试永远撞同一扇门,子会话确定性卡死、无任何自愈或清除路径。现在改为**照常收养**:session-id 绑定本来就是真正的唤醒路由,折叠覆盖差异由 reconcile(#3641 order-over-hash)兜底修复;漂移首请求付出一次性未折叠 token 峰,正确性无损。每次收养打一条带分类的 warn(reason 沿用 #3743 诊断:id-drift / hash-drift-under-same-id / prefix-longer-than-incoming 等),`publicForkPrefix` 在漂移时保持 false,side-lane 降级启发照常发言。测试:三种漂移形态全部 200+转发+父会话不动+恰一条 warn(one-shot:首请求后 stats.requests>0 绕过检查)。
- **快照渲染:proxy 车道的出站前缀改由服务端正史渲染,存量会话对内核升级免疫(#3756,根治 #3752/#3751)。** 折叠覆盖此前锚定在"客户端本轮重发的字节"上——消息 id 由内容哈希现算,身份函数一变(协议切换 #3640、#3642 的一次性 re-key、dsh 图片 offload #3588、宿主自查点)覆盖名单就与历史失联:轻则整段历史因 MAX_ANCHORS=16384 封顶失锚(#3752),重则图片族 `_N` 后缀全体位移重铸、每轮 fold 断缓存(#3751)。新引擎 `src/server/snapshot-render.ts`(灰度开关 `BILI_ROLLOUT_SNAPSHOT_RENDER`,默认 0%):当会话有活跃折叠块且统一存储可读时,prepare 层的出站消息序列 = 服务端快照行前缀(覆盖区由块的 seq/signature 覆盖集自拥抑制 + `acp_summary_*` 锚原位重渲,身份跟随块而非客户端字节)+ 客户端尾巴(分歧点 join 之上逐字保留,rewind 裁剪不复活)。链回溯用 id 快路径 + 内容签名兜底(#3658 canonical 种子同构,升级后同内容仍可链上);任何环节失步整轮降级回 legacy 路径,零行为面风险。验收:身份函数原地翻盐后出站前缀逐字节不变(老病当场钉死)、协议中途切换会话不分叉、客户端任意删/checkpoint 覆盖区不复活(一轮采用滞后,模块头有注释)、稳态轮轮前缀字节稳。观测闩 `metadata.snapshotRenderTurns`;kernel 加 `__setMessageIdSaltForTests` 测试缝(kernel 0.0.134,仅测试可达,生产零调用)。

- **Fold anchors no longer cliff at the 16k window: past-cap tool cores keep a hash-free lite anchor, so bili-side identity re-keys stop mass-unfolding long sessions (#3752).** The seed loop capped EXPENSIVE (hash-carrying) anchors at `MAX_ANCHORS` = 16384 and dropped everything past the window entirely (#2334) — but ids past the cap thereby lost every recovery channel except the positional scan, which dies after 8 accumulated fingerprint breaks. On a session with weeks of genuine drift the whole tail region is positional-dead, so any id re-mint (the 0.1.200→0.1.201 canonical-identity re-key #3658) left thousands of folded messages unrecoverable per session — field incident #3752: every active session mass-unfolded on upgrade (one Anthropic session 125K→998K input tokens in one turn, cache hit 2%), and the downgrade re-churned identically. Past-cap TOOL cores now persist a hash-free **lite anchor** (`{r, c, t, b}` — role, content class, protocol tool id, text length): Pass 1's toolCallId channel consumes exactly those fields, so they re-anchor at any session length with zero added hashing and no new misattribution surface (claim discipline unchanged: unique unclaimed candidate per (toolCallId, role)). Non-tool past-cap cores keep the positional-only status quo (their channels need text hashes — exactly what the window bounds), the full-anchor cap itself is untouched (#2334 contract), and steady-state passes stay zero-work (lite anchors reuse verbatim). The first transition pass after a re-key is unchanged — dead-region cores may unfold ONCE (no bytes on the wire under the old ids to pair from); convergence lands on the next fold, from which the session is drift-proof for tool cores at that length. Additive persistence only: new entries in the existing `foldAnchors` metadata record, old builds reading them degrade gracefully (their Pass 1 already consumes `{t, r}`; norm-keyed passes skip the absent `n`). Regression tests: `tests/issue3752-lite-anchors.test.ts` (mint shape, channel proof via the reconciler's own counter, pre-fix-ledger convergence replay; red without the fix).

- **Automatic upgrades now stagger across a window instead of landing within minutes; a public policy file controls the window fleet-wide (#3619).** Every bili instance that discovers a new version draws ONE random moment inside a delay window (built-in default **15 min – 48 h**), persists it, and upgrades when it arrives — restarts never re-roll. Before this, a release hit every auto-updating install within ~15–30 minutes, leaving no time to stop a bad one mid-rollout (#3401/#3600/#3394 were all shipped-too-fast incidents). The window and the emergency controls live in `auto-update-policy.json` in this repo, fetched anonymously (plain GET + ETag, zero telemetry, fail-open — an unreachable or malformed file falls back to local defaults): `hold` freezes automatic upgrades fleet-wide, `blocked` skips listed versions, `pinned` sets an upgrade ceiling, and per-version `overrides` tune the window (`{ "range": ">=0.1.200", "maxDelay": "1h" }`). Delay fields take human-readable durations — `"15m"`, `"2d"`, `"1d12h"` (units s/m/h/d/w, combinable; plain numbers still mean raw ms); malformed values are ignored with a warning, never guessed. The file steers timing/skip/pin only — it can never control what gets installed (no URLs, no commands; target versions must exist in the npm packument). Exits: manual `bili update` bypasses `hold`/stagger (still respects `blocked`/`pinned`), `update.staggerMinDelayMs: 0` + `update.staggerMaxDelayMs: 0` (or the `BILI_UPDATE_STAGGER_*_MS` twins) restore legacy immediate upgrades on one machine, `ACP_AUTO_UPDATE=0` disables auto-updates entirely. The update-driven e2e suites pin stagger 0/0 + an unroutable policy URL — they test periodic-update mechanics, not rollout timing.
- **openai wire: non-array content tolerance (kernel 0.0.133, #3658 follow-up)** — the #3642 per-part rewrite iterated `messages[].content` and threw `TypeError: m.content is not iterable` on clients that emit a lone content-part object instead of an array (#2824 corpus caught it). Non-array non-string content now degrades to the legacy empty-text core (byte-compatible ids and bytes with the pre-#3642 codec) instead of throwing. Also regenerates the storage-render chat goldens for the documented one-time canonical re-key (tool-pair ids), and inverts the retired reconcile-off id-churn control into an absorption canary: with reconcile OFF, tool_call id rewrites + argument re-serialization must not disturb fold coverage (canonical ids absorb them by construction).
- **protocol-stable core identity: the same logical conversation now yields byte-identical core message ids in all four dialects (#3642).** Wire codecs previously baked dialect accidents into message identity: anthropic used `"[image]"` as image text while openai deliberately kept `""` ("switching the seed would move every pre-existing shape"), tool-call ids embedded the provider's `toolCallId` bytes, raw JSON tool arguments hashed verbatim (key order = new id), and responses' empty-text reasoning cells seeded from the provider's volatile `item.id`. Switch protocols mid-session (opencode #3640: `/chat/completions` → `/v1/messages`) and ~20-68% of ids churned, tripping the fold-destroyed misdiagnosis #3641 just class-fixed. Identity now derives from a canonical form shared by all four codecs: a new `kernel/src/wire/identity.ts` (canonicalToolArgs: JSON args parsed → recursive key sort → compact stringify, verbatim for non-JSON; canonicalOpaqueSeed: provider `item.id`/`status` stripped; image marker `[image]` everywhere), the `toolCallId` slot retired from the seed (cluster suffixes disambiguate same-shape calls, deleting one sibling is local damage), and granularity normalized to one core per content part (anthropic's existing shape — its lanes take zero granularity re-keying, though tool-call/tool-result cores still re-seed since the `toolCallId` slot is retired; openai/responses/google split runs, with accumulators re-merging on rebuild so the wire stays byte-stable). The kernel first-user pin now spans the opening message's whole core run, so a multimodal opening message keeps its image bytes through folds (#781/#2607). Cross-protocol golden: text/tool/bash conversation → identical id arrays in all four dialects; canonical key-sort makes `{"file","line"}` == `{"line","file"}`. Image cells are now stamped `imagePart: true` at parse time (never text-compared — tag injection rewrites markers mid-render, which previously made image cores render as text and lose the real bytes, #767 billing fallout). Upgrade cost is one re-key of stored ids for openai/responses/google lanes; the #3641 reconcile tiers (word-bag claims, k-th image family pairing, toolCallId channel, epoch gate) absorb it without re-folding.
- **protocol-stable core identity: the same logical conversation now yields byte-identical core message ids in all four dialects (#3642).** Wire codecs previously baked dialect accidents into message identity: anthropic used `"[image]"` as image text while openai deliberately kept `""` ("switching the seed would move every pre-existing shape"), tool-call ids embedded the provider's `toolCallId` bytes, raw JSON tool arguments hashed verbatim (key order = new id), and responses' empty-text reasoning cells seeded from the provider's volatile `item.id`. Switch protocols mid-session (opencode #3640: `/chat/completions` → `/v1/messages`) and ~20-68% of ids churned, tripping the fold-destroyed misdiagnosis #3641 just class-fixed. Identity now derives from a canonical form shared by all four codecs: a new `kernel/src/wire/identity.ts` (canonicalToolArgs: JSON args parsed → recursive key sort → compact stringify, verbatim for non-JSON; canonicalOpaqueSeed: provider `item.id`/`status` stripped; image marker `[image]` everywhere), the `toolCallId` slot retired from the seed (cluster suffixes disambiguate same-shape calls, deleting one sibling is local damage), and granularity normalized to one core per content part (anthropic's existing shape — its lanes take zero granularity re-keying, though tool-call/tool-result cores still re-seed since the `toolCallId` slot is retired; openai/responses/google split runs, with accumulators re-merging on rebuild so the wire stays byte-stable). The kernel first-user pin now spans the opening message's whole core run, so a multimodal opening message keeps its image bytes through folds (#781/#2607). Cross-protocol golden: text/tool/bash conversation → identical id arrays in all four dialects; canonical key-sort makes `{"file","line"}` == `{"line","file"}`. Image cells are now stamped `imagePart: true` at parse time (never text-compared — tag injection rewrites markers mid-render, which previously made image cores render as text and lose the real bytes, #767 billing fallout). Upgrade cost is one re-key of stored ids on **all** lanes — tool-call/tool-result cores everywhere (the retired `toolCallId` slot re-seeds them regardless of dialect), plus image/reasoning/opaque cores and run-split granularity on openai/responses/google; the #3641 reconcile tiers (word-bag claims, k-th image family pairing, toolCallId channel, epoch gate) absorb it without re-folding for ids inside the anchor window — the beyond-window residual is #3752, fixed by the lite-anchor entry below. *(Wording corrected post-release: the original sentence said "openai/responses/google lanes", contradicting this entry's own statement that anthropic tool cores re-seed — the 0.1.200→0.1.201 field incident #3752 confirmed the Anthropic lane was affected.)*

- **fold anchoring doctrine: order over hash — protocol switches, image offload, and host-side truncation stop being read as destruction (#3641, fixes #3588, fixes #3640).** Three real-world defect classes all shared one root: the fold's identity model keyed coverage to content hashes, so any transformation that re-mints ids without removing content (dsh's image-offload component rewriting image cells into placeholder text, opencode switching a mid-session request from `/chat/completions` to `/v1/messages`, or a host that compacts/truncates history itself) made every covered id look *destroyed*. Consequences: 7× false "compression substrate appears destroyed" escalations on healthy sessions (#3588), 298-id churn with unanchored summary blocks landing AFTER the user's newest question — the model answered five rounds of stale summaries instead of the question (#3640) — and the #2193 collapse streak on sanctioned host compaction. The reconcile pass now carries a shape tier (loose word-evidence pairing for prose cells, a flanked k-th discipline for evidence-less image cells), a residual census classifying unmatched ids as *transformed* (near-duplicate evidence exists), *absent* (content truly off the wire with the surviving wire a suffix-continuation of the episode baseline), or *drift* (nothing matches anywhere); only the third accrues the collapse streak, and a wire-frozen episode witness guarantees a foreign conversation can never quietly become the baseline mid-episode. Unresolved summary anchors clamp ahead of the newest user turn instead of at the array tail (the #3640 "stale summary after the question" shape), and a genuine total collapse now latches `foldEpochConfirmPending` and PAUSES folding (verbatim passthrough — nothing is deleted, the snapshot is kept) until the histories realign or the user confirms a new epoch, instead of escalating on a misdiagnosis. Single genuine edits below the mass bar still report drift honestly; the #1729/#2193 escalation itself stays (its error text now names the epoch gate).

Expand Down
Loading
Loading