Skip to content

fix: codex / claude-over-Responses instructions drift migrates the persona anchor instead of forking (#2250) - #2271

Merged
ranxianglei merged 2 commits into
masterfrom
2026-10-07_codex-persona-continuity
Oct 6, 2026
Merged

ranxianglei merged 2 commits into
masterfrom
2026-10-07_codex-persona-continuity

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Closes #2250. 乘 #2247/#2241 之势:把 dsh 专属的 continuity persona resolver 通用化到 codex 线。

问题

codex 主会话(root thread / 老 build)与 claude-over-Responses 的身份 = id + hash(instructions)(内核 subagentNamespace 首见锚)。同一 id 下 instructions 中途一变(切模型 / 编辑 AGENTS.md / -c 覆盖 / codex 升级改拼装)→ 主 lane fork 到 <id>|sub:<fp> → 压缩状态全丢、refs 重编(#2241 同款:266,966 pendingT1 / 0 folds / 38 min)。

修法

行为矩阵(相对现状,仅第 2 行变化 = 预期修复)

情形 之前 现在
instructions 全程稳定 raw key raw key(无变化)
instructions 变 + 历史连续(切模型/改 AGENTS.md) fork 丢状态 migrate 保状态
instructions 变 + 历史不连续(#150 新任务) fork fork(无变化)
链被 LRU 逐出/未跟踪 fork fork(degrade 到现状)
codex 子代理(thread-id) verbatim verbatim(无变化)
side request verbatim 旁路 同

测试

缓存

不破坏:migrate 只改 key 归属不改消息字节;raw key 保住后 head 反而更稳(不再因 fork 换锚)。

…claude-over-Responses instructions lanes (#2250)

An instructions drift mid-conversation (model switch, AGENTS.md edit, -c
override, codex upgrade reassembly) forked the main lane off its raw key
onto |sub:<fp> — zero compression state, refs re-minted (#2241 exposure
shape). The drift now MIGRATES the anchor when the replayed input continues
the raw key's prefix-affinity chain; a genuinely fresh task reusing the id
(#150) still forks. Kernel subagentNamespace swap at the responses call
site; dsh lanes unchanged (already #2247); fork id format identical.
@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-10-07_codex-persona-continuity (d66ccff)

Option A — Install this exact build (recommended)

npm install -g billion-context@0.0.2377-pr.2271.eaa062e

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

Option B — Download artifact

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

Install instructions are refreshed on each push.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 Review 结论:可合并。逐项核验如下(不只读 diff,关键路径都拉代码对过、测试本地跑过)。

① 是什么问题:codex 主会话(root thread / 老 build)与 claude-over-Responses 的身份是 id + hash(instructions);同一 id 下 instructions 中途一变(切模型 / 编辑 AGENTS.md / -c 覆盖 / 升级改拼装),主 lane 被 fork 到 <id>|sub:<fp>,压缩状态全丢、refs 重编(#2241 同款:266,966 pendingT1 / 0 folds / 38 min)。

② 什么原因导致的:内核 subagentNamespace 的锚定语义是「首见锚定、不符即 fork」,设计目标是「同 id 不同 persona」(#150 隔离场景);但 codex/claude-over-Responses 的 instructions 漂移属于「同对话演化」(#1106 语义),responses lane 把两者混同——任何文本变化都触发 fork,没有连续性判断。根因在 resolver 层,不在症状层。

③ 怎么修复的:复用 #2247 的 dsh continuity resolver 并通用化(dshPersonaNamespace → 协议中立 personaNamespace,resolvePersonaKey 本就中立);responses 指纹分支改调它,以 parsed.input 为连续性判据。关键不变量我逐行验证成立:responses 的 instructions 是顶层字段、不在被哈希的 input 数组里 → 纯 instructions 漂移不破链 → chainContinues 命中 → migrate 保 raw key + 压缩状态;真正不连续的历史(#150 新任务复用 id)不命中 → 仍 fork。哈希表示两端一致:affinityMessageList()(src/server.ts:2397-2406)取的正是 parsed.input,与传给 resolver 的列表、与 identified 链记录所用的列表(src/server.ts:2562-2569)是同一份。

④ 是否有回归问题:逐项清点触碰路径的既有行为——

⑤ 是否破坏缓存:不破坏。migrate 只改 key 归属,不改消息字节;raw key 保住后 head 反而更稳(不再因 fork 换锚)。持久化 / snapshot 格式未变。

⑥ 是否改了设计方向:没有。复用 #2247 机制,无新架构;身份派生仍是 per-client 证据白名单门控(instructionsFingerprintApplies 门控不变、sideRequestLike 旁路不变);#150 的隔离语义完整保留。

⑦ 是否引入新配置:无。

验证证据(PR 描述里的测试结果我都独立复验过):

身份逻辑属 §7.4 human-gated 范畴,方向已在 #2250 floor 5 拍板。收工判定:可合并,等你合:#2271

…ift migrate; claude-over-Responses drift variant
@ranxianglei
ranxianglei merged commit d451570 into master Oct 6, 2026
25 checks passed
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

📦 Merged Build Published

This merge to master was published as 0.0.85-master.d451570 (rolling master tag).

npm install -g billion-context@0.0.85-master.d451570  # 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant