Repository navigation
fix: dsh persona fingerprint parity for the Responses wire (#2203) - #2232
Conversation
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.2457-pr.2232.632b5b1This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr2232.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 Review 完成(代码 + 回归 + 测试有效性 + CI 逐层核过)。结论:可合——本轮 CI 跑在 审核过程
代码审查要点
回归审查(既有行为清点)
行为变更 old→new 与 PR 描述一致且已披露:dsh-responses review 请求从 raw-key 走主会话管线 → 测试有效性新 e2e 六阶段全覆盖 PR 声称(anchor → fork → fork 复用 → main 稳定 → conversations-map 纪律 → instructions-less aux),断言咬 session 身份/stats 计数/snapshot 长度/metadata stamp,不是恒真断言;stash-proof 通过。 CI 状态与我的处置
结构化七问
判定:可合。 等 |
[bot] 🏷 CI 终态确认(
补充证据与处置:抽查了近期其他分支的 CI run(degen-close-strip、cache-ledger-coverage-accrual、pi-subagents-config-home ×2),失败集合与本 PR 完全相同(仅这 4 个 job,其余全绿)→ 这是 master 基线级别的全量套件问题,影响所有分支。已按流程立项 #2238(带来源标记,含 run ID 证据表与建议步骤;agent PAT 无 check-run 日志下载权限,具体失败用例需从 GitHub UI 看日志定性)。 最终判定:可合。 本 PR 自身的所有门禁(guard + e2e + lane-guard)全绿;剩余 4 红属 #2238 跟踪的 master 既有问题,不构成本 PR 阻塞。PR mergeable=true,等 owner 合并。 |
21ce731 to
fdb5ca9
Compare
[bot] 🏷 冲突已解决:rebase 到当前 master( 处理方式:两侧文件零重叠——master 前进只碰 src/config.ts、src/agent/pi-subagents.ts、tests/pi-*、docs;本 PR 只碰 src/server.ts、src/session-id.ts、tests/dsh-persona-fingerprint.test.ts、tests/side-lane-invariants.test.ts。rebase 零冲突(三个 commit 原样重放),force-push 回特性分支(仅 master 禁 force-push)。rebase 后验证:typecheck clean、定向套件 35/35 绿。CI 正在新 head 上重跑。 一并披露一件事:rebase 前 fetch 时发现远端分支 tip 不是我的上一 head 七问
判定:可合。 等新 head CI 收尾(预期与上轮一致:guard/e2e 全绿,仅剩 #2238 跟踪的四个既有 test red)。 |
[bot] 🏷 CI 终态(rebase 后 head
除该 flake 外无任何阻塞项。合并就绪,等 owner。 |
fdb5ca9 to
370e149
Compare
DSH auto-review traffic over /v1/responses keyed verbatim under the raw session id (the instructions allowlist covers codex/claude only), so review personas interleaved into the main session and kept breaking its prefix cache. Route dsh-over-Responses through the same continuity-aware persona anchor as the anthropic/openai lanes (#2241): history-discontinuous review blobs fork onto |sub:<fp>, model switches migrate the anchor on the raw key. rawPersonaIdentity gains the dsh-scoped responses case so forks record under their suffixed id (#970 map discipline).
…uard) The identity branch gained a new sideRequestLike consumer on the responses wire (dsh persona split suppression), which trips the #2170 lane-guard. Pin the interaction in side-lane-invariants (E): a tiny-budget tool-less dsh request on /v1/responses rides the raw key verbatim while the full-budget review shape still forks and stays canary-clean.
370e149 to
31adfb4
Compare
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.101-master.e1b4345 # this exact build
npm install -g billion-context@master # always the newest merged build
|
Closes #2203
What / why
Production repro (bili 0.1.185, DSH Web profile,
/v1/responses,clientHint=dsh, sessiona215f0cf…): the DSH auto-review persona (fixed REVIEW_POLICY instructions + one flattened transcript blob, no tools, ~384K budget) walked the FULL pipeline under the MAIN session id — 19 requests interleaved 13→2→16→2 msgs in one view,CACHE SEAM ~189K × 10, compressionCount=0,[fold-reconcile] system prompt changed (3859 ↔ 13927 chars)oscillating in the same session. Same install forked correctly on the Anthropic wire (|sub:rows present) but every DSH Responses session stayed on the raw id.Root cause: in the identity ternary (
src/server.ts), the Responses branch only consultedinstructionsFingerprintApplies— the codex/claude-only inverted allowlist — plus the plain-proxy stableSystemAnchor branch.x-bili-plugin: dshover/v1/responsestherefore keyed VERBATIM under the raw conversation id: review personas interleaved into the main session, kept breaking its prefix cache and clobbering its usage baseline/snapshots. The persona fingerprint existed for openai/anthropic only.Fix (rebased onto 86191d6, aligned with #2247/#2250)
personaNamespace(...)— the SAME continuity-aware persona anchor fix(#2241): continuity-aware dsh persona anchor — model switches migrate the anchor instead of forking the main lane #2247 introduced for the anthropic/openai lanes (generalized topersonaNamespaceby fix: codex / claude-over-Responses instructions drift migrates the persona anchor instead of forking (#2250) #2271), withinstructionsas the system carrier andparsed.inputas the affinity-chain message list (the same listaffinityMessageList()hashes).rawPersonaIdentitygains a dsh-scoped responses case so a fork records under its suffixed id inrecordPluginSessioninstead of stealing the main session's entry from the single-valued conversations map (Subagent first token stalls 1-2min: withSessionLock covers full forward + slow flash upstream first byte #970 discipline). Scoped to dsh so codexTurn traffic keepspersonaForked=false.src/session-id.tslane list,designNamespacedcoverage note).Behavior change (old → new)
ONLY
x-bili-plugin: dshtraffic on the Responses wire:<id>|sub:<fp>(one shared forked session per reviewer system, full pipeline, independent state); a model switch whose replayed history CONTINUES the raw key's chain MIGRATES the anchor instead of forking (the [[bug] dsh 0.1.185: main lane forks itself on a mid-session model switch, orphaning the persona anchor — every native compress is refused (9/9, not covered by #2157) #2241 shape — same semantics as the other two lanes now); instructions-less auxiliary calls stay non-anchoring (verbatim).No other traffic class is touched: codexTurn, stableSystemAnchor (plain proxy), codex/claude instructions personas, opencode/grok/plugin lanes keep byte-identical identity paths.
Tests
tests/dsh-persona-fingerprint.test.ts: main anchors raw key → review forks|sub:<fp>→ repeated reviews reuse the fork → main state untouched → conversations map keeps both entries under correct ids → instructions-less rides raw. Stash-proofed: FAILS on unmodified code AND on pristine master (verified at both c4ae707 and the current 86191d6 —AssertionError: 'review request landed on its own forked session'), passes with the fix.tests/side-lane-truth-table.test.ts: "responses" added to the resolveSideLane exhaustive protocol loop + pin that the production auto-review shape (no tools, explicit-large or absent budget) stays OFF the side lane.tests/side-lane-invariants.test.tsinvariant (E): tiny-budget tool-less dsh request on/v1/responsesrides the raw key verbatim (no fork minted, no state touch) while the full-budget review shape still forks and stays canary-clean.Rebase notes
Two rebases, both mechanical (no behavior change):
subagentNamespaceformulation (fork id format unchanged:<rawId>|sub:<sha256[0..16]>). The earlier labeled drive-by commit (pi-subagent-registry fake, filed as [bug] master red since #2209: pi-subagent-registry factory-wiring test broken — single-slot test fake cannot hold #2186's second session_start handler #2236) is DROPPED — that fix reached master independently via fix: pi-subagent-registry fake stores per-event handler arrays (#2234) #2235 (782bb22e9).dshPersonaNamespace→personaNamespaceand extended it to the codex/claude-over-Responses instructions lanes (codex 线 responses 身份仍走 instructions-hash subagentNamespace:同 id 下 instructions 中途变更会 fork 主 lane 丢压缩(#2241 同款暴露,未审计) #2250): this PR's new Responses call site now references the renamed exportpersonaNamespace(final small commit), plus a one-space indent repair on the stableSystemAnchor condition line that the rebase carried. Re-verified on head31adfb4d7: typecheck clean; 48/48 across the same suites; the responses parity e2e still FAILS on pristine master86191d6acand passes here.No config surface / persistence format / kernel changes.
Remaining facet (tracked in #2203, NOT in this PR): the google-native wire also lacks the dsh clause — enabling it there follows the KDD#9 evidence-per-client discipline (needs traffic evidence for that specific host/wire shape first).