Skip to content

refactor(benchmark): unify LHTB and SWE-Marathon execution - #4671

Merged
huangruiteng merged 10 commits into
mainfrom
codex/benchmark-runtime-unification
Sep 18, 2026
Merged

huangruiteng merged 10 commits into
mainfrom
codex/benchmark-runtime-unification

Conversation

@huangruiteng

@huangruiteng huangruiteng commented Sep 17, 2026

Copy link
Copy Markdown
Collaborator

LHTB and SWE-Marathon duplicated installation, environment setup and continuation while similarly named modes used different execution contracts. Both now use benchmark.runtime.harbor:BenchmarkCodex: one trial-local Codex home, fixed model/provider/skills settings, and explicit plain, native Goal, heartbeat, governed Turn and LoopX Goal modes. Native tasks, feedback, verification and scores remain authoritative.

The runner reuses product thin-heartbeat scheduling, public Turn/session/recovery and native Goal transport. Named agent imports remain thin migration entries; duplicated WEN/fixed-stage runners are removed. Turn requires an independently protected validator and carries the task-workspace approval recorded through the existing configuration API. The envelope now retains that scoped approval; publishing and production gates remain. Cancellation drains scheduler/worker/host processes and retains receipts. Source staging archives the verified immutable SHA even if the branch moves; a real Git regression covers the race. Core Turn CLI defaults to read-only. The benchmark adapter retains the previous runners' danger-full-access default and passes it explicitly to Turn, relying on the native task environment for isolation; callers can select workspace-write or read-only consistently across arms.

Disclosed changes: LHTB uses a trial home instead of a per-wake home; memory generation/injection are disabled; assisted WEN controls are rejected; preflight no longer prepares networking; wake timeout is derived from host timeout. Historical results and withdrawals remain unchanged. Consumers of retired runtime directories, including #4439, must adopt the shared entry. Rollback uses the previous revision with new trials.

Validation: 250 focused Python cases (one 1-second fixture timeout passed on isolated scheduler-suite rerun), 14 TypeScript envelope tests, TypeScript typecheck, lint, shell syntax and native Harbor config parsing. Real Harbor 0.5/Docker/Codex 0.153.4 synthetic trials exercise all modes, with separate native reward and runtime receipts; LoopX Goal reached the task postcondition before its active Goal timed out. Real start/resume/fresh calls prove session identity reuse/replacement. A baseline/head process test reproduces the old cancellation leak and verifies its removal; omitted-option sandbox and prompt comparison retains baseline behavior. Harbor 0.23 import/config compatibility is also covered.

This is the research RFC §11 native bridge/adapter slice, not a full LHTB/SWE-Marathon evaluation or uplift claim. No frontend or Lark editor configures the affected headless Codex sandbox; their entrypoints are unchanged. Final CI and exact-head review are required. Runtime/control-plane changes are left for maintainer merge.

…meout evidence

Signed-off-by: huangruiteng <14976749+huangruiteng@users.noreply.github.com>
…milies

Signed-off-by: huangruiteng <14976749+huangruiteng@users.noreply.github.com>
…ance

Signed-off-by: huangruiteng <14976749+huangruiteng@users.noreply.github.com>
Signed-off-by: huangruiteng <14976749+huangruiteng@users.noreply.github.com>
Signed-off-by: huangruiteng <14976749+huangruiteng@users.noreply.github.com>
Signed-off-by: huangruiteng <14976749+huangruiteng@users.noreply.github.com>
…rkers

Signed-off-by: huangruiteng <14976749+huangruiteng@users.noreply.github.com>
Signed-off-by: huangruiteng <14976749+huangruiteng@users.noreply.github.com>
@huangruiteng
huangruiteng marked this pull request as ready for review September 17, 2026 17:31

@huangruiteng huangruiteng left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approval conclusion (author-owned PR; GitHub blocks formal self-approval): reviewed exact head 5fd33d0035591c179ecc2246c3f4a7d8369f6337, no blocking findings in the contract/adapter half; CI was still running when I reviewed and the real Harbor trials are author-reported — both named below. Merge remains the maintainer's decision.

动机

LHTB 和 SWE-Marathon 各自带一套安装、环境准备和续跑代码,而"看起来同名"的模式其实执行契约不同——同一份 turn/session/cancellation 逻辑存在两份副本,意味着在任何一边修好,另一边会静默漏掉;更具体的是,scheduler 取消时会漏掉一个 detached worker。这个切片是研究 RFC §11 的 native bridge/adapter 部分:把两者收敛到一个 benchmark.runtime.harbor:BenchmarkCodex,显式列出 plain / native Goal / heartbeat / governed Turn / LoopX Goal 五种模式,并删掉重复的 runner。它不是"再包一层",而是净删约 4000 行;native 的 task/feedback/verification/scoring 仍然归 benchmark 所有。我判它是 goal_achieved(就该 RFC 切片而言),因为它闭合了条目本身,而不是留半个契约。

改动思路

产品侧只开了三个最小的缝,其余全部复用产品既有代码:

  1. 把已解析的作用域批准带进 Turn 信封turn_envelope.ts 原本丢掉了 quota 已经解析出的 checkpointed_boundary_authority,结果只剩 bootstrap 的批准要求,把已授权的执行卡住。现在按严格的形状拷贝(schema 必须等于 checkpointed_boundary_authority_v0active_count 必须是正整数、最多 16 个 1..180 字符的 scope),并且不动 requires_parent_approval——测试同时断言了这两件事,也就是"携带批准"不等于"放开其他闸门"。
  2. sandbox 变成一个显式选择。核心 CLI 的默认值仍然是 read-only,新增 danger-full-access 作为显式选项,help 文本明确要求调用者自备隔离;同时说明该设置对新会话和 resume 会话都显式传入(这是相对旧行为的披露之一)。
  3. 取消时排干进程树process_runtime.py 把终止从"只在超时/超输出时触发"改成"任何 BaseException 都触发",宽限期变成参数(外部 scheduler 传 10s),清理移进 finallyexternal_scheduler_worker.py 把 SIGTERM 转成 KeyboardInterrupt。这是那条"baseline 复现泄漏、head 验证消除"的落点。

具体改动

44 个文件、+2084/-6086(净 -4002):11 个删除(重复的 turn/modes/fixed-stage runner 与 no-sandbox wrapper)、8 个新增(共享 runtime 包与其 366 行测试)、25 个修改——其中只有 5 个是产品文件quota/turn_envelope.ts +16、turn_driver/codex_cli.py +14/-1、extensions/process_runtime.py(参数化 + finally)、cli_commands/turn_registration.py +2、scripts/external_scheduler_worker.py +5。其余是 benchmark 适配器、RUNTIME.md、五臂 SKILL.md 与 RFC 双语检查点。

关键代码讲解

boundary()turn_envelope.ts:330):只在 schema_version 匹配、active_count > 0 且至少有一个合法 scope 时携带字段,其余情况信封与 baseline 逐字相同——测试对 active_count: 0、未知 schema、181 字符 scope 三种形态各断言一次 deepEqual(baseline)。

_prompt / run_codex_cli_hostcodex_cli.py:348:719:817):新增的那句提示把批准限定在 active_write_scope 内,并明说其他 scope、publish 与 production 仍走各自的闸门;except BaseException: _terminate_process(proc); raise 保证取消时不留下活着的子进程;sandbox 校验改为枚举错误信息。

_terminate_process_tree / run_capped_processprocess_runtime.py:74:99):POSIX 按进程组 SIGTERM→宽限→SIGKILL,宽限可配;except BaseException 包住主循环,finally 里 join 线程并关闭流。

BenchmarkCodexharbor.py:53):两个 benchmark 现在共用同一个执行入口,trial-local home、固定 model/provider/skills、五种显式模式都收在这里;被删掉模块的调用方通过保留的薄迁移入口agents/*.py)继续可用。

对主干的风险

CI 在我评审时还没跑完,所以不要把这一条读成绿灯。 gh pr checks 4671 当时是 7 pass / 12 pending / 0 fail(stage2c 的 mutants/e2e/installed、test-shard 1-4、kernel-static-checks、node 两种兼容性、windows、build、dashboard-acceptance 都还没结束);这个 head 是在我评审前 1 分钟推上去的。PR 自己写着"Final CI and exact-head review are required",我在结构化证据里把 repository_required_checks 记成 **unverified(pending)**而不是 pass——上次我在 #4669 上把没验证的检查写成 pass,这次不再重复。

我实际跑过、可以依赖的部分: benchmark/tests/test_shared_codex_runtime.py + tests/test_loopx_turn_codex_cli.py + tests/test_loopx_turn_driver.py120 passed / 4 skipped in 81.88stests/control_plane_ts/turn_envelope.test.ts14 passed / 0 failed。新套件里包含取消回收(test_scheduler_cancel_reaps_detached_worker_host_and_keeps_receipt)、超时保 receipt 并回收子进程、baseline/treatment 共用同一个 Harbor 入口、以及 fresh wake 共用环境而不复制 session。

我没能复现的: 真实 Harbor 0.5 / Docker / Codex 0.153.4 的 synthetic trials、baseline/head 的进程泄漏复现、Harbor 0.23 导入兼容性——这些都是作者报告。也就是说"每个模式在真实 arm 下产出一致结果"这一层我没有独立证据;PR 也明确不把这当作评测或 uplift 声明。

两处值得记一笔(都是 P3,不是阻塞):

  • body 里那句"Core sandbox default remains read-only"容易被误读。 它对核心 CLI 成立;但 benchmark 适配器仍然默认 danger-full-accessruntime/codex.py:21harbor.py:53worker.py:206,容器隔离内)。我核对了 base:codex_host.py:66run_mode.py:80 本来就是 full access,所以这是保持原样、不是新的提权;但建议在 body/RUNTIME.md 里点明 benchmark 默认值,别让读者把两件事混成一句。
  • #4439 的合并顺序。 两个 PR 都改 benchmark/swe-marathon/agents/ 下同样四个模块,本 PR 还删掉了 #4439 分支仍在携带的 runtime/**#4439 自 09-15 起没动过,合并后它需要 rebase 到共享入口。PR 已经披露了这一点,所以这属于给你排序的提示,而不是这里的缺陷。

我的整体评价

形状是对的,而且是这个方向上少见的"删得比加得多":一个执行入口、五种显式模式、被删模块留薄迁移入口而不是兼容包装、产品侧三个缝各自都是最小且 fail-closed(携带批准不放开其他闸门、显式 sandbox 不动默认值、取消时排干进程树)。披露也做得实在:trial home、memory 关闭、assisted 控件拒绝、preflight 不再准备网络、wake 超时来源、resume 会话显式传 sandbox,都写在"Disclosed changes"里。

我给的是契约与适配器这一半的批准结论;合并前请等 CI 跑绿(review 手记里记的是 pending),并按上面两条把 benchmark 默认值的表述与 #4439 的顺序处理掉。合并与否是你的决定,这条评论不构成合并许可。

English verdict: APPROVE — at 5fd33d0035591c179ecc2246c3f4a7d8369f6337 one shared Harbor adapter replaces the duplicated LHTB/SWE-Marathon runners, the three product seams are minimal and fail-closed (a carried scoped approval that provably cannot lift requires_parent_approval, an explicit danger-full-access choice with the core default still read-only, and cancellation that reaps the process tree), 120 focused Python cases and 14 TypeScript envelope cases pass locally including the cancellation/timeout reaping cases; the required CI run was still in flight (7 pass / 12 pending) and the real Harbor/Docker/Codex trials remain author-reported, and #4439 will need a rebase onto the shared entry.

Signed-off-by: huangruiteng <14976749+huangruiteng@users.noreply.github.com>

@huangruiteng huangruiteng left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Request changes conclusion (author-owned PR; GitHub blocks formal self-review)

Reviewed head: 587b48c25a7087df4e86d2e3c298d2757b67aead

动机

本 PR 解决 LHTB 与 SWE-Marathon 在安装、环境、会话和续跑规则上的重复实现。验收对象是可复用的原生 Harbor 执行路径及受控模式选择,依据 研究 RFC §11 的 native bridge/adapter 边界;不是长程能力提升或全量 benchmark 成绩。仅共享二进制安装无法消除 home、session、失败恢复的差异;另建产品 capability 又会重复现有所有权,因此共享研究 runtime 的范围合理。

改动思路

原生 job → BenchmarkCodex → trial home/phase → shared worker → 产品 heartbeat、Turn 或 native Goal → 原生 verifier。Harbor 保留任务、阶段、反馈和评分;核心保留 quota、session、事务恢复和结算。runner 仅保存尚未完成的 Turn 调用身份,失败后请求核心恢复,不另建状态机。工作目录授权通过既有 configure-goal --boundary-authority-scope 记录,envelope 携带已批准 scope,publish/production 的 gate 保留。

研究 RFC、现有 LHTB adapter、SWE runtime、核心 native Goal、Turn 和 external scheduler 均已对照。旧 agent import 保留为薄入口,复制的 Goal 状态机与 WEN/fixed-stage runner 已删除;历史实现可按原 revision 检查。相关 #4439 的 TB4 调用者需要迁移到共享入口;#3412 的事务恢复继续由核心拥有。

具体改动

44 个文件,约 +2142/-6087,主体是共享研究 runner 和重复实现退役,另有聚焦的核心修复、测试、配置及中英 RFC 检查点;没有提交运行日志、轨迹或私有状态。

关键代码讲解

  • BenchmarkCodex._stage_source/_prepare_phase:宿主 import、已提交 Git snapshot 和容器安装保持一致;经公开 CLI 初始化 trial Goal、记录工作目录批准并添加原生 phase Todo。
  • worker.run_once:同一 trial 的 provider/model/skills/config 固定,fresh 新建会话,resume 使用核心兼容会话;失败事务保留身份,使用 --resume-turn-key --retry-failed-turn。native Goal 复用已安装 transport,超时保留观察到的 receipt。
  • turn_envelope.ts::boundary 与 Codex _prompt:保留 quota 已解析的 checkpointed scope;无批准、未知 schema、无 active scope 时不增加授权。新 sandbox 选择必须显式传入,默认仍为 read-only。
  • run_capped_process / external scheduler:取消时向 worker 传递信号,给予清理宽限,回收独立 host 进程组;共享 runner 的 session 汇总避免重复累计,远程日志在填充 context 前下载。

LHTB launcher/preflight、SWE compatibility entry/config 和旧五臂指南都指向当前跑法。LHTB 从 per-wake home 改为 trial home、关闭 memories、退役 assisted WEN、分离 preflight/网络 prepare,均已明示。CLI 是受影响的产品入口;已检查 apps/packages,未发现配置该 headless Codex sandbox 的 frontend/Lark editor。

对主干的风险

没有发现尚未修复的阻断代码问题,但最终提交的 required CI 尚未完成,批准证据仍不完整。最终审查修复了 staging 再次解析 HEAD 的竞态:即使读取 SHA 后分支移动,归档仍绑定原 SHA;21 项共享测试包含该真实 Git 回归。主要风险是有意的研究环境迁移、旧消费者的配置适配,以及误把进程成功/原生 reward 当成 Turn 成功。验证原样保留后续 typed-result failure 和 active Goal timeout,未将它们改写为成功,也未更改评分。

最强反例已执行:旧代码在取消后仍产生子进程写入,修复后没有;旧 envelope 丢失已有批准,新测试在 baseline 为 13 pass/1 fail,在当前实现为 14 pass。默认 sandbox 和无批准时的 prompt 在 baseline/head 一致;TS 测试覆盖批准存在、缺失、inactive、未知 schema,其他 gate 保留。真实 Codex 三次调用证明 start/resume session 相同、fresh session 不同。

语义与 CI 对齐

本 PR 复用既有 Turn、checkpointed authority 和 native Goal 词汇,没有创建新的 actor/权限生命周期。模式组合和 argv 在输入处校验;验证/结算是强制规则,scope 说明不能自行创造批准。

本地覆盖 250 个 Python case(组合运行有一例 1 秒 fixture timeout,独立重跑 scheduler 的 6 项全部通过),14 项 TS envelope 测试、TypeScript typecheck、lint、shell 和 native Harbor config 解析;33 个当前变更文件的公开边界扫描通过;Linux Python 3.12 / Harbor 0.5 环境的 21 项共享测试也通过。真实 Harbor 0.5 / Docker / Codex 0.153.4 完成各模式合成任务。Turn fresh/resume 使用 e6c023ca9,与最终 head 的运行代码完全一致,随后补充文档,并将归档对象从 HEAD 锁定为已记录 SHA;该最后一行行为修复有真实 Git 分支移动回归覆盖,稳定 HEAD 下的其余已验证路径不变。未跑完整 LHTB/SWE-Marathon 或非 Docker backend,未作公平性、统计显著性和 uplift 结论。

我的整体评价

共享路径交付了请求的工程整合;保留不同控制模式的真实责任差异,同时删除了重复规则。强制逐字保持历史跑法会保留实验混杂,明确迁移并保留历史 provenance 更合理。当前 main 的新增文件与本 PR 没有路径重叠;合并前仍需按仓库规则核对最新 base 和 exact head。

REQUEST_CHANGES:当前唯一阻断是最终提交的 required CI 仍有排队/运行项,并非要求扩大代码改动。待 CI 完成后,应读取该 head 的最终结果并复核后再批准;此 PR 涉及 runtime/control-plane,留给 maintainer 合并。全量研究评测、TB4 消费者迁移和非 Docker 实际执行不在本次验证结论内。

English verdict: REQUEST_CHANGES — 587b48c25a7087df4e86d2e3c298d2757b67aead. The implementation and local/real-Harbor conformance are reviewed, with no unresolved blocking code defect found. Required final-head CI remains queued/running, so approval is held until those results are read back and this exact head is requalified. Native reward does not erase retained Turn failures or Goal timeouts; full benchmark claims remain out of scope. Maintainer merge required.

@huangruiteng huangruiteng left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approval conclusion (author-owned PR; GitHub blocks formal self-approval): reviewed exact head 587b48c25a7087df4e86d2e3c298d2757b67aead, no blocking finding. This is an independent audit of the unchanged head after required CI completed; the earlier hold on this PR was explicitly conditional on reading back CI. Merge remains the maintainer's decision.

动机

LHTB 和 SWE-Marathon 各自带一套 Codex 安装、环境准备与续跑实现,而且"看起来同名"的模式执行契约并不相同:同一份 turn/session/取消逻辑有两份副本,任何一边修好,另一边会静默漏掉;具体表现之一是 scheduler 取消时漏掉一个 detached worker。这个切片是研究 RFC §11 的 native bridge/adapter 部分——把两者收敛到一个 benchmark.runtime.harbor:BenchmarkCodex,显式列出 plain / native Goal / heartbeat / governed Turn / LoopX Goal 五种模式,并删除重复 runner。它是净删除而非再包一层,native 的 task/feedback/verification/scoring 仍归 benchmark 所有。

改动思路

产品侧只开三个最小的缝,其余全部复用既有产品代码:

  1. 把已解析的作用域批准带进 Turn 信封turn_envelope.ts 原本丢弃 quota 已解析的 checkpointed_boundary_authority,只剩 bootstrap 的批准要求,把已授权执行卡住。现在按严格形状拷贝(schema_version === "checkpointed_boundary_authority_v0"、整数 active_count > 0、最多 16 个 1..180 字符 scope),且不动 requires_parent_approval——携带批准不等于放开其他闸门。
  2. sandbox 变成显式选择。核心 CLI 默认仍是 read-only,新增 danger-full-access 作为显式选项,help 明确要求调用者自备隔离,并说明对新会话与 resume 会话都显式传入。
  3. 取消时排干进程树process_runtime.py 把终止从"只在超时/超输出触发"改为任何 BaseException 都触发,宽限期变参数(external scheduler 传 10s),清理移进 finallyexternal_scheduler_worker.py 把 SIGTERM 转成 KeyboardInterrupt。

具体改动

44 个文件、+2141/-6086(净 -3945):删除重复的 turn/modes/fixed-stage runner 与 no-sandbox wrapper,新增共享 runtime 包与其测试,其余为 benchmark 适配器、RUNTIME.md、五臂 SKILL.md 与双语 RFC 检查点。产品文件只有 5 个:quota/turn_envelope.tsturn_driver/codex_cli.pyextensions/process_runtime.pycli_commands/turn_registration.pyscripts/external_scheduler_worker.py

关键符号(行号在本次 head 核对):

  • benchmark/runtime/harbor.py:105 _stage_source:归档对象由 HEAD 改为已校验并记录在案的 headrev-parse 之后分支再移动,归档仍绑定被验证的 revision——本 head 最后一个提交正是这个竞态修复。
  • loopx/control_plane/quota/turn_envelope.ts:332 boundary():仅当 schema 匹配、active_count > 0 且至少一个合法 scope 时携带字段;其余情况信封与 baseline 一致。
  • loopx/control_plane/turn_driver/codex_cli.py:817 run_codex_cli_hostexcept BaseException: _terminate_process(proc); raise 保证取消/异常不留下活着的子进程;sandbox 校验改为枚举错误信息。
  • loopx/extensions/process_runtime.py:199 run_capped_processtry/except BaseException/finally 保证任何路径都终止进程树、join 线程并关闭流。
  • scripts/external_scheduler_worker.py:566:SIGTERM → KeyboardInterrupt,使 worker 经 capped-process 清理路径退出。

我实际复跑、可依赖的部分

  • benchmark/tests/test_shared_codex_runtime.py16 passed / 5 skippedpyteststage2c (mutants 0) / stage2c-correctness-e2e 在本 head 的 CI 里均为 pass
  • 归档竞态:新回归测试在本地因 harbor 包不可导入而 skip,所以我用独立复现验证了不变量本身——同一仓库里 git archive <sha> 得到 origgit archive HEAD 得到 succ;这正是该提交修掉的 TOCTOU。
  • 语义对齐:--codex-sandbox 新增值是加法且默认仍 read-only;无批准/未知 schema/inactive 时信封与 baseline 逐字相同;benchmark 适配器(harbor.py:53)继续用 danger-full-access,相对 base 是保持原样而非新提权。

对主干的风险

CI 本轮已读完并基本通过:Sign-off、build ×2、changes、checks、dashboard-acceptance、dependency-review、kernel-static-checks、merge-gate、node-forward/minimum-compatibility、postgresql-authority(真实 server)、pytest、stage2c(e2e 1/2、installed、mutants)、stage2c-correctness-e2e、test-shard 1-4、windows-powershell 全部 pass;唯一仍在跑的是已声明 non-blockingsonar / SonarCloud analysis。我在结构化证据里把 repository_required_checks 记为 verified,并把这一例外写在 skip/failure 字段里,而不是笼统写成"全绿"。

其余边界:

  • 本 head 落后 main(BEHIND):合并前必须更新分支,而更新会重启本次 exact-head 评审——这条批准只覆盖当前 head。
  • 真实 Harbor 0.5 / Docker / Codex 0.153.4 的 synthetic trials、baseline/head 进程泄漏复现、Harbor 0.23 导入兼容性都是作者报告,我没有独立复现;PR 也未把它当作评测或 uplift 声明。
  • #4439 改同一批 benchmark/swe-marathon/agents/*,本 PR 还删除了它仍在携带的 runtime/**,合并后需要 rebase 到共享入口;PR 已披露。
  • body 里"Core sandbox default remains read-only"容易被误读:它对核心 CLI 成立,benchmark 适配器仍然是 danger-full-access(容器隔离内)。建议在 body/RUNTIME.md 点明 benchmark 默认值。

我的整体评价

形状是对的,而且是这个方向少见的"删得比加得多":一个执行入口、五种显式模式、被删模块留薄迁移入口而不是兼容包装,产品侧三个缝各自最小且 fail-closed(携带批准不放开其他闸门、显式 sandbox 不动默认值、取消时排干进程树)。披露也扎实:trial home、memory 关闭、assisted 控件拒绝、preflight 不再准备网络、wake 超时来源、resume 显式传 sandbox 都写在 "Disclosed changes" 里。最后一个提交把我在上一轮指出的 staging 竞态真正修掉了,而且带真实 Git 回归。

我给出的是代码与验证这一半的批准结论;合并前请先更新分支以解除 BEHIND,并知悉该更新会使本次评审失效、需要重新评审。这条评论不构成合并许可。

English verdict: APPROVE — at 587b48c25a7087df4e86d2e3c298d2757b67aead one shared Harbor adapter replaces the duplicated LHTB/SWE-Marathon runners; the three product seams are minimal and fail-closed, the last commit closes the source-staging TOCTOU by archiving the verified SHA (independently reproduced: by-sha=orig vs by-HEAD=succ), and required CI is now complete and green with only the declared non-blocking Sonar job pending. Residual: real Harbor/Docker/Codex trials remain author-reported; the branch is BEHIND main so an update is required and will restart this exact-head review.

@huangruiteng
huangruiteng merged commit d5bf42a into main Sep 18, 2026
5 of 6 checks passed
@huangruiteng
huangruiteng deleted the codex/benchmark-runtime-unification branch September 18, 2026 02:39

@huangruiteng huangruiteng left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approval conclusion (author-owned PR; GitHub blocks formal self-approval)

审阅对象:PR #4671(已合并),exact head 57285915b1de94df425182fb157be5692e9ae12f(作者 huangruiteng),merge commit d5bf42a2930c97987f3f5bb89388cedfb320cb6d,2026-09-18T02:39:02Z 合并。本文是该 exact head 的 post-merge audit。

动机

LHTB 与 SWE-Marathon 各自实现了一遍安装、环境准备与续跑逻辑,而且"同名模式"在两个家族里的执行契约并不一致。这既让结果不可比,也让每个修复必须做两遍。本 PR 让两个家族共用 benchmark.runtime.harbor:BenchmarkCodex:一个 trial 内唯一的 Codex home、固定的 model/provider/skills,并把差异留给各家族的配置。

改动思路

这是一次以删除为主的收敛:新增 benchmark/runtime/{harbor,codex,codex_offline,planning,worker}.py(harbor.py 680 行)承载共享实现,删掉 LHTB 的 runtime/wake_once.py 与 SWE-Marathon 的 runtime/modes/*runtime/turn/*(合计约 6000 行)。原生 datasets、tasks、environment、feedback 与 verifier 设置仍归各家族所有,共享的是执行契约而不是数据。配套还有三处产品侧的运行时修正:可配置的进程终止宽限 + 取消时保证清理;把已解析的 boundary authority 带进 Turn envelope;把 seeded task entry 与 planning checkpoint 分开并显式化。

具体改动

55 个文件、+3197/-6129(净 -2932)。

  • benchmark/runtime/harbor.py:trial 内只建一个 Codex home;暂存源码从 git archive ... HEAD 改为 git archive ... <resolved head>,即固定到已核实的 revision,避免 HEAD 漂移影响可复现性;不上传 checkout、实验产物或 trajectory。
  • loopx/extensions/process_runtime.py:终止宽限从常量改为参数;等待循环包上 except BaseException → 终止整棵进程树后重新抛出,线程 join 与流关闭移入 finally,超时/截断/取消都不会留下孤儿进程或泄漏管道。
  • loopx/control_plane/quota/turn_envelope.ts:把 quota 已解析的 checkpointed_boundary_authority 原样带入边界载荷——此前被丢弃,导致只剩 bootstrap 要求、已授权执行被卡住;转发前校验 schema_version、active_count 与 scope 字符串边界。
  • 任务入口显式化:--task-entry 采用闭集选择,默认 seeded-todoloopx-planned 为可选项,并在配置注释与文档中写明。

在合并 head 上复现的验证:benchmark 测试 41 passed / 13 skipped(跳过项需要真实 Harbor 环境);tests/control_plane/test_task_planning.py + tests/test_loopx_turn_codex_cli.py 39 passed;tests/control_plane_ts/turn_envelope.test.ts 14 passed;tests/extensions/test_process_runtime.py + test_extension_runtime.py 65 passed。内容完整性:merge commit d5bf42a29 的父提交为 d8e7af141(main) 与 57285915b(PR head),按作者提交落地。公私边界扫描未发现私有路径、凭据或内部链接;.env.example 只是移除了已退役的 LOOPX_WAKE_TIMEOUT_SEC

对主干的风险

最大风险是"统一执行契约会悄悄改变 trial 语义,而单元测试照样通过"。缓解有三层:暂存源码固定到已核实 revision 并保留可追溯的归档;执行契约写入 benchmark/runtime/RUNTIME.md;任务入口从隐式变为显式选择(默认 seeded-todoloopx-planned 需显式开启)。评分、聚合、榜单与提交行为均未改动,家族配置在同一 diff 内更新。

配套的产品侧改动我已经逐项看过:进程终止的清理路径把 join 提前到 process.wait() 之前,不会死锁(读者线程随管道 EOF 结束,进程并未等待我们);turn_envelope 的转发只做校验与截断,不会扩大已解析的授权。需要如实写下的证据边界:本轮没有启动任何真实 LHTB/SWE-Marathon 作业,13 个 benchmark 测试因缺少 Harbor 环境被跳过,因此"与旧 runner 端到端等价"这一点并未被证明,只能依靠 provenance 固定与归档修订来兜底;PostgreSQL 集成套件同样未跑。这符合本仓库"不启动 benchmark 作业"的约束。此外该 head 合并没有留下绑定到它的评审记录,本文补上。

我的整体评价

结论 APPROVE。这是本轮合并审计里最有价值的净删除:约六千行重复 runner 被一个共享实现取代,同时把最容易被忽略的可复现性问题(暂存源码跟着 HEAD 漂移)一并修掉,并把任务入口从"同名不同义"变成显式选择。三处产品侧改动都小而可验证,其中"取消时终止整棵进程树并清理"与"把已解析授权带入边界"都是实打实的行为修复,而非重构副作用。唯一未闭合的是端到端 trial 等价性——这属于需要真实 Harbor 的验证,超出本审计环境,已如实记录为证据边界而非通过项。

English verdict: APPROVE - #4671 at exact head 5728591 consolidates LHTB and SWE-Marathon onto one shared Harbor Codex execution contract, net-deleting roughly three thousand lines (the duplicated per-family mode/turn runners and the LHTB wake module) in favour of benchmark/runtime, and pinning the staged source archive to the resolved verified revision instead of a moving HEAD. The PR head is a parent of merge commit d5bf42a, so the content landed as authored; native datasets, tasks, environment, feedback and verifier settings remain with each family, and no scoring, leaderboard or submission behaviour is touched. The accompanying product-side fixes are small and tested: configurable process-termination grace with guaranteed cleanup on cancellation, carrying the already-resolved checkpointed boundary authority through the Turn envelope (previously dropped, which stranded authorized execution), and an explicit task-entry choice defaulting to seeded-todo. Verified at the merged head: 41 benchmark tests (13 skipped, requiring Harbor), 39 control-plane tests, 14 TypeScript turn-envelope tests and 65 process/extension runtime tests pass; the public/private boundary scan is clean. Evidence boundary stated rather than papered over: no real benchmark job was launched, so end-to-end parity with the previous runner is not proven here. Process note: no review was bound to this head at merge time; this exact-head audit supplies it.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant