The PR's snapshot-plane commits added config fields (sessions.*, plugin.snapshotCapBytes, snapshot.shadow) and src/server/egress-lane-io.ts without doc seeds, so three CI gates went red on head 02fc8f4c2:
- config-surface-guard: 11 leaf fields lacked website/config-reference seed entries
- docs-coverage: 11 env vars + 2 top-level keys (sessions, plugin) undocumented (BILI_SESSION_CONTENT_STORE_PIN is env-only)
- architecture-docs: reference/architecture.md missing src/server/egress-lane-io.ts
Added the seeds (process.yaml: sessions block + 9 leaves; server.yaml: plugin.snapshotCapBytes + snapshot.shadow; env-only.yaml: BILI_SESSION_CONTENT_STORE_PIN), the file-map line, and the regenerated docs/configuration.{md,zh-CN.md,ja.md} + website artifacts.
Verified locally: all three gates green, generate idempotent, typecheck clean.
PR #6785 CI fix.
The egress plane gets a SINGLE rollout key: egressPlane (default 0).
ON = the complete new path in every lane — sparse-op recording,
serve-from-log (byte-identical swap), and server authority for pinned
plugin lanes (rulings 7439-3/5). OFF = legacy chain, zero rows,
byte-identical to pre-feature. Both predecessor keys never shipped
(default 0, born in rollback state) — no migration.
Owner ruling 2026-11-21: '删掉以前的开关 只留下一个开关'.
Verification: typecheck 0; 13-file storage/egress/fastpath battery
112/112; e2e codex 4-phase pass (rollout off = legacy path).
Conflicts resolved:
1. src/server/prepare-openai.ts: union of fastpath imports (PR's
DeltaReanchorError/PF_TAIL_IDS_HEADER/evaluateDeltaResend/parseTailIdsForPin
+ master's stampOnlyWatermarkTurn).
2. tests/fastpath.test.ts: union of fastpath imports (PR's
evaluateDeltaResend/PF_DELTA_HEADER + master's stampOnlyWatermarkTurn).
3. src/agent/pf-channel.ts: kept PR's TAIL_MAX_BYTES byte-budget (supersedes
master's MAX_TAIL_IDS count-cap; the byte check is stricter and
tailPayloadFor is the single source of truth for both header emit AND
full-form suppression).
4. src/server/fastpath.ts: kept BOTH evaluateDeltaResend (PR #6785 delta arm)
AND stampOnlyWatermarkTurn (master #7367 stamp-only turn).
5. src/storage/shadow.ts: kept master's fileJsonWriter parameter (new in
master, not in PR branch).
6. tests/pf-channel.test.ts: updated #7367 tail-cap test to match PR branch's
byte-budget behavior (full slice under 8 KB, not capped to 160).
The outbound element array can now be REBUILT from the op-log view alone:
view rows carry role + a unified-content-CAS reference (the message's final
core JSON, hashed at record time — no new content bytes anywhere), and
rebuildOutboundFromLog runs the exact legacy chain (systemToUser ->
coreToOpenai -> hardenOpenaiAssistantContent) over the CAS bodies.
- src/storage/egress-serve.ts (new): rebuild + the degrade ladder — missing
CAS body / casRef-less legacy rows / tool rows / bad JSON -> null, the
caller keeps the legacy bytes. v1 scope pinned: text + acp_summary rows.
- src/storage/egress-state.ts: role?/casRef? ride the I and U ops, the B
base and both replay paths (JSON payload fields only — no schema change;
absent on pre-seg-4 rows, which serve-from-log skips).
- src/storage/egress-record.ts: rows recorded with the CAS seam
(store.egressPutContent); system row included with its own casRef.
- src/storage/store.ts: egressPutContent/egressGetContent public seam over
the existing private content CAS (dedup by sha256, refcount).
- src/server/prepare-openai.ts: captures the legacy core elements + the
recorded source; behind egressServeLog (default 0) it rebuilds from the
log and logs IDENTICAL|DIVERGENT vs the legacy bytes. NO swap: the
pipeline always sends the legacy path until the shadow gate proves it.
- rollout: egressServeLog {percent: 0} (env BILI_ROLLOUT_EGRESS_SERVE_LOG,
requires egressOpLog on); config docs regenerated (348 entries, stable).
- tests/egress-serve.test.ts (new, 6 tests): byte identity vs the legacy
chain (plain + summary re-voicing + table-replayed + post-compaction)
and the three degrade directions (#3617).
- Battery: egress-state/record/serve 24/24, perf-suite set 53/53,
typecheck + build clean.
The four upper-layer shapes now land in the op log behind rollout key
egressOpLog (default 0 = zero impact):
1. new message -> exactly one +I (tail append)
2. nudge injection -> structurally absent: the recording seam sits
BEFORE the nudge/scratch append, so the
ephemeral rows never reach the tables
3. compress fold -> one -D over the folded span + one +I for the
summary row; any -D batch triggers compaction
(replay into a base row, state table bounded)
4. content edit -> exactly one +U (msgid/ref stable, content-only)
recordEgressTurn (new src/storage/egress-record.ts) builds deterministic
view rows (system row first; msgid/ref/tokens/type/contentHash), diffs
against the previous turn's view, appends the sparse ops, and compacts on
folds. Wired in prepare-openai between recordNudgeInject and the single
return: feature-gated, try/catch with per-session disable on any error
(shadow lane — the pipeline never throws from it).
SessionStore.egressOpLogStore() -> UnifiedShadow.egressOpLogSync() exposes
the sqlite UnifiedStore (null on legacy mode / network backends -> the
turn is skipped exactly like every other sqlite-lane fast path).
Tests: tests/egress-record.test.ts 6/6 (build determinism, tail append =
one op, fold = -D + +I + compaction, edit = one +U, identical view = zero
ops, rollout-off default both directions). Battery 71/71.
Full battery + CI green.
New egress_state + egress_flow tables (both PK (session_id, log_seq),
msgid secondary index): the outbound view becomes an op log instead of a
rebuilt blob. Row types: B=base, I=insert (after-anchor or tail, msgid +
render triple ref/tokens/type + content_hash), D=delete (inclusive
msgid endpoints), U=content update (msgid-stable).
Replay is deterministic: read the state table in log_seq order, apply
per row type; any anchor/endpoint/id violation throws
EgressStateCorruptError (whole-session legacy degrade, never fuzzy).
Compaction = one txn: write the replayed base as a B row, physically
delete the state rows below it (cancelled intermediates vanish); the
append-only flow table keeps every op, so any historical log_seq stays
reconstructible via egressStateViewAt.
No pipeline wiring yet — the tables are written/read through
UnifiedStore thin methods only; recording ops at the four upper-layer
sites (new message / nudge-ephemeral / compress fold / content update)
and serving from the log come next, behind a rollout key.
Fixes#6796. Preserve bili compression by disabling incompatible native thread deltas through Pi session-local model compatibility.
(cherry picked from commit 7d790d9970)
The first cut of this fix persisted the turn-final reply as non-tail rows
in the messages table. That breaks the table's contract: its seq space is
the ref-ledger substrate — on the first fold, persist.maybeRestampToLedger
aligns every live ref onto the store row's seq+1 (#4316), so a non-view row
interleaved in the table desyncs every post-fold ref (golden wire drift:
responses/google legs, body #10 onward).
C1: the stash lives only in sessions.metadata_json.handoffReply. That column
is persisted in both the legacy file and the unified DB, identical in both
views (digest-equal), so the reply still lands durably in the database for
#6947's 'anything reading the DB loses the turn's final reply' concern —
without touching the view, the ledger, or any wire. A client re-send then
persists the reply as a normal view row with the kernel-minted ref, exactly
as before #6947.
- handoff-response.ts: unchanged from the previous cut (metadata-only stash,
plan-ready rows with the codec-canonical ids, restampForJoin sidecars)
- ingest.ts: keep the planStoredMessageRow/HandoffReplyStashRow exports the
capture uses; no planner emission
- store.ts / mysql.ts: back to the pre-cut delta/full paths (the join
extension is gone with the table rows)
- tests: rewrite for C1 (stash never reaches the table; re-send is base
behavior; identity join-key parity; golden re-baseline = metadata section
only)
Local (node 22, clean env): issue6947 12/12, fork 4 files 91/91, lane/
storage/golden 6 files + storage-engine-proofs green at BASE expectations,
build OK.
The #6944 merge added the shared Responses developer-section joiner
(#6922) without its architecture.md entry, which the architecture-docs
guard requires. One-line module-map registration.
reference/architecture.md: drop the three retired plane files from the
map (snap-egress, snapshot/assemble, snapshot/delta), re-point the
snapshot/ + snap.ts entries, note the egress splice/cut on
snapshot-render. storage-relations en/zh diagrams: the plane box now
shows l1_world / fold_journal / egress_snapshot / checkpoints (existing)
instead of the never-shipped snap_rows/snap_log/snap_ckpt; the fold and
GC flow boxes re-pointed. architecture/storage en/zh/ja: the kstate
convergence sentence no longer names a retired table (#6858 tracks the
follow-up). checksums/types headers: dropped the S4/snap_rows red-line
wording for the retired plane.
Review of PR #6299 found four blockers and six majors; this is the
complete fix round.
B0 (root): a chained turn on the responses lane has no full-view
reconstruction (the D lane is skipped for pluginMode and #4804
augmentation is WS-only), so its kernel view is a delta, not the world.
Flushing that view to the plane deleted every row it did not contain.
Now a chained turn that is neither cohort (msgid-pinned stage-0) nor
WS-anchored sets session.skipPlaneFlush (one-shot, consumed by the
persist build — snapShadowSync returns before any plane work) and
passes bypass:true to applySnapEgress (the outbound is the legacy
bytes; the plane stays stale-but-intact until the next full/cohort
turn, which re-syncs it one-round).
B1: FoundationRejectError was swallowed by the lane 'kernel transform
failed, forwarding unchanged' catch -> 200. Both lane catches now
rethrow it first; the server funnel maps it to a 400 with
x-bili-snapshot: identity and {error:{type:'snapshot_identity_fault'}}
before the generic 503 path.
B3: a plugin chained round with EMPTY input (a pure provider-chain
continuation) is routed to the raw-body passthrough
(prepareResponsesCompact) at the dispatcher — no dev-message
injection, no chain-id strip, no kernel round. The injected dev
message + stripped id on a no-content round produced a blind provider
response that the host then chained from (permanent context loss).
B4: the delta frontier advanced at egress-build time with no rollback
on upstream failure. The selection now stashes pendingResponsesDelta
on the Prepared and commits session.responsesDelta only in the relay
when the upstream response status is < 400 (4xx -> null = reseed next
round; never advances on failure).
M1: stage-0 arming now requires the pluginLaneServerHistory rollout
(featureEnabled in runStage0), tying R3 to the rollout that makes it
reachable. M2: checkR3Identity is now the single R3 arbiter, called in
runStage0. M3: the R3 breaker latch persists (l1_world.r3_latched_at,
probe-first ALTER, upsert — the first fault precedes the session's
first l1 row) and survives a process restart; a latched session
degrades forever, never 400s again. M4: A1d pins the kernel-core
byte-identity at the CODEC level (the new element's core is
byte-identical between the M1 full-array parse and the M2 standalone
parse, wireIndex aside). M6: session.responsesDelta is cleared at
every stage-0 resync (s0.resynced). M5: PR body rewritten to match
the code.
Shared stage-0: the pin + R3 + stage-0 decision + assembly moved out
of the openai lane into src/snapshot/stage0.ts (runStage0), wired
into BOTH the openai and responses lanes (the responses lane reads
biliMsgIds/biliLedgerSeqs from its body; cohort = pluginMode +
declared).
Tests: tests/issue5874-2x2-p3.test.ts 40/40 (was 33): new A1d (M4
codec pin), B0a (skipPlaneFlush leaves the plane untouched), B0b
(egress bypass ref-identity), M3 (latch persistence across store
instances), and HTTP e2e B1 (400 + header + zero upstream forwards),
B3 (pure continuation raw passthrough), B4 (400 turn does not commit
the frontier; the next round re-seeds the full view). Regression:
snaplane-p2+snapshot-render+chain+shadow 41/41, storage-engine-proofs
+opencode-rolling 22/22, snapbase-p0+snaplane-p1+fastpath+
responses-previous-response-id 23/23, tsc clean.
Implements the 2×2 brief (discussion 5874 comment 19544722) on top of the
P2 plane, kernel unchanged. The snapshot table (l1_world + row rows) stays
the single truth; the two selection points are independent:
- Inbound (stage 0, prepare-openai lane): the client's (sess_raw, msgid[])
pair is matched against the stored world canon (matchWorld:
echo/probe/scatter/issue/diverge/resync). Probe rounds assemble the kernel
input from plane rows + only the NEW span, so M1 (full resend) and M2
(incremental) reach byte-identical kernel cores. R3 identity faults
(declared msgids vs element count) 400 with zero side effects, 3-strike
window latch degrades to the legacy path.
- Outbound (egress stage, snap-egress + prepare-responses): the snapshot
view carries a per-element side channel; the responses lane (provider
retains context via previous_response_id) selects seed/delta/no-op via
selectOutbound — first round full (incl. anchors), next rounds only new
rows, isFullResend trips a reseed. Degrade to legacy resets the delta
frontier (one-round convergence, #7).
Files: src/snapshot/{assemble,checksums,delta,identity,plane,types}.ts
(new), store.ts snapStage0/snapStage0Cores/snapStage0Reset facades,
snap.ts l1 envelope + clearSnapPlaneDead, msgid-pin.ts seqs channel,
session.ts responsesDelta persistence, architecture.md map.
Tests: tests/issue5874-2x2-p3.test.ts (33: verdicts ±, M1/M2 byte pin,
T5 scatter pin, #7 resync, #8 delta pin, R3 red gates, store round trip).
Regression: p1/p2/fastpath 23/23, snapshot-render 24/24,
storage-engine-proofs 12/12, opencode-rolling 10/10. tsc clean,
unused-export gate clean, architecture-docs guard green.
Owner ruling (2026-11-11): the snapshot plane is the DIRECT outbound
authority. No tripwire, no normalized diff, no sticky exclusion, no
seam-walk re-derivation. The plane stores the kernel's OWN tagged
processTurn output (invariant v); egress serves the plane rows and the
result is byte-identical to the legacy egress by construction.
Write side (store.ts snapViewEvents):
- Event-level increments (cast / update / delete / compact) derived from
the kernel's tagged view, committed in one transaction with the legacy
save (same tick). No per-round full diff.
- Plane-first row mapping (alias, then tag-stripped identity, then live
ledger) — remint-stable: an identity-seed upgrade (#3752) re-keys the
block to the client's re-minted ids, but the plane rows keep their
positions and aliases, so the reminted save is a no-op.
- Covered rows compact LAST (after every cast/update/delete), protected
set = mapped view positions plus the pin spans (view pin: first user
row in the kernel view; transcript pin: first user row on the plane) —
the kernel serves a pinned first user only when that row is in the
kernel INPUT, so the plane must keep pin rows active even when covered.
- A/B oracle at fold time: view-vs-plane active-row identity multiset
(remint-proof, tag-stripped); a mismatch latches the session
plane-dead and legacy keeps serving. Replaces the legacy-table A/B.
Egress (snap-egress.ts):
- Reads the plane rows in pos order; serving = the active non-anchor
rows (coverage by the plane's own active flag / cover_ref, never by
id matching — alias matching mis-fired on a fresh reminted row whose
core_ids carried a covered base id, the #4052 fresh-repeat case).
- Each active block's stored anchor summary (served verbatim from its
plane row) is moved to its covered run's pair-safe position: the run
is read from the rows' cover_ref MIN — immune to the #3752 re-key
(resolving through the block's effectiveMessageIds first-sees the
re-appended covered duplicates at fresh seqs and parks the anchor at
the tail).
- Anchor clamp (#3642 pin run), #4311 visible-compress-call suppression,
stale rendered-summary drop — kernel prune/rebuild parity.
- One-round legacy degrade on: flag off, cohort excluded, plane
dead/missing, unparsable row, or any assembly exception (never
throws). Reasons on /__bili/status under snaplane.egress.
Lanes: session.lastPlaneMessages carries a deep copy of the kernel
output to the in-request flush; forensics removed.
Tests: P2 suite rewritten to the direct-authority model (17 tests:
write-side W1-W5, egress E1-E7, gates G1-G5); snapshot-render 12/12;
opencode-rolling 10/10. Docs: config reference + proposal READMEs
updated to the final form (tripwire removed by owner ruling).
Principle 1 of the four-principles proposal (discussion #6262): identity,
not bytes, decides which prefix a fork inherits. The plugin-protocol
channel (dsh/omp/pi declared forks) gains an optional msgid track:
- a host-pinned parent exposes the host's stable message ids AS its
snapshot rawIds, so the child may present the host id of each matched
prefix message (prefixMsgIds) plus the hash-run length (driftFrom);
- the server accepts a byte-drifted prefix only when every presented id
equals the parent's rawId at its slot; the receipt is marked
status "drifted" (or "expanded+drifted") with the verified
driftFrom echoed;
- a gate failure never fails the fork: the byte-verified strict fork
proceeds exactly as before (no 409); malformed shapes are 400; parents
without host-pinned ids make the track a no-op (byte path unchanged).
Client: lanes inject their existing parity-pinned collectors (dsh
hostMsgIdsOf; pi/omp laneMsgIdsForWire on the anthropic wire with the
same content-pinnable gate the incremental pin uses); fork-adopt
performs only the core-alignment length lock — no new validator copies,
msgid-rule-parity matrix untouched. opencode-v2 is not wired in this PR
(byte track, follow-up).
Tests: tests/issue6262-fork-msgid-track.test.ts (8) — client prefix
extension across a drift cell, the byte-fallback arms, a full-chain
proxy round trip, and the server gate (drifted receipt / strict
fallback / 400 arms). Docs: msgid-infrastructure.md consumer 6,
plugin-protocol.md section 8, architecture.md.
Owner ruling 2026-11-13, after the dsh-live-compact record (#5984) shipped
as an ungated remote-feed broadcast and had to be retracted (#6508/#6509):
1. strict prohibition on announcements visible to every machine unconditionally
2. explicit owner confirmation before ANY announcement PR (add/change/retract)
3. announcement PRs must state the blast radius: audience, version coverage
(incl. which older versions ignore new gate fields), and display duration
4. plugin-targeted announcements disallowed in principle — plugin conflict
surfacing belongs to the read-only conflict scan (#1206); a plugin-targeted
notice must be trigger-based (scan surfaces, or a requiresScan-gated record)
AGENTS.md: new MANDATORY table row + 'Remote Announcements' section in §4;
reference/design-decisions.md: KDD #19 with the full ruling and precedent.
The dsh-live-compact-conflict entry in announcements/remote.json
broadcast to EVERY instance: NoticeRecord gates (versions/percent/time
window/dismiss) carry no client dimension, so the banner showed even on
machines where the plugin is not installed — contradicting the conflict
scan's 'flag only when found' semantics (#5984).
Add optional requiresScan: { client, knownId? } to the record schema
(validated by the shared validateRecord, counted in contentHash16):
when set, noticePassesGates keeps the record hidden unless that
client's read-only plugin-registry scan actually reports the plugin
(any finding, or a matching knownId). Empty registries scan empty, so
the gate fails closed and can never force user action. Scan results
are cached per client+cwd for 5 min, keeping hot poll paths cheap.
- remote.json: the #5984 entry now gates on dsh + dsh-live-compact
- docs: configuration (en/ja/zh) + KDD #16 record the field
- tests/remote-announcements.test.ts: gate behavior (hidden→shown→
knownId mismatch→any-finding), validation matrix, remote-lane
end-to-end, shipped-feed validation — hermetic DSH_HOME fixture,
scan cache cleared per case
The #4452 batch added a new src/server/ module but the file-by-file map in
reference/architecture.md was not regenerated, so the architecture-docs CI
guard failed with 'missing: src/server/rejection-diagnostics.ts'. Add the row
(alphabetically between relay.ts and request-cost.ts) so the map covers all
src files again.
[PR] Web Panel: Handoff Documentation and Collapsed Tree Diagram Rendering Upgrade (eWork-Level Rendering, Appendix Sectionin | Web 面板:交接文档与压缩树图渲染升级(eWork 级渲染、附录分节、冻结快照水合)
The sessions' handoff (交接文档) tab rendered every message body as
escaped plain text: markdown in assistant replies stayed literal, code
fences showed raw backticks, and tool input/output was one giant
unhighlighted pre with no copy button.
- new src/web/mdrender.ts: single escape-first Markdown + hand-rolled
syntax-highlight core (json/diff/js/ts/py/sh lexers, GitHub light+dark
palettes, unknown languages degrade to escaped text, zero runtime
deps). Inlined into the browser IIFE via .toString() exactly like the
JSONC helpers; tests/mdrender.test.ts pins behavior plus the
self-contained inlining contract (esbuild-minified .toString() must
run in a bare scope, mirroring the tsup pipeline).
- web/markdown.ts becomes a thin wrapper over the same core, so the
server-rendered handoff fallback and blog articles gain highlighting
too.
- client.ts renderHandoffMd: role cards (user/assistant/tool left border
+ badge), markdown-rendered bodies incl. thinking chains (collapsed by
default), structured tool cards (input/output label, language detection
json/diff, per-block copy button, JSON pretty-print, open when <= 20
lines), document meta (title/session id/token stats) rendered as a
key/value box instead of being skipped.
- styles.ts: card/token CSS vars in light + both dark palettes (#2559
verbatim-equality kept); i18n: det.io_in/det.io_out.
- tests/web-handoff-roles.test.ts adapted to the new markup; the #2065
invariant (in-body headings never become role dividers) is preserved.
CHANGELOG + docs/architecture/webui(.zh-CN).md + reference/architecture.md
file map updated (architecture-docs lane green).
Per owner review: the always-on compact record line (acp-nudge CustomEntry,
billion-context-pi #326 parity) is unnecessary — the transient verbatim
terminal notification (debug switch on) is the whole point of this feature.
- src/agent/pi.ts: no more registerEntryRenderer/appendEntry wiring; one
after_provider_response hook shows the verbatim wire text once per user
turn via ctx.ui.notify (consumes+clears the pending event, turnKey dedup)
- src/nudge-debug.ts: drop ACP_NUDGE_CUSTOM_TYPE + formatNudgeRecord
- tests: wiring test asserts the pi host carries exactly one extra
after_provider_response subscription vs omp (the #3248 ack channel
subscribes both lanes); formatNudgeRecord test removed
- docs en+zh, architecture.md: transient notify only, never persisted
- custom type acp-nudge (was bili-nudge); compact one-liner
[ACP nudge] <pct>% · T<tier>[ EMERGENCY][ · top range a–b]
- the compact record line is ALWAYS on (no debug config needed):
one per user turn, persistent in the session file, pi-visible /
model-invisible (type:custom never enters LLM context)
- the verbatim wire text becomes a transient terminal notification
(debug switch on: ACP_DEBUG / config debug), shown once per turn
after the model answered — never persisted
- dedup per (session, turn) via a stable key of the last text user
message (anthropic tool_result user messages skipped)
- bus events carry the record metadata (pct/tier/emergency/topRange/
turnKey); emitters compute it from the PRE-nudge array
The #5924 architecture-docs guard (landed on master via the branch sync)
requires every tracked src/ file in reference/architecture.md; the new block-ops
host executor module was added by this PR without its map row, so the guard
failed on the merged head. One-line registration next to the acp-* cluster;
guard passes locally (320 src files covered, no ghosts).
With the existing debug switch on (ACP_DEBUG=1 / config debug), every
compression nudge the proxy injects is mirrored into the pi transcript
as a transcript-only CustomEntry: [bili-nudge] <protocol>/<kind>
tier=… reason=… label + the final wire text the model actually read
that turn. Human-only: pi's session-context build ignores
type:"custom", so the view never enters LLM context or re-sent history.
Mechanism: the prepare stage (anthropic + openai lanes — the two pi
reaches) emits the post-wrapper text into a tiny in-process pub/sub
(src/nudge-debug.ts); in the default INLINE pi mode the extension is
the same bundle/process and mirrors each event via
pi.appendEntry("bili-nudge") + registerEntryRenderer. Emitters are
listener-less no-ops, so the prepare sites stay config-plumbing-free;
the consumer gate is a new debugEnabled() knob (src/knobs.ts) mirroring
Options.debug exactly (env ACP_DEBUG > file debug > false).
No new config fields / env vars / CLI flags — rides the existing debug
switch (owner decision; a draft nudgeDebug field from the first draft
was removed before the PR). kernel/ and pi-subagents/ untouched.