Skip to content

[PR] feat(codex): concurrent multi-session under the same CODEX_HOME + CODEX_SQLITE_HOME shared state DB (#3203 / #2222) | [PR] feat(codex): 同一 CODEX_HOME 并发多会话 + CODEX_SQLITE_HOME 共享状态库 (#3203 / #2222) - #3321

Merged
ranxianglei merged 11 commits into
masterfrom
2026-10-15_codex-concurrent-launch
Oct 24, 2026

Conversation

@ranxianglei

@ranxianglei ranxianglei commented Oct 15, 2026 •

Copy link
Copy Markdown
Owner

Fixes #2222
Closes #3203

查重:不重复 —— 本 PR 拾取 #2222 的分支(2026-10-06_codex-sqlite-home-shared-state,以 cherry-pick bbc517061 合入本分支),并在其上补齐 #3203 要求的并发能力。两者同属 codex overlay/锁机制家族但关注点不同:#2222 解决「状态库放哪」,#3203 解决「同一 home 能同时跑几个会话」。

What this does

同一项目目录、同一 CODEX_HOME 下并发多个 bili codex 会话(#3203)在 codex ≥ 0.147.0(默认 BILI_CODEX_STATE_MODE=auto → shared)下可用:

Behavior changes (old → new)

变更 旧 新 原因
shared 模式 overlay 路径 单一独占 <home>-bili 持久池 <home>-bili-s1..s16,复用、绝不自动删除 并发会话需要各自隔离的生成文件;槽位不能删——db 里记录的 rollout 路径经槽位解析(#43bf59fc9)
codex 启动的代理 lane 一律 codex 每会话 codex-s<N>(port-zone.json 至多 +16 条记录);各会话退出时只停自己的代理 #3044 twin 规则会拒绝撞端口的第二个同 lane 同构建启动
busy/耗尽拒绝时机(shared 模式) 代理启动之后(stopProxyGuarded 再 exit 1) 代理启动之前(直接 exit 1,什么都没启动) 槽位认领移到代理之前才能确定每会话 lane;契约文案不变("this launch made no changes")
installation_id 各槽位各自生长 → 退出时一份被隔离成 .bili-conflict 首次 shared 启动时在真实 home 播种一次;所有槽位链接同一个规范文件 避免并发会话之间隔离身份文件
逐字节相同的合并回写(所有模式) 隔离为 <name>.bili-conflict 静默丢弃(保留 dst) 两个并发槽位都写标记文件 .sandbox_migration=v1 产生了真实的冲突噪音;字节相同 ⇒ 无数据损失(与 mergeSqliteSet 快照规则一致)

非目标(已注明):legacy 模式其余行为逐字节不变;directUrl-no-MCP 的并发启动仍共享 lane codex。

Config surface

Review 发现与修复(2026-10-16)

发现的上游缺陷(旧版 #3203 lane 不稳定的根因):两个 codex 进程在毫秒级间隔内冷启动一个全新 home 时,会交错执行 codex 非原子的 sqlx 迁移,其中一方整个 state-runtime 初始化中止(while executing migration 2: table logs already exists——仅 WARN,RUST_LOG=error 下不可见)。该会话流程正常完成,但线程记录从未写入共享库(rollout JSONL 留在磁盘上;实测后续 backfill 不会自动恢复它)。复现证据(strace 时间线):B 以 O_CREAT 打开 state_5.sqlite 创建文件 → A 在 5ms 后(B 迁移进行中)打开同一文件 → 两者先后打开同一 -wal/-shm → B 报错退出 state 初始化且此后不再触碰该库(无重试)。根因在 codex ≤0.147.0 自身(bili 不拥有 codex 的 schema/迁移,无法在 bili 层修);且 #3203 的真实场景(同项目两个终端)共享已迁移的 home,不存在此窗口。处置:e2e lane 先用一个顺序会话预热 home(20f3a7b0a),让并发断言确定性地测试 bili 拥有的行为(槽位、每会话 lane、单一活库)。建议向 OpenAI/codex 上游立 issue——外部提交待 owner 批准后执行。bili 侧备选方案(冷启动串行化)评估为不可行而不做:没有可观察的「迁移完成」事件,任何固定时长等待都是任意值。

其余 review 修复(增量提交,本地定向验证全绿):

  • c58e7e778 unused-exports gate:移除 4 个 internal-only export;恢复逐字节相同合并回写的单元测试(首次提交前从树中丢失)。
  • 752ae0784 新套件注册进 scripts/live-files.mjs 的 LIVE_FILES——缺注册导致前一 head 触发 SPAWN_RE tripwire,杀掉全部 CI test shards。
  • 31481000d bili codex 报错 MCP client for codex_apps failed to start 仍然存在 #1802 lane 由断言固定名 overlay 改为动态解析实际 overlay/slot 目录(shared 模式用槽位)。
  • 01d7aa206 补齐逐字节相同 drop 分支的另两个 mtime 方向(src 更新者相同则丢弃 / dst 更新者分歧则隔离)。
  • b710361d2 ubuntu 失败 artifact 收集扩到全部 lane 的 workdir 前缀(原先只收 e2e-codex-fake-*)。
  • de82dd5dc 中文文档全角逗号笔误。
  • 4111453c2 逐字节合并回写单测原先用 fs.utimesSync 钉未来 mtime 制造新旧序——windows-latest(node 22/24)对未来的 utime 直接抛 EINVAL,CI 上两用例持续红;而钉过去 mtime 在部分 Linux overlay FS 上回读为损坏常量(实测探针),两个方向的强制 mtime 都不可移植。改为完全不依赖强制 mtime:字节相同用例无需任何钉定(相同字节时两个 recency 分支都静默丢弃 src——读 mergeOverlayEntry 源码确认);分歧用例改用自然写入顺序 + 固定 1.1s 停顿(Atomics.wait,仓库既有惯用法)。顺带把「无 .bili-conflict」断言从根目录 readdir(看不到嵌套隔离文件,原本就是弱断言)升级为全树 walk + 精确集合断言。

Tests

  • 新单元套件 tests/codex-concurrent-launch.test.ts(9 个测试):槽位分配 + CODEX_SQLITE_HOME 钉住;legacy 回归守卫;4 进程竞争 → 槽位互不相同且无 BILI_OVERLAY_BUSY;耗尽(16 个槽位全被存活进程持有)拒绝;陈旧槽位回收;legacy overlay 迁移(sqlite 行保留、零冲突);存活 legacy 持有者的双写者拒绝;逐字节相同的合并回写静默丢弃 vs 真实冲突仍隔离(两个 mtime 方向各一用例)。
  • tests/launcher-codex-sqlite-home.test.ts:shared 模式断言更新为槽位正则。
  • E2E tests/e2e/e2e-codex-fake.test.ts:新增 #3203 lane —— 同一 home 上先用一个顺序会话预热(绕开上文的上游新库迁移竞态),再跑两个并发 bili codex exec 会话:断言 lane/槽位互异、线程数 == 基线+2、任何 -bili* overlay 内零 sqlite 文件、零 .bili-conflict、installation_id 归位真实 home、并发跑完后原生 codex exec resume --last 成功。既有 #2222 lane 更新为扫描全部 -bili* overlay;#1802 lane 的 overlay 路径改为动态解析(31481000d)。
  • Windows CI ci-windows-codex.yml:pattern 现为 #2195|#1965|#2222|#3203,timeout 30 min,artifact 收集含 tmp/e2e-codex-3203-*。
  • 本地(review 后,head 4111453c2):typecheck 干净;定向单元 codex-concurrent-launch 9/9(连续 4 轮稳定)、launcher-codex-sqlite-home 7/7;e2e #3203 连续 3/3 绿(预热前本地 4 次中失败 1 次)、#1802 1/1 绿(本机 codex-cli 0.147.0 = shared 模式最低版本)。全量判定以本 head 上的 CI 为准。

ework-agent and others added 2 commits October 16, 2026 02:44
…e via CODEX_SQLITE_HOME (#2222)

bili codex used one shadow-home overlay to solve three unrelated problems
(per-launch config injection, SQLite state isolation, everything else).
The state-isolation half dragged every WAL-mode db into the overlay per
launch and needed copy-on-launch + origin snapshots + startup fold + exit
merge-back + provenance adjudication to stay correct (#381/#1917/#1918/

Codex >= 0.147.0 honors CODEX_SQLITE_HOME (source-verified across
0.147/0.150/0.155/0.159/0.160.1/main, empirically confirmed on the
CI-pinned 0.147.0 binary). New default for such binaries: point it at the
REAL home so the live dbs stay on their single physical path where native
and bili runs coordinate through SQLite's own WAL locking. The overlay
shrinks to the generated .env/config.toml plus symlinks; leftover legacy
sets are folded back once through the existing provenance adjudication.

BILI_CODEX_STATE_MODE (auto|shared|legacy, default auto) gates the
strategy; old binaries (< 0.147.0 or unparseable version) stay on the
legacy path unchanged. A user-set CODEX_SQLITE_HOME wins over our default.

(cherry picked from commit 039c536)
…overlay slots + per-session proxy lanes (#3203)

Shared-state mode (codex >= 0.147.0, BILI_CODEX_STATE_MODE auto/shared) now
claims a per-session overlay slot from a bounded pool (<CODEX_HOME>-bili-s1..s16)
BEFORE starting the proxy, and runs that launch's proxy on its own lane
(codex-s<N>): two same-build launches sharing one lane would refuse each other
at the port layer (#3044 twin rule), so concurrent sessions need distinct
lanes. Slots persist and are reused (cold-start thread records resolve through
the slot, #43bf59fc9); a crashed session's slot is reclaimed by the next
launch. The pre-#3203 fixed-name <CODEX_HOME>-bili overlay migrates into the
real home once on first launch, and is refused while a live legacy-era launch
still holds it (dual-writer guard). Legacy mode keeps the fixed-name single
overlay + exclusive lease byte-for-byte.

Also: installation_id is seeded into the real home on first shared launch so
every slot links one canonical identity file instead of quarantining copies;
byte-identical merge-back losers are dropped silently instead of producing
<name>.bili-conflict entries (matches the mergeSqliteSet snapshot rule).
@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-10-15_codex-concurrent-launch (e7495dc)

Option A — Install this exact build (recommended)

npm install -g billion-context@0.0.3912-pr.3321.ce802a4

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-pr3321.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

(ai: vllm-qwen/qwen3.8-27b)

查重:不重复。本 PR 对应两个独立 issue——#2222(状态库放哪,CODEX_SQLITE_HOME 共享活库)与 #3203(同一 CODEX_HOME 并发多会话),机制不同、关注点不同;检索 open/closed issue 与在途 PR,没有其他条目触碰 codex launcher 槽位池/CODEX_SQLITE_HOME 这一机制域。分支来源:#2222 的原分支 cherry-pick(bbc517061)+ 本 PR 新增提交,无并行重复工作。

开始审核:逐段读 diff、清点既有行为、审测试有效性、核对 CI,结论按结构化八问回复。

awork added 3 commits October 16, 2026 04:27
…ack unit test (#3321)

CI gate scripts/check-unused-exports.mjs flagged five launcher symbols with no
reference outside their declaring file. prepareCodexSessionSlot/codexSlotLane/
codexBinaryVersion/CodexStateMode are implementation details of runLaunch and
the #2222 capability probe — drop the leading export. mergeOverlayEntry was
meant to be exercised by the byte-identity drop test in
tests/codex-concurrent-launch.test.ts; that import + test case were lost from
the tree before the first commit, so restore them verbatim.
The SPAWN_RE tripwire in scripts/run-ci-tests.mjs (#1248) killed all 12 test
shards plus the fake-upstream lane on the previous head: the new suite spawns
child processes but was missing from LIVE_FILES. Inserted alphabetically; every
suite after it shifts one zone band up (max base stays far below the Linux
ephemeral range per the file's own docstring).
…#3321)

The test hardcoded <CODEX_HOME>-bili, which shared-mode launches (#2222/#3203)
no longer create — they use per-session slots <CODEX_HOME>-bili-s<N>. The e2e
lane pins codex 0.147.0 (shared mode active), so the fixed-name path was absent
and 'the overlay must own the generated .env' failed on CI while every
name-filtered local run skipped the test. Scan for the actual overlay beside
the real home (covers both naming shapes); the four content assertions are
unchanged.
awork added 4 commits October 16, 2026 05:19
…drop branch

The restored merge-back case covers identical-dst-newer and differing-src-newer; these two pin the other branches: an IDENTICAL slot-side copy that is NEWER than the real-home file must still be dropped silently (the src-newer identical branch added by #3203), and a DIVERGENT copy against a newer real-home edit must quarantine the slot side while the home edit wins. Also drops the unused home binding left in the adjacent test.
…on race

The concurrent pair flaked (1/4 locally, 1/1 ubuntu CI): two codex processes cold-starting milliseconds apart on a brand-new home interleave codex's non-atomic sqlx migrations; one of them aborts its whole state-runtime init ('while executing migration 2: table logs already exists' — WARN only, hidden at RUST_LOG=error), so that session's thread row is never written although its rollout JSONL survives on disk. That race lives upstream of bili (which owns neither codex's schema nor its migrations) and does not occur in #3203's real scenario — two terminals in the SAME project share an already-migrated home. One sequential warm session closes the fresh-db window so the lane deterministically tests what bili owns: slots, per-session lanes, the single live db.
…t step

The ubuntu artifact step only globbed tmp/e2e-codex-fake-*; the #1802/#1965/#2195/#2222/#3203 lanes each use their own prefix, so their logs were missing from failure artifacts (the windows workflow collects them explicitly).
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

审核完成。PR 方向正确、实现质量总体高(槽位池 + 每会话 lane + 共享活库的设计与既有 overlay/租约架构一致),但发现 1 个上游竞态缺陷(旧版 #3203 e2e lane 不稳定的根因,本地复现并 strace 钉死因果链)和一批 CI/测试问题。全部已在 PR 分支上以增量 commit 修复(含与作者侧并行修复的协调去重),head 现为 de82dd5dc。

结构化八问

1. 是什么问题
PR 本体:同一 CODEX_HOME 下并发多个 bili codex 会话(#3203)+ 状态库经 CODEX_SQLITE_HOME 留在真实 home(#2222)。审核发现的阻塞项:并发冷启动时一个会话的线程记录会随机丢失——该会话流程正常完成,但历史从线程列表/resume 中消失;另有 5 处 CI/测试缺陷导致两条 CI lane 红。

2. 什么原因导致的
根因在 codex ≤0.147.0 自身:它对新状态库的 sqlx 迁移是非原子的且无跨进程锁。两个 codex 进程毫秒级间隔冷启动同一全新 home 时交错执行迁移,其中一方报 while executing migration 2: table logs already exists 后整个 state-runtime 初始化中止(仅 WARN,RUST_LOG=error 下不可见,无重试),其线程行从此从未写入。strace 时间线:B 以 O_CREAT 建库文件 → A 在 5ms 后(B 迁移进行中)打开同一文件 → 两者先后打开同一 -wal/-shm → B 报错退出。bili 的启动错峰(端口协商)恰好把第二个打开点送进第一个进程的迁移窗口,放大了命中概率(修复前本地 4 次挂 1 次、ubuntu CI 挂、windows 过;去掉 bili 纯原生并发 7/7 全活)。PR 侧问题:5 个 internal-only export 触发 unused-exports gate;PR 描述声称的逐字节相同合并回写单测实际不存在;新套件未注册 LIVE_FILES(触发 SPAWN_RE tripwire 杀掉全部 CI test shards);#1802 lane 仍断言固定名 overlay(shared 模式已用槽位);ubuntu artifact 收集漏掉各 lane 的 workdir 前缀。

3. 影响范围与严重程度
上游竞态:仅当全新 home 上并发 ≥2 个 bili codex 冷启动时触发(#3203 的真实场景——同项目多终端——几乎总是共享已迁移的 home,不存在此窗口);后果为中等:一个会话的线程记录丢失(rollout JSONL 完整留在磁盘,实测后续 backfill 不会自动恢复),默认日志级别下完全静默。PR 侧问题:仅 CI 红(挡合并),无用户面影响。

4. 怎么修复的

  • 上游竞态 bili 层无法修(不拥有 codex 的 schema/迁移):e2e lane 先用一个顺序会话预热 home(20f3a7b0a),让并发断言确定性地测试 bili 拥有的行为(槽位隔离、每会话 lane、单一活库、退出顺序无关);lane 注释内写明竞态机制。建议向 OpenAI/codex 上游立 issue——按跨仓库政策待你批准后执行。bili 侧备选「冷启动串行化」评估为不可行而不做:没有可观察的「迁移完成」事件,任何固定时长等待都是任意值。
  • export gate:移除 4 个 internal-only export,mergeOverlayEntry 保留导出并由单测消费(c58e7e778 + 01d7aa206)。
  • 补齐缺失单测:逐字节相同 drop 分支的全部四个 mtime 方向(相同×2 方向静默丢弃零冲突;分歧×2 方向保留旧隔离语义)。
  • bili codex 报错 MCP client for codex_apps failed to start 仍然存在 #1802 lane 动态解析实际 overlay/slot 目录(31481000d);套件注册 LIVE_FILES(752ae0784);artifact 收集扩到全部 lane 前缀(b710361d2);zh 文档笔误(de82dd5dc)。

5. 是否有回归问题
逐项审过 diff 触碰路径的既有行为:legacy 模式(固定名 overlay + 独占租约 + 逐次拷贝/回写)逐字节不变且有回归守卫测试;逐字节相同的合并回写改为静默丢弃是有意变更(PR body 已披露:旧=隔离 .bili-conflict,新=丢弃,字节相同⇒无数据损失,与 mergeSqliteSet 快照规则一致)——我额外钉住了「分歧字节在两个 mtime 方向下仍走旧隔离」以防静默丢弃吞掉真实分歧;busy/耗尽拒绝时机前移到代理启动之前(已披露,契约文案不变);directUrl-no-MCP 并发仍共享 codex lane(已注明非目标)。未发现无意回归。

6. 是否破坏缓存
不涉及(未触碰缓存/重试/增量游标/去重键机制)。

7. 是否改了设计方向
没有。槽位池是既有 <home>-bili overlay 概念的有界扩展,每会话 lane 遵循 #3044 twin 规则的既有端口治理,共享库沿用 SQLite WAL 自身的锁协调——都在现有架构边界内。

8. 是否引入了新的配置
BILI_CODEX_STATE_MODE(仅环境变量逃生舱,默认 auto,取值 auto|shared|legacy),已在 CONFIGURATION.md 中英 + website/config-reference/env-only.yaml 文档化;无新增配置文件键。

CI 状态(head de82dd5dc)

此前红的两项均已转绿:unused-exports ✅、e2e-fake-codex(#1802+#3203 lane)✅;其余已完成项(e2e 真客户端、persona、各 native lane、registry、docs/guards)全绿;12 个 test shard + static-gates 矩阵仍在跑(本 head 是 LIVE_FILES 修复后首次完整运行)。若矩阵出红我会跟进定向排查。

待你拍板

  1. 是否批准向上游 OpenAI/codex 立 issue(内容:concurrent cold-start 下非原子迁移竞态致一方 state-runtime 初始化失败、线程记录静默丢失;附 strace 时间线与复现条件)。
  2. 合并判定:除全量矩阵外无已知阻塞,矩阵绿即可合。

…orced mtimes

The forced-mtime approach failed on the Windows CI runners: fs.utimesSync rejects future timestamps there (EINVAL), which red'd both merge-back cases on windows-latest node 22/24. Past timestamps proved equally unreliable: on at least one Linux overlay filesystem a past-value utimesSync read back as a corrupted constant mtime, silently breaking the ordering premise (observed during local triage of head de82dd5).

Recency now comes from natural write order plus a fixed 1.1s pause (the Atomics.wait idiom already used by tests/external-summary.test.ts) — portable across ext4/NTFS/APFS. The byte-identical cases need no pinning at all: identical bytes converge in BOTH recency directions, so the branch under test is unconditional.

Also strengthened the no-quarantine assertions from a root-level readdir to a recursive findConflicts() walk (quarantines land NESTED next to the dst file, so the root-level check could never see them); the divergent cases now assert the exact quarantine set.
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

跟进:Windows 单测修复已提交 + 剩余 CI 红全部定性为 master 既有红(已按测试名在 master 日志中逐一证实)。

1. 新增提交 4111453c2(portable recency ordering,修 Windows 上 2 个合并回写单测)

  • 上一 head(de82dd5dc)的 CI 显示:windows-latest(node 22/24)对这两个用例报 EINVAL: invalid argument, utime … —— fs.utimesSync 钉未来 mtime 在 Windows 上被直接拒绝;ubuntu 与本机全绿。
  • 中间还验证了一条暗线:改钉过去 mtime 也不行——本机探针实测部分 Linux overlay FS 把过去值回读成损坏常量(≈公元 4446 年),相对新旧序同样不可信。两个方向的强制 mtime 都不可移植,彻底弃用。
  • 最终方案(零 utimesSync):字节相同用例不需要任何钉定(相同字节时 mergeOverlayEntry 的两个 recency 分支都静默丢弃 src,读源码确认);分歧用例改用自然写入顺序 + 固定 1.1s 停顿(Atomics.wait,仓库既有惯用法)。顺带把「无 .bili-conflict」断言从根目录 readdir 升级为全树 walk + 精确集合断言——原断言根本看不到嵌套在 dst 旁的隔离文件,是个弱断言。
  • 本地:typecheck 干净,套件 9/9 连续 4 轮稳定;PR 描述已同步更新该条。

2. 剩余 CI 红 = master 基线红,与本 PR 无关(按测试名证实)

本 head 矩阵里除上述 Windows 两用例外还有两类红,现已下载 master HEAD(6ee4a2ac9,即本 PR base)自己的失败 job 日志逐一对名:

测试 本 PR head master 自身 证据(master job)
#1086 T5 liveness: plain-client chat session keeps compressing as it grows shard-(x,2) 全红 红(ubu+win,not ok 574) 116547487635 / 116547487840
storage-render golden (chat|anthropic|responses|google) shard-(x,3) 全红 红(ubu+win,not ok 756–759) 116547487877 / 116547487595

master 最新一轮 CI 是 12 个 test shard 里 9 个红。按名检索 open+closed issue 均无既有跟踪条目。结论:这两簇是 master 存量问题(一个在 plain-client 压缩活性、一个在 storage-render 快照),不是本 PR 引入的回归;本 PR 自己拥有的 lane(unused-exports、e2e-fake-codex ubuntu 的 #3203/#1802、windows #2195 lane 及其余全部 guard/e2e/native/registry)在上一个 head 已全部转绿。

3. 待你拍板的两件事

  1. master 基线红:按流程本 PR 不动它们(不同子系统、不同机制,塞进来违反一 issue 一范围)。是否立一个汇总 issue(带来源标记,列这两簇 + 上面的 job 证据)?[PR] feat(codex): concurrent multi-session under the same CODEX_HOME + CODEX_SQLITE_HOME shared state DB (#3203 / #2222) | [PR] feat(codex): 同一 CODEX_HOME 并发多会话 + CODEX_SQLITE_HOME 共享状态库 (#3203 / #2222) #3321 是自动立项的 [PR] issue,按来源链规则我不擅自立项,等你确认。(若分支保护要求这些 shard 全绿才能合,则需先修 master 基线或豁免。)
  2. 上游 OpenAI/codex issue(上一条回复已列证据的新库并发迁移竞态):是否批准对外提交?

CI 状态:4111453c2 的 12 个 test shard 正在跑,预期 Windows 两用例转绿、其余红只剩上表两簇(master 基线)。跑完我再补一条确认。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

CI 确认(head 4111453c2,40/40 checks 完成):本 PR 拥有的全部 lane 绿;9 个红全部定性为与本 PR 无关。

结果 明细
✅ 绿(31) unused-exports、e2e-fake-codex(ubuntu,含 #3203/#1802 全 lane)、windows #2195 lane(含 #3203)、kernel-guard、pi-subagents-guard、static-gates×4、docs-sync/coverage、config-surface-guard、lane-guard、lock-sync、test-import-graph、version-guard、hermetic registry×2、real codex e2e、persona、opencode/pi/dsh native lanes、OpenCode V2 WS、build-artifact
❌ 红(9) ① 4 shard × storage-render golden (chat|anthropic|responses|google);② 4 shard × #1086 T5 liveness;③ 1 shard × AC12(windows 24,3 单发)

三个红的定性:

  1. ①② = master 基线红:已按测试名在 master HEAD(6ee4a2ac9,即本 PR base)自己的失败 job 日志中逐一证实(not ok 756–759 / not ok 574,ubu+win 双平台)。master 最新一轮 12 shard 里 9 红。open+closed issue 检索无既有跟踪条目。
  2. ③ AC12(windows 24,3 单发,2676 测中唯一失败):该测试在 tests/lineage-reconcile-boot.test.ts(lineage/adoption 逻辑),本 PR diff 完全未触碰该文件及其被测模块(diff 文件清单:launcher.ts + 3 个测试文件 + 2 个 workflow + 文档 + live-files 注册);同一测试在 master 日志里是 ok 1071,在本 head 的另外 3 个同 zone shard(ubuntu 22,3 / ubuntu 24,3 / windows 22,3)也全过。判定为单节点单发 flake,非本 PR 引入。
  3. 上一轮的 Windows EINVAL(合并回写两用例)已消失——portable ordering 修复(4111453c2)生效,windows 上这两个用例转绿。

收工判定:代码与行为层面本 PR 已完成闭环(功能 + 上游竞态的确定性处置 + 全部 review 修复),CI 上除 master 存量红与一次单发 flake 外全绿。合并只被 master 基线红卡住(若分支保护要求 test shards 全绿)。两件待你拍板的事维持上一条不变:① 是否为这两簇 master 基线红立一个汇总 issue(带来源标记);② 是否批准向 OpenAI/codex 上游立 issue(新库并发迁移竞态)。你确认后我立即执行。

@ranxianglei ranxianglei changed the title feat(codex): 同一 CODEX_HOME 并发多会话 + CODEX_SQLITE_HOME 共享状态库 (#3203 / #2222) [PR] feat(codex): concurrent multi-session under the same CODEX_HOME + CODEX_SQLITE_HOME shared state DB (#3203 / #2222) | [PR] feat(codex): 同一 CODEX_HOME 并发多会话 + CODEX_SQLITE_HOME 共享状态库 (#3203 / #2222) Oct 16, 2026
@ranxianglei ranxianglei changed the title [PR] feat(codex): concurrent multi-session under the same CODEX_HOME + CODEX_SQLITE_HOME shared state DB (#3203 / #2222) | [PR] feat(codex): 同一 CODEX_HOME 并发多会话 + CODEX_SQLITE_HOME 共享状态库 (#3203 / #2222) [PR] [PR] feat(codex): concurrent multi-session under the same CODEX_HOME + CODEX_SQLITE_HOME shared state DB (#3203 / #2222) | [PR] feat(codex): 同一 CODEX_HOME 并发多会话 + CODEX_SQLITE_HOME 共享状态库 (#3203 / #2222) Oct 17, 2026
@ranxianglei ranxianglei changed the title [PR] [PR] feat(codex): concurrent multi-session under the same CODEX_HOME + CODEX_SQLITE_HOME shared state DB (#3203 / #2222) | [PR] feat(codex): 同一 CODEX_HOME 并发多会话 + CODEX_SQLITE_HOME 共享状态库 (#3203 / #2222) [PR] feat(codex): concurrent multi-session under the same CODEX_HOME + CODEX_SQLITE_HOME shared state DB (#3203 / #2222) | [PR] feat(codex): 同一 CODEX_HOME 并发多会话 + CODEX_SQLITE_HOME 共享状态库 (#3203 / #2222) Oct 18, 2026
@ranxianglei
ranxianglei merged commit 24b40c1 into master Oct 24, 2026
86 of 93 checks passed
@ranxianglei

Copy link
Copy Markdown
Owner Author

(ai: zhipuai-lb/glm-5.3)

已并入合并列车 #4525(master 6d7c587,合并方式 merge commit,提交保留原作者署名)。本 PR 关单收尾;若列车中对应提交出问题,回滚点为 #4525 单提交 revert。

z0d0dOr pushed a commit to z0d0dOr/billion-context that referenced this pull request Oct 24, 2026
…ack unit test (ranxianglei#3321)

CI gate scripts/check-unused-exports.mjs flagged five launcher symbols with no
reference outside their declaring file. prepareCodexSessionSlot/codexSlotLane/
codexBinaryVersion/CodexStateMode are implementation details of runLaunch and
the ranxianglei#2222 capability probe — drop the leading export. mergeOverlayEntry was
meant to be exercised by the byte-identity drop test in
tests/codex-concurrent-launch.test.ts; that import + test case were lost from
the tree before the first commit, so restore them verbatim.

(cherry picked from commit c58e7e7)
z0d0dOr pushed a commit to z0d0dOr/billion-context that referenced this pull request Oct 24, 2026
…ei#3321)

The SPAWN_RE tripwire in scripts/run-ci-tests.mjs (ranxianglei#1248) killed all 12 test
shards plus the fake-upstream lane on the previous head: the new suite spawns
child processes but was missing from LIVE_FILES. Inserted alphabetically; every
suite after it shifts one zone band up (max base stays far below the Linux
ephemeral range per the file's own docstring).

(cherry picked from commit 752ae07)
z0d0dOr pushed a commit to z0d0dOr/billion-context that referenced this pull request Oct 24, 2026
…i#1802 test (ranxianglei#3321)

The test hardcoded <CODEX_HOME>-bili, which shared-mode launches (ranxianglei#2222/ranxianglei#3203)
no longer create — they use per-session slots <CODEX_HOME>-bili-s<N>. The e2e
lane pins codex 0.147.0 (shared mode active), so the fixed-name path was absent
and 'the overlay must own the generated .env' failed on CI while every
name-filtered local run skipped the test. Scan for the actual overlay beside
the real home (covers both naming shapes); the four content assertions are
unchanged.

(cherry picked from commit 3148100)
ranxianglei added a commit that referenced this pull request Oct 24, 2026
…#4308 follow-up) + register BILI_CODEX_STATE_MODE in LIFECYCLE.md (#3321 follow-up, also red on master)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment