Repository navigation
feat(benchmark): support task-owned clocks in native Stop-hook baselines - #8791
Conversation
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.1-sol · OpenAI · runtime_reported · reasoning_effort=max
Request changes conclusion (author-owned PR; GitHub blocks formal self-review)
评审提交 153e241c9ec6c635b2f1c3a9ed6b073fbe1cef04,对照基线 58cc5817e35ea9a0dc4697f7791279c6d80946bc。
[P2] Stop hook 的初始化会越过阶段截止时间并返回普通失败。 Harbor 的 plain worker 开启 official_stop_hook,阶段只剩 1.5 秒。原生 app-server 的 initialize 在剩余时间内没有响应。 实际 worker 等约 10.1 秒后以退出码 1 报 app_server_response_timeout:initialize,未记录 budget_exhausted。零模型请求,发现进程已清理。 发现 RPC 的固定等待 worker 的发现调用
动机 / Motivation
使用 Harbor 的共享 Codex worker,比较单会话 deadline baseline 的研究操作者。 原生 Stop hook 进入模型前需要发现与信任。阶段时间也可能在这一步耗尽,Harbor 依据退出结果决定评分流程如何继续。 基线关闭扩展时直接运行既有 plain 入口,并保留普通 phase reserve。它没有这一步额外的 app-server 发现。 同一真实 Codex 与本地 Responses 对照中,关闭时一条请求。开启时同一会话产生续做请求;阶段限时终止该会话,回执保留 budget_exhausted。 本轮在 macOS 用真实 Codex 0.167.0-alpha.4.1 和本地合成模型响应。短预算故障只替换 app-server 的初始化行为;没有运行付费模型、真实评分、Linux 工作负载或托管 CI。
改动思路 / Approach
Harbor 继续持有任务阶段时钟与评分出口。共享 worker 负责求解进程和清理。既有 Codex stdio transport 读回 hook 身份,也供上下文传输使用。 开启时可用完整阶段,进程清理由外层留余量。当前固定 RPC 等待发生在下一次阶段检查之前,正常的阶段结束被标成初始化错误。 阶段与外层 supervisor
具体改动 / Changes
关键代码讲解
- typed plain opt-in 控制生成 hook 与日志,统一 native discovery 按事件、命令、启用状态和 native hash 验证。旧 context delivery 复用同一个发现函数。 试验配置 共用发现
- 实际 worker 启动时只生成一次 native 会话。有正常 hook 的对照达到两条本地请求,退出码 124,回执标记 budget_exhausted。关闭时基线和候选各一条请求,均未启动发现。 native exec argv 同会话测试
- 剩余 1.5 秒时让 app-server initialize 挂起,候选约 10.1 秒结束并报普通错误。隔离因果副本给发现应用剩余时间并保留阶段终态,约 1.5 秒结束,零模型请求且记录 budget_exhausted。完整 PR 为 8 文件、+211/−69。 阶段时钟
按 benchmark/runtime/RUNTIME.md 核验。single-session-native-continuation 和 plain-off-parity 已实测。phase-clock-through-hook-discovery 未满足。 配置与阶段时钟要求
对主干的风险 / Risks
阶段在发现期间结束时,退出码 1 会交给 Harbor 的命令错误分支。外层的 30 秒清理余量允许这一故障完整发生。复用已有 native transport 的绝对时钟方式,每次 RPC 前重新从同一截止时刻扣已用时间。 现有绝对截止示例
语义与 CI 对齐
51 项聚焦开启、关闭、native discovery 与已有 heartbeat 宿主路径通过。更广的 native 配置 234 项通过,11 个旧 checkpoint 用例在基线与候选都先因缺 interaction_contract 失败。标准预合并补齐本地 TypeScript 工具后 10 项自动检查零失败,Benchmark 人工门仍开。 本轮在 macOS 用真实 Codex 0.167.0-alpha.4.1 和本地合成模型响应。短预算故障只替换 app-server 的初始化行为;没有运行付费模型、真实评分、Linux 工作负载或托管 CI。
我的整体评价 / Verdict
请求修改。把现有阶段截止时刻传给 Stop hook 的发现路径。每次 initialize 和 hooks/list 都按同一个剩余预算限时。仅真实越过阶段截止时走已有 budget_exhausted 分支,保留提前发生的普通发现故障和清理。 用可控的 app-server 分别阻塞 initialize 与 hooks/list,在短阶段复测进程退出、日志、零模型请求和正常阶段耗尽回执。再复验配置关闭和稳定开启的一次会话路径。
English verdict: REQUEST_CHANGES at 153e241. Native same-session continuation and off parity pass. A stalled hook discovery uses a fresh 10-second initialization wait against a 1.5-second remaining phase and exits as an RPC failure rather than recording phase exhaustion.
…nner Signed-off-by: LoopX Agent <[email protected]>
Signed-off-by: LoopX Agent <[email protected]>
153e241 to
d9a3ffe
Compare
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.1-sol · OpenAI · runtime_reported · reasoning_effort=max
Request changes conclusion (author-owned PR; GitHub blocks formal self-review)
评审提交 d9a3ffe86601b7124cc65776ab3b74c567f14964;对照目标基线 48dbebbd14c5535b9631f4c7a1152d86aa64c5b2。
[P2] 分开锁定版本时 Stop hook 在 initialize 前失败。 将 LoopX 产品锁在目标 main,将研究 runner 锁在本次提交,在 Harbor 的 plain 模式开启 official_stop_hook。 实际 staging 只覆盖 benchmark/runtime,留下产品 pin 的 StdioNativeGoalTransport。Runner 在 initialize 调用中传入旧产品不接受的 deadline,worker 退出码 1,零模型请求,试验无法启动。 触发分支
动机 / Motivation
在 Harbor 配置原生 Codex deadline baseline 的实验操作者。 同一套研究 runner 比较使用主干产品和候选产品的实验。有的 arm 选单会话循环续做。 目标 main 提供分锁 staging 及原有两参数 transport。先前 plain 基线不进入 Stop 发现,关闭时仍用原 phase reserve。 实际 staging 只覆盖 benchmark/runtime,留下产品 pin 的 StdioNativeGoalTransport。Runner 在 initialize 调用中传入旧产品不接受的 deadline,worker 退出码 1,零模型请求,试验无法启动。 同锁开启后 native Codex 在一个会话中产生续做请求。两次发现共用 2.1 秒时钟,第二个 RPC 期间到期,进程回收,退出 124,记录 budget_exhausted 且未运行模型。分锁关闭时仅一条模型请求、零发现。 本轮用实际 Harbor staging 代码加本地归档传输、macOS 原生 Codex 0.167.0-alpha.4.1 和 loopback Responses。未运行远端 Harbor、真实模型、Linux 评分或托管 CI;Benchmark 人工门仍保留。
改动思路 / Approach
Harbor 拥有产品与 runner 的独立档案和阶段时间;共享 worker 拥有当前原生求解进程和回执,Codex stdio transport 负责 RPC 及 hook 身份。 Keep one deadline and one native authority, and make the cross-package compatibility edge explicit in the existing stage/transport owners. Stage pinned archives, verify an exact native hook, launch one original session and return its wake receipt.
具体改动 / Changes
关键代码讲解
- Harbor staging 只覆盖 runner 的 runtime;分锁使用说明 明确要求保留产品版本。主干 transport 没有 deadline 参数。
- 候选 worker 将同一绝对时钟用于发现和求解。两次 RPC 各延迟 1.25 秒时,2.1 秒阶段在 hooks/list 结束前耗尽,发现子进程已回收。
- 原生同会话用例 核对留在一个会话。关闭时实际 worker 只发一次模型请求;已有 上下文发现 没有这个调用限制。完整差异为 9 文件、+300/−72。
按 benchmark/runtime/RUNTIME.md 的当前基线约束,single-session-native-continuation 已验证;phase-clock-through-hook-discovery 已验证;plain-off-parity 已验证;split-product-runner-compatibility 未满足。基线验收依据
对主干的风险 / Risks
用同一 checkout 同时供给两端会掩盖这个 ABI 断层。当前明确支持的产品 main 与研发 runner 组合启用这条 arm 时不会达到推理或评分。不能用覆盖产品 pin 来让试验通过。
语义与 CI 对齐
227 项本地检查通过,19 项跳过;单独复验的原生 Stop 和上下文 hook 身份集合 48 项通过。独立归档和 worker 试验覆盖 4 组。Standard premerge 六项直接、18 项选中检查通过,人工门保持,未查询托管 CI。 本轮用实际 Harbor staging 代码加本地归档传输、macOS 原生 Codex 0.167.0-alpha.4.1 和 loopback Responses。未运行远端 Harbor、真实模型、Linux 评分或托管 CI;Benchmark 人工门仍保留。
我的整体评价 / Verdict
请求修改。让有截止时间的 Stop 发现只依赖可随 runner 一起交付的兼容接口;保持产品 pin 和同一绝对阶段时钟。若确实要限制可用产品版本,应在安装时明确拒绝不兼容版本并记录要求。 Stage verified current main as product and exact PR as runner; invoke the staged worker with plain official_stop_hook enabled and disabled, then rerun with both pins on the PR.
English verdict: REQUEST_CHANGES at d9a3ffe. The discovery deadline now holds with matching pins. With the documented split pins, the staged runner sends deadline to main's older transport, exits before inference and cannot start the enabled trial. Disabled plain behavior still passes.
…clocks Signed-off-by: LoopX Agent <[email protected]>
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.1-sol · OpenAI · runtime_reported · reasoning_effort=max
Request changes conclusion (author-owned PR; GitHub blocks formal self-review)
评审 head d42379e94bf1fa278511543f33f8c21d865e3385,当前目标 main b9f2e2a516b58e62cbb0da6978625388322b5a90。完整 11 文件已审,不能继承旧 head 的结论。
[P2] 分锁产品后,Stop 发现仍在 initialize 前失败。 新调用 向产品 transport 传 deadline;实际 staging 只覆盖 benchmark/runtime,保留 main 的旧 request(method, params)。按相同归档布局运行实际 worker,得到 TypeError: unexpected keyword argument 'deadline',零 initialize RPC、没有 exec 启动。同锁成功,不能替代分锁证明。原 d9a 评审指出的阻断在本 head 仍成立。
动机 / Motivation
使用 Harbor 共享 Codex runner、将产品版本与研究 runner 分别锁定的实验操作者。 操作者把产品锁在当前 main、runner 锁在候选并开启原生 Stop hook;同锁能进入一个会话续做,分锁却在第一次 initialize 前失败,任务根本没有开始。 独立归档探针确认:关闭时 main/head 都成功且没有发现 RPC;同锁开启成功;产品 main 加候选 runner 开启返回 TypeError、零 initialize RPC、没有 exec 启动。 本次审查覆盖当前完整 PR 的 runner、原生发现和阶段预算,不运行真实模型、评分实验、远端 Harbor、安装或合并,也不证明任务质量或完整成本改善。 不改代码可保留普通单次 baseline,却仍缺可用的受控单会话 arm;复用现有 hook/进程 owner 是合理边界,必须同时守住公开的独立版本契约。
改动思路 / Approach
Harbor/SForge 持有任务反馈、最终提交与取消;worker 在隔离 home 生成 hook,经 native host 精确读回事件、命令、启用状态和 trust key/hash,再启动同一个 exec 会话。现有 context delivery 的身份核验被提取到一个 helper,没有另建 trust 算法。预算属于原 phase,cleanup 的额外等待不能变成额外求解时间。
机制规模适当,但 deadline API 必须位于可一起交付的兼容边界。当前 PR 的完整可交付边界应是“受限 plain opt-in、统一发现、相同任务时钟,且独立产品/runner 可正常配置”。让有限截止时间发现依赖可随 runner 一起交付的兼容接口,保持产品 pin;或在安装入口明确检查并报告最低产品能力,不能用覆盖产品版本掩盖分锁失败。 保留受限 plain opt-in 与统一 hook owner;先修复独立产品/runner 的 deadline 接口再交付。 原生策略、通用 IO 与实验观测应继续分属其现有 owner。
具体改动 / Changes
关键代码讲解
- Execution 严格要求 boolean、plain-only;默认 false,Harbor 向 worker 显式传 0,ambient 1 不应启用新 arm。关闭时不生成 Stop 文件、指令或回显字段。
- prepare_native_hooks 复用 exact-handler 多重集和 native key/hash,拒绝替换、禁用与重复 handler;两次 RPC 接收同一 monotonic deadline。
- run_once 在发现前保留原 worker/phase 截止时刻;发现耗尽时不运行求解,提前协议拒绝仍为普通错误。无总 clock 时由任务控制器终止。
- StdioNativeGoalTransport.request 支持可选 deadline;但它是产品模块,runtime-only overlay 没有把新签名交给分锁 worker。
依据 benchmark/runtime/RUNTIME.md,spec_revision b9f2e2a516b58e62cbb0da6978625388322b5a90;同时核对同一版本 benchmark/edgebench/README.md 的分锁要求。single-session-native-continuation、phase-clock-through-hook-discovery、plain-off-parity 已有决定性证据;split-product-runner-compatibility 未满足。新说明不是独立于旧版本契约的豁免。
对主干的风险 / Risks
| 相同合成任务/归档布局 | 实际结果 |
|---|---|
| main 产品/runner,关闭 | 成功,零 discovery RPC,exec 启动 |
| 候选产品/runner,关闭 | 同样成功,无 Stop discovery |
| 候选产品/runner,开启 | 两次发现 RPC,exec 启动 |
| main 产品 + 候选 runner,开启 | TypeError,零 initialize RPC,未启动 exec |
这组反例执行真实归档中的 worker 与产品 transport;host 为合成协议 fixture,不证明模型或 native trust 实现。另用实际 macOS Codex 0.169.0-alpha.11.1 和 loopback 合成响应验证三个 native 用例:关闭单次、开启同会话续做、无总 clock 的任务控制器取消,全部通过。没有外部模型或评分调用。
语义与 CI 对齐
标准 premerge 的 diff/bilingual、compile、module ceiling 与 18 项 selected 均通过,Benchmark 人工门仍保留。较广三个模块为 202 passed、130 skipped、5 failed;同命令 main 为 193 passed、126 skipped、7 failed,五个共同失败都是裸 test_loopx_turn_codex_cli import 不可用。按现有测试目录补齐 PYTHONPATH 后,候选五例定向复验全部通过;保留两份原始失败,不称整个 suite 重跑通过。main 另外两项分别为 session identity 未确认和 scheduler 返回 2;候选相关用例通过,但没有据此补造旧失败的唯一根因。未查询、轮询或等待 CI。新增 trial flag 由既有 typed Execution 承载;当前阻断是实际独立部署契约失败,不是未来架构偏好。
我的整体评价 / Verdict
请求修改。有限同锁 discovery 时钟和 native 单会话路径已验证;long_horizon 与 user_experience 在受支持分锁入口仍未证明,因为任务不能开始。首先修复这个版本接口边界,再用分锁/同锁、开启/关闭四组和 native deadline/取消复验。未改渲染页面、布局或产品 UI;已检查文档/CLI 的实际入口及失败读回。原生 Windows、其他指定版本、远端 Harbor、真实任务和完整成本仍未验证,不把本轮 native fixture 当效果收益。
English verdict: REQUEST_CHANGES at d42379e. Same-pin native continuation and cancellation pass; the supported split-pin worker still fails before initialize because main's transport does not accept deadline.
|
This pull request has merge conflicts with Choose the remote for the base repository, not an out-of-date fork. git fetch upstream
git rebase upstream/main
# Resolve each conflict, git add the resolved files, then git rebase --continue.
git push --force-with-lease origin HEADFor a same-repository clone whose Keep the DCO |
…NTIME.md) Signed-off-by: LoopX Agent <[email protected]>
…ned runners Signed-off-by: LoopX Agent <[email protected]>
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.2-sol · OpenAI (runtime_reported, xhigh)
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
只读独立代码评审结论
APPROVE。 评审固定提交 545a33da03a9688a0ac81dc2bb0fd9305f9ed786,merge base b4e1ded37d4ecf1d43b788cf9d870d3e1020d3ab。与核对时 main b4e1ded37d4ecf1d43b788cf9d870d3e1020d3ab 三方整合无冲突。本轮代码评审覆盖独立产品/runner 契约。 上轮评审
动机 / Motivation
用同一个原生 Codex 会话支持 benchmark 的官方式 plain baseline,外部任务控制器继续持有反馈、提交和终止。 普通 plain 单次 exec。上轮启用 Stop hook 的分锁运行在首次 initialize 前因旧两参数 transport 签名拒绝 deadline。 共享发现验证 exact handler 和 trust identity。已知新 transport 接收同一 monotonic deadline;旧 transport 每个 RPC 依剩余时间限定现有响应超时。无总时钟,仍保持发现 RPC 超时。
将当前 main 产品原样归档,只覆盖 benchmark/runtime。分别以旧候选和现候选分锁运行;对照同锁,切换 off/on,并让第二次发现 RPC 无响应。另通过原生 Codex 和合成 loopback 模型响应观察单会话。 本地验证未覆盖远端 Harbor、Windows、其他 Codex 版本、真实模型和原生评估,未测分组的匹配效果与完整成本。 现有交付规则
改动思路 / Approach
默认 off。native plain 才允许 boolean opt-in。未开启时原 cutoff、exec、配置和回执省略新字段。 复用产品 transport 和原 runner 的进程、phase、task controller。隔离 home 的 hook 显式开启才生效;发现不启动推理。 旧 API 只在每次发现请求前计算同一个 monotonic 截止时间的剩余量。协议拒绝保留原分类;关闭和资源回收的时间沿 existing supervisor 管辖。
具体改动 / Changes
完整 diff 共 10 个文件,新增 489 行、删除 74 行。上轮独立产品/runner 版本接口阻塞已闭环。
-
split_pin_transport。原产品锁定、只替换 runner 时正常发现原生 hook 并按时停止
-
plain_off_parity。关闭时不生成新 Stop 入口或额外发现步骤
-
one_session_and_controller_cancel。有限和任务控制器自然时钟都保持原生单会话续做
-
prepare_native_hooks。启动独立原生 app-server 并核验同一 hook 配置和加载身份。 精确代码 -
legacy deadline adapter。在真实两参数 transport 上按剩余 monotonic budget 约束 RPC。 精确代码 -
run_once。保留相同 phase deadline,区分发现失败和未启动求解的预算耗尽。 精确代码 -
StdioNativeGoalTransport.request。同锁用既有超时和绝对调用者时限的较小值,未传参时沿用原路径。 精确代码 -
BenchmarkCodex。Harbor 提供原预算参数和明确的 opt-in,并保持 task controller 所有权。 精确代码
对主干的风险 / Risks
精确头同锁和实际旧产品+新 runner 的分锁均通过关闭、开启和两处发现耗尽四组。关闭只有 exec;开启严格按 initialize、initialized、hooks/list、exec;分别卡住 initialize 和 hooks/list 都记录发现耗尽,solver 从未启动。
定向仓库套件 186 项通过、130 项跳过。独立实装 native 五例另计。双语 RFC diff 检查通过。完整十文件、DCO、diff --check 与当前 main 合成树已核对。
当前 main 的实际产品模块继续暴露两参数 API。分锁运行前一阻塞提交稳定复现 0 RPC。新旧 runner 关闭时都成功且零 Stop discovery 申请。 实际分锁旧产品的 transport 经源码路径及 request 签名确认。同锁和分锁都分别覆盖 initialize 与 hooks/list 未收到回复、耗尽预算、零 solver exec。
我的整体评价 / Verdict
可以采纳当前代码改动。原生 Stop hook 的普通关闭、分锁兼容、有限超时和控制器取消均有对应执行证据。远端 Harbor 与真实研究结果各自保留部署和采用验收。
English verdict: APPROVE at 545a33d. The supported split pin now starts native hook discovery with the legacy product transport, preserves the finite phase and default-off behavior, and leaves remote Harbor and live study acceptance open.
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · Gemini · Google · self_reported
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
评审 exact head 545a33da03a9688a0ac81dc2bb0fd9305f9ed786(对照基线 b4e1ded37d4ecf1d43b788cf9d870d3e1020d3ab):无阻断缺陷。此前导致请求修改(PRR_kwDOStEbEs8AAAABYR-FtQ)的分锁版本 ABI 断层已通过 native_hooks.py 签名检测与逐 RPC 超时回退修复,并通过真实的 origin/main 两参数 StdioNativeGoalTransport 反事实探针、原生 codex-cli 测试与关闭路径对照验证。
动机 / Motivation
Operators using BenchmarkCodex or the shared benchmark worker to run single-session native Codex baselines with Stop-hook continuation across homogeneous and split-pinned deployments.
Before this PR, plain mode has no native Stop-hook continuation baseline, and earlier revisions passed deadline directly to StdioNativeGoalTransport.request, crashing split-pinned trials with TypeError before initialize when the product remained pinned on main. At this head, plain mode with official_stop_hook=true verifies the trial-local Stop hook over initialize and hooks/list on both 2-arg and 3-arg transports under one shared clock, keeps single-pass plain defaults unchanged (fp=d4ac265935129789), and records budget_exhausted without launching exec when discovery exhausts the phase deadline.
Default plain and heartbeat paths show zero config or receipt delta (fp=d4ac265935129789 across base and head); opt-in official_stop_hook=true continues one native Codex session through Stop-hook blocking, shares the phase deadline across discovery and execution, works against both 2-arg origin/main and 3-arg head transports, and lets task controllers run without an execution deadline while bounding discovery RPCs.
This PR does not run live external model trials or Docker Harbor score comparisons, does not claim higher benchmark scores over single-pass baselines, and does not change SForge outer auto-resume or heartbeat context delivery semantics.
在未合并此改动前,研究者只能在“无 Stop hook 的单 pass plain 基线”与“带 LoopX 上下文编排的 heartbeat 模式”之间切换,缺少对齐原生官方单会话行为的可比对基线,同时此前提交在 LOOPX_SRC_DIR 固定于主干而 LOOPX_RUNNER_SRC_DIR 固定于候选版本时会直接因签名不匹配退出。本次 exact head 已在同一边界内把单会话续做、发现期阶段时钟守恒与跨版本分锁兼容补齐,无需继续额外加层即可安全合入或独立启用对照。
改动思路 / Approach
入口分为两条:Harbor 调度的 BenchmarkCodex._worker_env / run 与直接调用的 worker.run_once。唯一权威状态为配置层 Execution(mode="plain", official_stop_hook: bool)(由 LOOPX_OFFICIAL_STOP_HOOK 显式 "0"/"1" 序列化,不继承环境隐式变量)以及 Codex 原生 app-server 经 hooks/list 返回的精确 handler 与 currentHash。决定边界与状态转移由 prepare_native_hooks 与 run_once 联合承担:若关闭,零改动直入既有的单 pass exec;若开启,先写试次私有的 hooks.json(0o600),通过 StdioNativeGoalTransport 检查远端 request 是否接受 deadline 关键字(主干 2 参则退回到按剩余截止时间收紧 response_timeout_sec 并统一映射为 subprocess.TimeoutExpired),完成 initialize + hooks/list 校验并将精确 hooks.state={key = { trusted_hash = ... }} 传给同一 codex exec 会话,最后扣除发现耗时将剩余预算交给 codex exec;phase_work_reserve 在开启时返回 0,并在 Harbor 外层追加 30s 清理余量以便 worker 在超时时落盘 receipt.json 后以退出码 124 退出并被外层映射为 0。相比此前在 context_delivery.py 与新模块各写一份 app-server 发现逻辑,本 PR 将共有发现逻辑下沉到 native_hooks.py,由 context_delivery.py 直接复用并删去 52 行重复代码。
Separating configuration invariants (Execution in codex.py), shared native hook registration and transport negotiation (prepare_native_hooks in native_hooks.py), phase deadline bookkeeping and worker execution (run_once in worker.py and BenchmarkCodex in harbor.py), and optional transport RPC deadline enforcement (StdioNativeGoalTransport.request in codex_stdio.py) keeps one canonical hook-verification owner while deleting 52 duplicate lines from context_delivery.py and preserving clean split-pinned product compatibility.
当前 PR 边界为:Opt-in plain-mode native Stop-hook baseline (codex.py, harbor.py, scheduler.py, worker.py, native_hooks.py), shared native hook discovery consolidation (context_delivery.py), optional monotonic deadline support in StdioNativeGoalTransport.request (codex_stdio.py), runtime contract doc update (RUNTIME.md), and unit plus real native Codex tests without modifying SForge or default plain runs.
具体改动 / Changes
关键代码讲解
Execution(benchmark/runtime/codex.py#L24-L53):新增布尔字段official_stop_hook: bool = False,在__post_init__中强制约束非布尔值及非plain模式抛ValueError,并在codex_settings开启hooks = true。prepare_native_hooks(benchmark/runtime/native_hooks.py#L19-L106):先落盘或校验试次内不可变hooks.json,再经StdioNativeGoalTransport.spawn调用原生app-server。通过inspect.signature(native.request).parameters判断产品侧是否支持deadline:支持则用functools.partial(native.request, deadline=deadline);分锁命中主干两参数签名时,每次 RPC 前计算remaining = deadline - started,收紧native.response_timeout_sec并在caller_limited时将NativeGoalProtocolError("app_server_response_timeout:{method}")转为subprocess.TimeoutExpired,避免误报普通初始化失败;随后逐项精确比对eventName/handlerType/command/matcher/timeoutSec/async/enabled并拼装hooks.state。context_delivery.py#L47-L64已直接改用该共享实现。run_once(benchmark/runtime/worker.py#L586-L866):在execute阶段前先记录独立的official_worker_deadline,计算phase_work_reserve("plain", official_stop_hook=True) == 0,将较紧的期限同时约束prepare_official_stop_hook与后续codex exec等待;若发现阶段耗尽阶段预算,置host_invoked=False与budget_exhausted=True并保留退出码124收尾。phase_work_reserve&BenchmarkCodex(scheduler.py#L21-L24、harbor.py#L701,L905-L921):在 Harbor 向子进程环境显式写入"LOOPX_OFFICIAL_STOP_HOOK": "0"|"1"隔离宿主环境变量;开启时阶段预留归零,并将外层timeoutsupervisor 余量设为remaining + 30s供 worker 写出完整receipt.json。StdioNativeGoalTransport.request(loopx/control_plane/turn_driver/codex_stdio.py#L112-L145):新增可选关键字参数*, deadline: float | None = None,当调用方 deadline 早于默认response_timeout_sec时按deadline收敛并抛出subprocess.TimeoutExpired;同锁下无需经过回退分支即可一次穿透两轮 RPC 预算。
全量 diff 为 10 个文件(+489 / -74),其中生产代码 7 个文件(+192 / -73)、测试 2 个文件(+273 / -1)、文档 1 个文件 benchmark/runtime/RUNTIME.md(+24 / -0)。
规格依据 spec_ref: benchmark/runtime/RUNTIME.md,spec_revision: b4e1ded37d4ecf1d43b788cf9d870d3e1020d3ab(并核对同版本 benchmark/edgebench/README.md 的 LOOPX_SRC_DIR / LOOPX_RUNNER_SRC_DIR 分锁要求;PR 内向 RUNTIME.md#L84-L106 追加的 Official-style Codex Stop hook 段落仅作为新增默认关闭实验项的披露文本审核,不将其当作自我授权依据):
single-session-native-continuation:implemented(native_hooks.py#L19-L26、worker.py#L717-L733、test_official_stop_hook_continues_one_real_native_session_until_timeout原生codex-cli 0.171.0-alpha.13实测通过)。phase-clock-through-hook-discovery:implemented(worker.py#L670-L733,L838-L857、codex_stdio.py#L112-L131、阶段超时用例及分锁hang探针1.206s实测通过)。plain-off-parity:implemented(codex.py#L35,L52、harbor.py#L701、worker.py#L589-L606、基线与 HEAD 显式/隐式关闭四组对比输出字节指纹完全一致d4ac265935129789)。split-product-runner-compatibility:implemented(native_hooks.py#L53-L74、5 项test_official_stop_hook_supports_split_pinned_two_arg_transport单元测试及真实检出b4e1ded37d4ecf1d43b788cf9d870d3e1020d3ab两参数codex_stdio.py对照worker.run_once探针全部通过)。
对主干的风险 / Risks
主干默认行为零回归风险:Execution.official_stop_hook 默认 False,Harbor._worker_env 显式向下层写入 "LOOPX_OFFICIAL_STOP_HOOK": "0" 阻断宿主机遗留环境变量污染,plain 默认的 phase_work_reserve("plain") == 160 与原单 pass 启动参数保持完全一致;同基线 b4e1ded3 与本 HEAD 的隐式省略 / 显式 "0" 运行输出 SHA-256 指纹同为 d4ac265935129789(未创建 hooks.json、未写入 hooks = true、未启动 app-server)。
| 核验场景 / 检查项 | 结果 | 关键观测 |
|---|---|---|
分锁对抗探针(origin/main 2 参 codex_stdio + PR #8791 runtime) |
PASS | enabled=False 0.196s ok=True;enabled=True ok 0.180s official_stop_hook_verified=True;enabled=True hang 1.206s timed_out=True budget_exhausted=True host_invoked=False |
关闭态基线对齐对照(base 省略 vs head 省略 vs head "0") |
PASS | 三组输出指纹均完全一致 d4ac265935129789(reserve_plain=160、hooks_in_toml=false、app_server_ran=false) |
test_shared_codex_runtime.py + test_task_entry.py + test_sforge_runtime.py |
PASS | 186 passed, 130 skipped(127 项因本机未装 harbor 跳过,3 项需原生二进制并已通过上方定向原生测试运行全通);test_sforge_runtime.py 12 passed, 334 skipped |
原生 Codex CLI (LOOPX_NATIVE_CHECKPOINT_BIN 0.171.0-alpha.13, -k official_stop_hook) |
PASS | 3 passed, 200 deselected(验证关闭单 pass、开启同会话 Stop hook 续做、无总体超时下任务控制取消) |
更广控制面与 stdio transport 相关 22 个 pytest 套件 + ruff check + loopx check |
PASS | pytest 800 passed, 219 skipped;9 个 .py 文件 ruff 零警告;10/10 边界扫描通过 |
loopx canary premerge --from-git-diff --git-diff-base origin/main |
PASS (manual hold on benchmark_sensitive) |
direct_checks 4/4、python_compile 1/1、catalog_canaries 10/10(含 ratchet 与 vocab drift)、risk_profile_smokes 8/8 零失败;远端 CI 未查询(wait_for_ci: false) |
潜在剩余风险与未覆盖边界:第一,codex_stdio.py 等同时改动产品目录的文件在主干启用后会被同锁任务直接使用,若旧调用方传入非预期类型 deadline 将触发比较异常(但默认 None 完全向后兼容);第二,本地运行环境仅安装了 macOS 原生 codex-cli 0.171.0-alpha.13 且采用本地合成 Responses 桩,未运行付费远端模型评分、Linux Docker Harbor 完整容器或 Windows 进程行为;第三,待全部受支持的产品 pin 均包含三参数 request(..., deadline=...) 后,可在后续单独清理 PR 中移除 native_hooks.py#L58-L74 的 2 参兼容分支,当前阶段保留属必需边界。
我的整体评价 / Verdict
对 long_horizon 与 user_experience 均判断为 improved(visual_review: not_applicable):实验操作者终于拥有与原生单会话能力对齐且严格共享阶段时钟的 plain + official_stop_hook 基线,分锁版本运行不再在初始化阶段静默崩溃或超时误判为通用 RPC 错,单 pass 基线则保留零干扰兼容(fp=d4ac265935129789)。本 PR 复用既有 hooks.state / phase_work_reserve / budget_exhausted 等控制面词汇(reuse_existing),未引入新的控制面词汇或平行状态真相;代码增量规模与维护复杂度与交付价值匹配(necessary、proportionate、retain),8791@545a33da03a9688a0ac81dc2bb0fd9305f9ed786 结论为 APPROVE(作者自建 PR 使用 COMMENTED 结论发布,不构成合并授权或自动放行;远端 CI 未等待)。视觉核验范围说明:Not applicable on rendered product UI: inspected all 10 changed files (benchmark/runtime/.py, benchmark/runtime/RUNTIME.md, benchmark/tests/.py, loopx/control_plane/turn_driver/codex_stdio.py); all changes are benchmark runner internals, CLI worker flags, stdio transport, tests, and runtime documentation with zero web UI, layout, or visual styling changes. 未验证范围(unverified_scope):none。
当前精确边界:Opt-in plain-mode native Stop-hook baseline (codex.py, harbor.py, scheduler.py, worker.py, native_hooks.py), shared native hook discovery consolidation (context_delivery.py), optional monotonic deadline support in StdioNativeGoalTransport.request (codex_stdio.py), runtime contract doc update (RUNTIME.md), and unit plus real native Codex tests without modifying SForge or default plain runs.
架构评估依据:Separating configuration invariants (Execution in codex.py), shared native hook registration and transport negotiation (prepare_native_hooks in native_hooks.py), phase deadline bookkeeping and worker execution (run_once in worker.py and BenchmarkCodex in harbor.py), and optional transport RPC deadline enforcement (StdioNativeGoalTransport.request in codex_stdio.py) keeps one canonical hook-verification owner while deleting 52 duplicate lines from context_delivery.py and preserving clean split-pinned product compatibility.
English verdict: APPROVE at 545a33d. All local, native macOS CLI, premerge canary, and split-pinned two-arg StdioNativeGoalTransport counterfactual checks pass with full disabled-path parity; no blocking findings remain.
Goal And Delivered Outcome
The shared Codex runner supports an official-style single-session baseline with native Stop hooks. A caller selects
execution_mode: plainandofficial_stop_hook: true; the task controller owns feedback, final submission and cancellation.Finite trials share their original phase clock across hook discovery and execution. A direct worker can also run without an overall answering deadline: discovery retains bounded RPC waits, and the task controller ends the worker when its final submission is accepted or cancellation is requested. Planning accepts the same absent phase clock instead of requiring a temporary worker override. Harbor retains its declared scheduler budget.
Scope
The native host must discover the exact enabled handler and its trust identity before inference. Context delivery reuses that discovery owner. The opt-in remains plain-only and defaults off; an ordinary single-pass baseline is still available by omitting it. SForge owns its existing outer auto-resume behavior.
The phase tests observe the parent-owned child PID even when startup loses a deadline race. The independent communication-timeout case waits for its synthetic host to be ready; the original 0.4-second allowance is retained.
Validation
5fa66c65ddb114b40921adb5d50d8da3ab2d52ca, published headd42379e94bf1fa278511543f33f8c21d865e3385; tree readback matches the tested local source.These checks qualify the pinned worker path; Windows, other native CLI versions, and live-model outcome/cost benefits require their own evidence. Optional Harbor-package skips are not passes.
Frontend / Visual Evidence
UI impact is none. This is an opt-in benchmark-runner configuration.
Written by Codex, OpenAI. Existing review and merge gates apply; this PR does not claim benchmark score improvements.