Repository navigation
session identity: order-primary resolver v2 on the wire-neutral domain (#2944) - #2949
Conversation
…2944) Skeleton = neutralTurns(messages).map(kind) — the #2791 projection that #2939 already runs on, instead of a third raw-field classifier: - content-blind by construction (kind sequence only) - google parts / responses function_call first-class - leading system run, client marker turns, image placeholders stripped by the projection — host machinery cannot misalign the skeleton - consecutive-assistant merge + multi-block tool_result split keep renderers that disagree on packing aligned Claim rules per the #2944 owner rule: unambiguous id + main shape + head-or-tail order match → raw (claim/continue/reanchor); shallow blob → |sub:aux (#1916 race structurally dead); deep stranger → |sub:task; failing-provenance ids stay on the anonymous ladder. id provenance table documented in the module docstring (anthropic/openai header, responses header|session_id|metadata.session_id, google header; content-fingerprint ids never qualify). Parallel implementation: persona-anchor.ts untouched, server not switched. Differential corpus pins the old ladder first (S1-S6), then the same scenarios through the new resolver with old→new rows, plus P6 (one conversation, four wires, one skeleton — impossible for the raw-field draft) and P7 (system add/remove + marker injection leave the skeleton unchanged).
Reviewed #2949 against current head What I verified (evidence)
CI gap (not a PR defect — inherent to stacking)Main Forward-looking note for the switch-over PR (NOT a defect here — this PR is inert)
结构化八问
判定:可合。 代码正确、单测(含 P5/P6/P7)本地全绿、typecheck 干净、纯增量且惰性。合并后按 PR 自身计划等 #2815 落地、retarget 到 master 触发全量 CI(本次 diff 的 typecheck + 单测两项我已本地覆盖)。第 7 问提到的浅会话首两轮 aux 归属,建议在切换 PR 前确认一次意图即可,不阻塞本 PR。 |
…keleton-hash task keys (#2944 v2.1) Real-corpus proof (495 sessions replayed): census unchanged (claim 45, continue 311, reanchor 0, derived-aux 119, derived-task 0, surprises 0). Mixed-traffic proof closed the two holes the order-only draft had: subagent replay under the main id no longer steals raw (tail fragments differ), two subagents no longer collide on one task key (skel8).
v2.1: fragment-tail guard for truncation/reanchor (tail window 8) and |sub:task:<skel8> keys for tag-less strangers (mixed-traffic probes: subagent short replay and cross-session key collisions closed). v2.2: personaTag + declaredModel inputs; wired into all four prepares through personaConversationOrder (replaces the personaNamespace ladder call sites; ladder module kept for characterization tests). - same tag: persona owns the id — ride/continue/reanchor through truncation, compaction rewrites, diverged or shorter replays (old fp-equal semantics, byte-identical lane keys) - tag change: migrate on head continuity (#2241/#2250) or on a header-corroborated model switch (#2601/#2719/#2817); otherwise stable |sub:<fp16(tag)> persona lane (self-recording) - tag-less: shallow rides the raw key (old non-anchoring path); strict |sub:aux only for virgin ids; deep strangers fork to |sub:task:<skel8> (#150-class protection) - empty incoming tag never counts as a persona change Tests: issue2944 corpus + dsh persona families + 2601/2817 continuity 50/50; crosswire/side-lane/subagent/dsh-native/title 25/25; goldens 10/10.
|
重新判定 |
|
v2.1/v2.2 landed on this branch (ddf366b) — production wiring complete. The resolver is now wired through v2.1 — fragment-tail guards (closed two real holes found by mixed-traffic probes):
v2.2 — persona guards in the resolver (inputs:
Real-corpus replay census (dogfood index.db: 495 sessions, 14,656 messages, growth-prefix replay at 1/3 · 2/3 · full): Local suites: issue2944 corpus + dsh persona families + 2601/2817 continuity 50/50; crosswire/side-lane/subagent/dsh-native/title 25/25; goldens 10/10. (#2082/#2101 are known env-class local timeouts — clean master fails them locally too, CI green.) |
重新判定完成。这次不是复核同一份 diff——head 从 我重新核了什么(evidence)
行为变更披露(Deliverables rule 4 — 本 PR 现在真的改过去行为)四个 prepare 的会话键解析:六段指纹阶梯 → 顺序骨架+客户端id 主判据、内容碎片做护栏。保留(按字节):同 persona 持续流量键、persona 分叉键、模型切换迁移(#2601/#2817)、#1916 review fork。新增护栏:① #150 subagent 复用主 id 短交替尾不再偷主压缩态(fragTailEquals 8 轮碎片窗);② 深陌生人按骨架哈希 结构化八问
判定:可合(人工合并)属 identity/session-binding 逻辑,按 §7.4 本就人审、不可 auto-merge。质量面:本地 typecheck 干净、unused-exports 干净、identity 族单测 122/122 绿、CI 8 条 e2e lane(含 codex-persona 双模式 + dsh-native/dsh-plugin-lane)绿;兼容声明成立(分叉键字节相同、stamping 机制未变)。残留 CI 缺口=主 |
What
#2944's order-primary session resolver, rebuilt on the wire-neutral domain — the substrate PR #2942's draft skipped (its
orderKindOfpattern-matched raw protocol fields: googleparts/ responsesfunction_callblind, leading system unstripped — a third protocol-shape classifier next toaffinity-neutral.ts).skeletonOf(messages) = neutralTurns(messages).map(t => t.kind)— one source of protocol-shape knowledge (#2791, the projection #2939 already runs on):user|assistant|tool|raw|roleClaim rules (owner rule 2026-10-12)
id provenance table (caller contract, wiring PR): anthropic/openai/google header; responses header | body.session_id | metadata.session_id qualify —
previous_response_id(upstream-minted) and content fingerprints never do (representation-derived = the reform's ban).Rollout discipline (per #2944)
Parallel implementation:
persona-anchor.tsuntouched, server NOT switched, zero runtime behavior change. The differential corpus (tests/issue2944-neutral-skeleton.test.ts) pins the OLD ladder's behavior first (S1–S6 characterization, 瞄点), then runs the same scenarios through the new resolver with old→new annotations on every designed divergence.Proofs
P1 50% mid-conversation churn (same order/length) → continue raw — the skeleton never saw the churn.
P2 shallow blob never claims raw (before or after a main claim).
P3 head truncation → raw + reanchor, skeleton follows the host's truth.
P4 growth → continue.
P5 deep main-shaped stranger →
|sub:task.P6 (new) the SAME logical conversation rendered on all four wires (openai / anthropic / google / responses, including a tool exchange) yields the IDENTICAL skeleton and resolution sequence — claim on wire A, grow on wires B/C/D → continue. The raw-field draft could never pass this (its kind strings are per-wire).
P7 (new) leading-system add/remove +
[model changed:]client-marker turn leave the skeleton unchanged and the resolver continues raw (the raw-field draft misaligns here).Stacking
Branch is stacked on #2815 (
2026-10-11_marker-declarative) so the pipeline order identity-resolution → marker strip → id minting is reviewed on one surface; this PR only ADDS files (src/session-resolve.ts, one test file, CHANGELOG line) — nothing #2815 touched is modified. Retarget to master when #2815 merges. If #2942's stage 2 lands first, rebase replaces that file with this one; #2942's stage 1 (neutralizeToolPrompts, wired, fixes #2917) is untouched and orthogonal.Design posted in #2944 (comment).
Fixes #2944 (design half; the switch-over PR follows after differential soak, per the issue's rollout plan).
—
prepared by an agent under the local git identity (ranxianglei), human merge required