Repository navigation
feat(benchmark): add opt-in stop-hook checklist baseline and control-tax telemetry - #9497
Conversation
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh
Request changes conclusion (author-owned PR; GitHub blocks formal self-review)
[P2] 缺失计时的阶段应保留未知。使用实际 BenchmarkCodex.run,隔离远端执行边界并启动确定性的合成工作。阶段准备耗时 1 秒,工作夹具有实际输出。缺少当前 receipt.json 或回执存在但无计时字段时,两种情况都被写成 work_wall_seconds=0、control_tax_ratio=1.0。完整回执对照得到 3 秒控制、6 秒工作、比值 0.333333,并正确排除上一阶段。 区分已观测的零执行、缺失回执和不含计时的旧回执。保留已观测的准备耗时,只有当前阶段的工作窗覆盖完整时才提供可比较的比值,并为缺失或旧回执显式标注未验证。 源码
动机 / Motivation
提供一个明确选用的 Stop-hook checklist 对照组,并在相同窗口比较控制开销与工作耗时。 基线采用普通 plain 或 prompt-less Stop hook,Harbor 阶段没有发布这组比值。 比较 plain、Stop-hook checklist 和 LoopX heartbeat 的 benchmark 运行者与结果分析者。
含旧回执、超时中断或远端日志缺件的阶段可进入成本比较并误报为 100% 控制开销。 匹配完整回执时,阶段按时长聚合。隔离自动化验证默认不启用 checklist,选用后在 workspace 外保存 checklist,真实 POSIX hook 对未勾选项继续阻拦。 独立 base/head 阶段探针覆盖完整、当前缺件及旧回执三种输入。四组仓库定向测试 48 通过、12 项环境或可选依赖跳过,git diff --check 与 merge-tree 通过。 阶段验证使用 Harbor transport 替身和合成工作,无付费模型调用、生产评测或托管 CI 结果。比值应仅用于实际计时覆盖明确的比较。 基线契约
改动思路 / Approach
该改动沿用 BenchmarkCodex.run → worker 阶段回执 → Harbor context.metadata。保留官方 Checklist opt-in 与同一 Worker 计时所有者,聚合只应使用当前阶段的经验证观测。 当前阶段准备耗时单独累加,聚合把缺失或无字段的工作回执隐式当零;具体阶段仍报告实数比值。 改现有聚合成功条件或返回类型,在发布比值前确认计时覆盖。保留已有计时与正式执行路径。
具体改动 / Changes
精确提交 9645562,本次对照目标 ddcfca5。6 个文件,+1,166/−35。803 行为新测试,生产变更聚焦 mode、native hook、Worker 与 Harbor 的计时。
关键代码讲解
-
BenchmarkCodex.run 阶段收尾。在准备耗时大于零时,即使当前阶段没有可用的工作计时也调用聚合。 源码 -
aggregate_control_telemetry。对已提供的数值求和,缺少字段时没有累加或未知标记。 源码 -
run_once 的回执计时。写入该 worker 实际计时窗口的组成数据。 源码 -
prepare_baseline_todo_checklist。明确选用 checklist 时在 trial home 持有检查文件。 源码 -
benchmark-missing-coverage-unknown(partial)。缺失的完整成本覆盖保留未知。阶段准备有数据时,缺失 worker 的时间仍无法推出实际工作为零。
对主干的风险 / Risks
使用实际 BenchmarkCodex.run,隔离远端执行边界并启动确定性的合成工作。阶段准备耗时 1 秒,工作夹具有实际输出。缺少当前 receipt.json 或回执存在但无计时字段时,两种情况都被写成 work_wall_seconds=0、control_tax_ratio=1.0。完整回执对照得到 3 秒控制、6 秒工作、比值 0.333333,并正确排除上一阶段。 一个真实启动后无计时的阶段会获得与真正零工作不同的证据却不可区分。 区分已观测的零执行、缺失回执和不含计时的旧回执。保留已观测的准备耗时,只有当前阶段的工作窗覆盖完整时才提供可比较的比值,并为缺失或旧回执显式标注未验证。
语义与 CI 对齐
使用实际 BenchmarkCodex.run,隔离远端执行边界并启动确定性的合成工作。阶段准备耗时 1 秒,工作夹具有实际输出。缺少当前 receipt.json 或回执存在但无计时字段时,两种情况都被写成 work_wall_seconds=0、control_tax_ratio=1.0。完整回执对照得到 3 秒控制、6 秒工作、比值 0.333333,并正确排除上一阶段。 区分已观测的零执行、缺失回执和不含计时的旧回执。保留已观测的准备耗时,只有当前阶段的工作窗覆盖完整时才提供可比较的比值,并为缺失或旧回执显式标注未验证。
我的整体评价 / Verdict
REQUEST_CHANGES。 保留完整成本的未知语义并重跑缺件和旧回执反例后再复审。 保留缺失观测的可见性,避免自动聚合把未测到的工作时间当成零并误导对照组选择。
English verdict: REQUEST_CHANGES at 9645562. Request changes. A phase that ran work but has a missing or untimed worker receipt is published with zero work time and 100% control tax.
9645562 to
9d4c17c
Compare
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gemini-3.1-pro · Google · self_reported · effort_unavailable
Approval conclusion (author-owned PR; GitHub blocks formal self-approval): APPROVE for 9497@9d4c17c0e715cadbd2b228d3c9660d4752fd0dc1 — verified [P2] finding PRRT_kwDOStEbEs68fRHU resolved cleanly across missing/untimed/observed-zero counterfactuals with 0 remaining blocking findings.
动机 / Motivation
在评估 LoopX 相对纯宿主反事实基线的“扣除控制面税率后”净收益(net-of-tax effectiveness)时,现有基准缺少两点基础能力:其一,plain + official_stop_hook=True 仅在 Stop 钩子输出固定单句提醒,没有对照侧可自行维护的非工作区任务清单;其二,worker 与 Harbor 阶段汇总缺少统一、无额外 RPC 的单调控制面计时与 control_tax_ratio 字段,且上一版评审指出缺失/无计时字段的 phase receipt 会被错误合成为 work_wall_seconds=0.0 与 control_tax_ratio=1.0(PRRT_kwDOStEbEs68fRHU)。
- 受影响调用方(Affected callers):启用 counterfactual Stop-hook 对照组的 Benchmark 调度器(
BenchmarkCodex、worker.py)、采集control_tax_ratio做净收益对比的heartbeat/context_delivery评测臂,以及沿用默认plain与原始official_stop_hook=True的现有基线消费者。 - 前后场景对比(Before/After):改动前,启用
official_stop_hook=True仅在Stop时返回固定 ``"Do not stop. Continue working on the implementation."提示、缺少与 LoopX Todo 等价的对照清单机制,且 wake receipt 与 Harbor phase metadata 不记录单调控制的准备与工作耗时分解。改动后,仅在显式 opt-inofficial_stop_hook_mode="todo_checklist"`(且严格锁定 `mode="plain"` 与 `official_stop_hook=True`)时,在 `LOOPX_CODEX_HOME/baseline-todo/TODO.md` 生成受沙箱写根白名单隔离的私有对照清单并在 `Stop` 时以 `LC_ALL=C awk` 验证完成度,同时在所有 worker wake receipt 与 Harbor 阶段汇总`hook_prepare_seconds`、`control_overhead_seconds`、`work_wall_seconds`、`control_tax_ratio`、`control_telemetry_verified` 与 `control_telemetry_status`;实测默认 `plain_off` 与 `stop_simple` 在无 checklist 产物、提示词长度(`16 B` vs `todo_checklist` `507 B`)和 `hooks.json` 哈希(`040c05565145828b`)上与基线等价。 - 可观测收益与边界(Observable outcome & non-goals):精确候选闭环交付了 opt-in
todo_checklist反事实对照组(工作区git status零污染、多字节 UTF-8/控制字符与符号链接安全校验)以及未知保全(verified/missing_receipt/untimed_receipt)单调耗时统计,并已验证修复先前的[P2]缺陷PRRT_kwDOStEbEs68fRHU。本 PR 不改动任何核心 LoopX 控制面决策、不引入额外 RPC 轮询、不更改plain/默认official_stop_hook=True的既有工作流与沙箱权限,也不修改远端 CI 与 Harbor 评分器契约。
改动思路 / Approach
plain + official_stop_hook=True + official_stop_hook_mode (None | "simple" | "todo_checklist")
│
├─ worker.py (Execution 校验 + 单调计时)
│ ├─ mode == "todo_checklist" ──► native_hooks.prepare_baseline_todo_checklist(CODEX_HOME) [0o700/0o600, 防符号链接]
│ │ └─ Stop: LC_ALL=C awk 校验 checklist,全 [x] 输出 {} 放行,否则 JSON block
│ │ └─ workspace-write: 仅授权 writable_roots=[baseline-todo/]
│ └─ 所有模式 finally: 汇总 hook_prepare / control_overhead / work_wall -> receipt.json
│
└─ harbor.py BenchmarkCodex.run()
├─ before_wakes = _wake_receipt_files()
├─ prep_elapsed 计入 extra_control_seconds
└─ new_wakes = diff ──► aggregate_control_telemetry()
├─ new_wakes=[] ──► "missing_receipt" (work=None, ratio=None, verified=False)
├─ 缺/非法计时 ──► "untimed_receipt" (work=None, ratio=None, verified=False)
└─ 完整有效计时 ──► "verified" (含 observed work=0.0 -> ratio=1.0)
图示说明(Illustrative, verified against 9d4c17c0e7):benchmark/runtime/codex.py:aggregate_control_telemetry 与 harbor.py:BenchmarkCodex.run 构成唯一阶段遥测结算通道,无条件覆盖 self._last_phase_telemetry 避免跨阶段污染。
- 职责分层与架构边界(
architecture_assessment):核心计数与汇总规则集中沉淀在benchmark/runtime/codex.py(OFFICIAL_STOP_HOOK_MODES、summarize_control_telemetry、aggregate_control_telemetry)与benchmark/runtime/native_hooks.py(prepare_baseline_todo_checklist、_todo_checklist_stop_hook_command),保持纯标准库闭环且完全满足NATIVE_GOAL_SOURCE_PATHS最小挂载边界;worker.py仅做环境变量校验、单调计时采样与受限沙箱 root 透传,harbor.py仅做阶段级 wake diff 与 metadata 写入,没有建立第二套状态机或重用 LoopX 生产控制面来污染非 LoopX 对照组。 - 当前 PR 边界(
current_pr_boundary):仅限benchmark/runtime/下的显式 opt-in Stop-hooktodo_checklist模式与单调控制面开销遥测,不改变loopx/control_plane/语义、不新增持久化注册表、也不扩展loopxCLI 对外参数面。 - 历史
[P2]缺陷核验(PRRT_kwDOStEbEs68fRHU):已在9d4c17c0e7验证完全关闭。codex.py:aggregate_control_telemetry通过_finite_nonneg()严格校验非负有限浮点数(拒绝bool、NaN、Inf、负数与字符串),并显式区分无当前阶段回执(missing_receipt)、缺省或非法字段(untimed_receipt)与完整观测到的零工作窗口(verified,work_wall_seconds=0.0,control_tax_ratio=1.0);同时harbor.py:BenchmarkCodex.run()的finally无条件将当轮self._last_phase_telemetry赋值为aggregate_control_telemetry(new_wakes, extra_control_seconds=prep_elapsed)后清零,彻底阻断empty new_wakes场景回退读取旧阶段 wake 的泄漏路径。
具体改动 / Changes
变更分类(Base 379b9ea3e9 -> Head 9d4c17c0e7,共 6 个文件,+1417/-35 行)
- 运行时与文档(5 files, +402/-35):
benchmark/runtime/codex.py(+93/-3):新增OFFICIAL_STOP_HOOK_MODES = ("simple", "todo_checklist")、_finite_nonneg、summarize_control_telemetry、aggregate_control_telemetry,以及Execution.official_stop_hook_mode的严格校验(仅限plain且official_stop_hook=True,拒收非字符串、布尔与未知模式)。benchmark/runtime/native_hooks.py(+138/-3):新增baseline_todo_path、prepare_baseline_todo_checklist(0o700私有目录、O_CREAT|O_EXCL0o600文件、符号链接与属主校验)、baseline_todo_instructions与_todo_checklist_stop_hook_command(LC_ALL=C awk、[�-��]控制字符清洗与 160–163 字节 UTF-8 续字节对齐截断),并在prepare_official_stop_hook(..., mode=...)按模式路由。benchmark/runtime/worker.py(+88/-7):透传LOOPX_OFFICIAL_STOP_HOOK_MODE、workspace-write下为baseline-todo/追加唯一writable_roots、追加baseline_todo_instructions,并以time.monotonic()包裹prepare_official_stop_hook/prepare_context_delivery与实际子进程/CheckpointWake/run_native_goal工作耗时后无条件在finally写入receipt.json。benchmark/runtime/harbor.py(+67/-5):透传official_stop_hook_mode至执行环境与安装/阶段 metadata;记录before_wakes、Phase prepare 耗时与new_wakes差集并通过aggregate_control_telemetry写入当前阶段context.metadata。benchmark/runtime/RUNTIME.md(+31/-2):补齐 opt-intodo_checklist契约与单调控制税率遥测字段语义说明。
- 测试套件(1 file,
+1015):benchmark/tests/test_stop_hook_baseline_telemetry.py:完整覆盖非法参数与环境隔离、默认关闭等价、git init工作区零污染、C/en_US.UTF-8双 locale 控制字符与 UTF-8 边界、空/缺失/符号链接 checklist、单调control_tax_ratio、aggregate_control_telemetry三态区分及真实/桩BenchmarkCodex.run五场景反事实隔离。
关键代码讲解
benchmark/runtime/codex.py:80-125(aggregate_control_telemetry)- 职责与边界:对单次/多轮 wake receipt 列表求算总准备时间、总控制面开销与总工作时长;仅当
record_list非空且每条记录均具备有效work_wall_seconds与control_overhead_seconds时输出"verified"与比值,否则保留已观测到的hook_prepare_seconds/control_overhead_seconds并显式返回None与对应未验证状态(避免平均每个 wake 的比值造成加权偏差)。
- 职责与边界:对单次/多轮 wake receipt 列表求算总准备时间、总控制面开销与总工作时长;仅当
benchmark/runtime/native_hooks.py:79-139(_todo_checklist_stop_hook_command)- 职责与安全边界:执行前检查 checklist 是否缺失或为符号链接;随后使用
LC_ALL=C awk(兼容 macOS BSDawk与容器 GNUawk)清洗 C0 控制字符,当遇到多字节 UTF-8 跨越第 160 字节时最多向前放宽 3 字节延续位([�-¿])以防半个字符破坏 JSON UTF-8 合法性。当仅存在已勾选- [x]/- [X]且零未勾选项时输出{}允许退出,其余场景输出结构化block提示。
- 职责与安全边界:执行前检查 checklist 是否缺失或为符号链接;随后使用
benchmark/runtime/harbor.py:900-1002(BenchmarkCodex.run&_populate_context)- 职责与不变量:无论主任务规划是否提前
blocked返回或发生超限异常,finally均只用before_wakes之后新增的 wake receipts 与prep_elapsed更新_last_phase_telemetry并立即清空,避免populate_context落入全量扫描而混入上一阶段(如prior-phase-wake)的耗时。
- 职责与不变量:无论主任务规划是否提前
benchmark/runtime/worker.py:520-538, 956-965(native_command&run_once)- 职责与资源隔离:仅在
official_stop_hook_mode == "todo_checklist"且sandbox == "workspace-write"时追加baseline-todo/目录至sandbox_workspace_write.writable_roots,避免放开整个LOOPX_CODEX_HOME(保护config.toml、hooks.json与sessions/);所有try内早退或超时异常都仍经finally记录精确控制耗时与work_wall_seconds=0.0。
- 职责与资源隔离:仅在
规范对齐(benchmark/runtime/RUNTIME.md @ 379b9ea3e9dab2b5671129bdd0c52b3e47479ed0)
- C-COUNTERFACTUAL-OPTOUT(未传
official_stop_hook_mode时默认plain与原始official_stop_hook=True提示词、hooks 宣言与沙箱策略保持完全一致):implemented—codex.py:156-171、native_hooks.py:142-161、worker.py:521-528,780-783;由test_default_off_parity_keeps_plain_and_simple_stop_hook_unchanged与双臂探针验证。 - C-ISOLATED-CHECKLIST(
todo_checklist仅落盘在私有LOOPX_CODEX_HOME/baseline-todo/TODO.md,绝不写入工作区仓库):implemented—native_hooks.py:38-64,79-139;由test_todo_checklist_isolates_from_git_workspace_and_evaluates_stop_hook与独立 4-byte emoji/CRLF 探针验证。 - C-MONOTONIC-TAX-TRUTH(无额外 RPC 的单调耗时采样、分母求和而非比率平均、未知或未计时回执不得伪造
0.0/1.0):implemented—codex.py:60-125、worker.py:956-965、harbor.py:995-1002;由test_worker_control_tax_telemetry_accounts_stop_hook_and_heartbeat_arms与BenchmarkCodex.run五场景反事实测试验证。
对主干的风险 / Risks
- 无阻塞缺陷(
0blocking findings)。 - 反例与边缘核验:
- 在
C与en_US.UTF-8两种 locale 下独立构造 4 字节 UTF-8 emoji(🚀)准确跨过第 160 字节(padding156..160)以及CRLF 与- [x]/* [X]混合条目的测试,确认_todo_checklist_stop_hook_command始终输出合法 UTF-8 JSON(未出现截断异常或 BSD awk 报错)。 - 独立检查
aggregate_control_telemetry对布尔值(True)、NaN、Inf、负数及缺省键的拒绝逻辑(均严格归入untimed_receipt、work_wall_seconds=None、control_tax_ratio=None、control_telemetry_verified=False),以及加权求和不被单轮高税率拉偏。 - 验证了早期预算耗尽(
LOOPX_PHASE_DEADLINE_EPOCH=1.0)时worker.pyfinally正确写入work_wall_seconds=0.0、control_tax_ratio=1.0。
- 在
- 默认关闭与基线对比(
default_off_isolation&observable_semantics):在基准提交379b9ea3e9与候选9d4c17c0e7上运行独立plain_off与stop_simple_default(未配置official_stop_hook_mode)对比:两边在plain_off与stop_simple下的输入 prompt 均保持"Synthetic task.\n"(16 B),baseline-todo均未创建,生成的hooks.jsonSHA-256(040c05565145828b)完全一致,且official_stop_hook_mode字段在未 opt-in 时不出现;仅当显式todo_checklist时 prompt 追加TODO.md指导(507 B)并记录official_stop_hook_mode="todo_checklist"。 - 残余风险与未测边界(
residual_risk):本机环境未安装可选外部包harbor与sforge(相关真实包测试按标记skipped;test_harbor_adapter_executes_mode_isolation_and_telemetry_with_stub_if_uninstalled通过桩模块完整实测了BenchmarkCodex构造、populate_context空 wake 兼容与全部 5 类BenchmarkCodex.run场景);真实 Docker 容器与在线模型评测、以及依 Goal 策略wait_for_ci: false不等待的远端 GitHub Actions CI 未在本机运行。另外benchmark/runtime/本身在全文件mypy下存在 74 条既有历史注解告警(harbor缺失桩与既有未标注函数),本次 PR 新增函数路径未引入新的类型错误;独立审核 worktree 运行canary premerge显示本机无审核侧 CQR(PR 作者侧已提交cqr_976eb9a844f3ab3fc1e0且benchmark_sensitive表面需维护者显式合入授权)。
验证矩阵(Local Verification on 9d4c17c0e7)
| 检查项 | 状态 | 结果与说明 |
|---|---|---|
目标新增与回归测试 (test_stop_hook_baseline_telemetry.py) |
PASS | 17 passed, 6 skipped in 4.64s(6 skipped 需外部 harbor;stub 覆盖全 5 类 BenchmarkCodex.run 场景) |
| 基准顺序 6 套件(telemetry, phase_budget, harbor_usage, native_child, causal x2) | PASS | 62 passed, 16 skipped in 47.72s(0 failed) |
基准并发 5 套件(pytest -n 4: shared_codex, task_entry, sforge, checkpoint_handoff, recovery) |
PASS | 240 passed, 426 skipped in 222.03s(0 failed;skips 为可选原生/外部包用例) |
维护率套件 + Smokes (test_maintainability_ratchet.py, vocab-drift, ratchet-smoke) |
PASS | ratchet pytest 14 passed (8.94s);ratchet-smoke 0 (unreviewed=0, stale=0);vocab-drift 0 |
ruff / npm run typecheck:control-plane / RFC 双语 / loopx check / git diff --check |
PASS | ruff 0(5 .py);TS typecheck 0;RFC 0;loopx check 6 文件 0 errors / 0 warnings;diff --check 0 |
| 独立反事实探针(UTF-8 4-byte emoji/CRLF + 379b9ea vs 9d4c17c 3-arm parity) | PASS | COUNTERFACTUAL_PROBE_OK + 3 臂等价与 opt-in 分流验证通过 |
Goal canary premerge --tier standard --from-git-diff --git-diff-base 379b9ea3e9dab2b5671129bdd0c52b3e47479ed0 |
PASS (checks) |
5/5 direct + 9/9 catalog passed (failures=0, failed_commands=[]);manual_hold=1(benchmark_sensitive)及审核工作树未自签 CQR |
| 远端 GitHub Actions CI | UNVERIFIED (not_consulted) | 依 Goal 策略 wait_for_ci: false 不轮询或等待远端 CI |
我的整体评价 / Verdict
Verdict: APPROVE (9497@9d4c17c0e715cadbd2b228d3c9660d4752fd0dc1, author-owned COMMENTED conclusion)
- 长程收益(
long_horizon:improved):为多轮基准对照补齐了不污染待测工作区仓库的todo_checklist强对照臂,并用单一、可区分verified/missing_receipt/untimed_receipt的单调计时遥测(无额外 RPC 开销)支撑净收益归因。 - 用户体验(
user_experience:preserved;visual_review:not_applicable):改动仅涉及基准运行时配置与内部 receipt/metadata(unverified_scope:none;检查路径benchmark/runtime/codex.py,benchmark/runtime/harbor.py,benchmark/runtime/native_hooks.py,benchmark/runtime/worker.py),默认关闭场景零行为漂移。 - 语义词表、体量与默认隔离综合裁定:严格沿用既有
Execution、Execution.sandbox、wake receipt 与 Harbormetadata契约,无未审核维护率或词表漂移(semantic_alignment:aligned/reuse_existing;code_volume:necessary,compatibility_assessment:retain;change_proportionality:proportionate;authority_semantics:aligned;default_off_isolation:isolated)。
English verdict: APPROVE at 9d4c17c. The opt-in todo_checklist Stop-hook baseline keeps workspace repos clean and handles UTF-8/control boundaries under C locale awk, while aggregate_control_telemetry resolves PRRT_kwDOStEbEs68fRHU by distinguishing verified (including observed zero) runs from missing or untimed receipts without cross-phase wake leakage.
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh
Request changes conclusion (author-owned PR; GitHub blocks formal self-review)
[P2] 阶段中部分回执缺失时仍报告成本已验证。 一个阶段已启动多个 wake,其中至少一个回执完整,另一个回执缺失或无法解析。 完整时工作 14 秒、控制成本比例 0.30。旧格式仍正确报告未知。在 plain + checklist 和 heartbeat 两臂,第二个新回执缺失或截断时都只累加第一个,并把工作 9 秒、比例 0.10 标为 verified。 用当前阶段已启动的 wake 身份作为覆盖分母。缺失或坏回执保留缺测标记,汇总只展示已观测的控制成本,工作时间和比例保持 null。继续排除前一阶段。
动机 / Motivation
依赖 control_telemetry_verified 比较 Stop-hook 和 LoopX 净成本的 benchmark 使用者。 Harbor 0.20.0 走实际 BenchmarkCodex.run。每阶段有两个新 wake 和一个已存在的旧 wake。让第二个新 wake 的回执完整、旧格式、缺失或截断。使用确定性本地传输。 完整时工作 14 秒、控制成本比例 0.30。旧格式仍正确报告未知。在 plain + checklist 和 heartbeat 两臂,第二个新回执缺失或截断时都只累加第一个,并把工作 9 秒、比例 0.10 标为 verified。 使用本地确定性任务传输。正式模型对照、验证器得分、费用和完整实验采用未运行。 可选对照基线和真实成本需要区别运行零工作与真正缺测。阶段可包含多个 wake,残存一份正常观测无法证明完整。 Stop-hook 对照和 LoopX 共享同一成本定义。当前阶段有应计回执不可用时,真实工作时间和比例保持未知。 对照契约 对照修订 ff55255012b7b192ed7fb92d64b91ae40ecce801。
- B1 对照基线要显式启用,并保留关闭时已有提示约束。 通过。
- B2 完整计时与可观测零工作可提供有效比率。 通过。
- B3 阶段任何回执缺失或未计时都必须保留未知。 当前反例成立。
改动思路 / Approach
Worker 生成每次 wake 计时,Harbor 拥有当前阶段成员及文件读取。现有汇总 helper 保留未知,由 Harbor 传递真实覆盖。 原汇总 helper 已能保留不完整输入的未知值。补齐阶段覆盖即可,继续复用同一 owner 和已有状态。 主干的比较契约要求保留未知成本。该变更新增验证字段,之前没有对阶段报告完整性作出该认证。 本轮查验普通与 checklist 模式后,增加了混合完整和缺测的实际 Harbor 反例。 按仓库经验,在局部规则与包装变更之间检查首次使用及失败读回,从同一真实入口取证。
具体改动 / Changes
精确提交 9d4c17c0e715cadbd2b228d3c9660d4752fd0dc1,6 个文件 +1417/−35。6 个文件的增加主要是验证套件。生产变化集中于可选配置、实际 Stop-hook 与阶段归集。修复宜落在已有阶段读取。
_read_wake_receipts。只读取成功解析的 receipt,缺失或坏记录不进入当前集合。 代码BenchmarkCodex.run。从目录扫描得出的剩余记录直接参与阶段汇总。 代码aggregate_control_telemetry。对实际传入的每个元素检查完整计时。上游过滤缺测后,剩余完整记录会返回 verified。 代码run_once。先建立每个 wake 的实体目录,回执在执行尾部写出。 代码
62 项普通隔离测试通过,16 项跳过。安装实际 Harbor 0.20.0 后执行相关套件,63 项通过、1 项只适用无 Harbor 的夹具跳过。另 8 组实际适配器观察得到反例。 定向回归测试
对主干的风险 / Risks
旧格式 JSON 作为一个可见元素正确保留未知。同一个 wake 缺文件或 JSON 截断会被跳过,已有完整记录使阶段错误获得 verified。 标准本地预检 9 项执行检查均通过。Benchmark 敏感变更仍有独立的合入资格人工项。 针对 PR 基线的只读 merge-tree 和签署检查通过。首次本地预检因缺少根目录 TypeScript 开发依赖中断,完成 npm ci 后以同一提交复跑。未跑真实模型或对外基准。远端 CI 未查询。
语义与 CI 对齐
在真实 Harbor 适配器的 plain + checklist 和 heartbeat 重放两个新 wake,分别缺失和截断第二份回执。覆盖两份完整与旧格式对照。 同一入口的变体先验证作用域,再从原捕获校验关键事实。
我的整体评价 / Verdict
REQUEST_CHANGES。 用当前阶段已启动的 wake 身份作为覆盖分母。缺失或坏回执保留缺测标记,汇总只展示已观测的控制成本,工作时间和比例保持 null。继续排除前一阶段。 保留对照臂开关。修复 phase 对缺测 wake 的可观测覆盖后重跑本地对照,再进入正式实验资格。 保留已有 worker 日志、原始 benchmark 结果和 output format,可沿用 missing_receipt/untimed_receipt。 基准敏感表面仍有独立合入人工项。当前要求修改由已验证的统计语义反例触发。
English verdict: REQUEST_CHANGES at 9d4c17c. In an actual Harbor 0.20.0 adapter run with two current wakes, one valid receipt plus one missing or truncated receipt is reported as verified (9 seconds, tax ratio 0.10) in both checklist and heartbeat modes. Retain known missing wake membership so phase work and ratio stay unknown.
…tax telemetry Adds an opt-in, default-off todo_checklist Stop-hook counterfactual mode alongside verified monotonic control-plane overhead and tax telemetry across both Stop-hook and LoopX worker wakes. Distinguishes verified timed telemetry (including observed zero execution) from missing_receipt and untimed_receipt phases without fabricating 0.0/1.0 ratios, and runs the POSIX stop-hook checklist check under LC_ALL=C awk with C0-control scrubbing and UTF-8 boundary protection. Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
9d4c17c to
143e95a
Compare
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)
动机 / Motivation
提供独立的 Stop hook 清单对照,按阶段记录控制面开销和工作时间,使成本比较能区分实际零工作与证据缺失。 上一评审头按可读回执聚合,混合缺件被误标 verified。当前按阶段开始前后的 wake 目录识别预期覆盖。 配置 plain Stop hook 或 LoopX heartbeat 对照、使用 Harbor 回执比较成本的研究人员。
部分阶段从成本分母消失会偏离完整成本比较,直接影响研究判断。 原阶段的一份完整加一份缺失或损坏回执,在当前 head 均得到 missing_receipt,工作时间与比例保持 null。完整计时保留 phase 合计和原始除法;已测零工作、旧回执与缺失的区分仍通过。 真实 Harbor 0.20.0 的两个套件 75 通过、1 跳过(仅用于无 Harbor 环境的替代用例);额外非挂载回传矩阵 12/12。无 Harbor 时,两项原负例复验通过。普通运行时套件 143 通过,93 个环境或依赖相关用例跳过。 本轮覆盖实际本机 Stop hook、Harbor 0.20.0 及生产阶段聚合。外部模型和远端环境执行由隔离夹具替代,未测真实模型、远端回传服务或跨任务净收益。托管 CI 未查询。 验收契约
改动思路 / Approach
该改动沿用 BenchmarkCodex.run 启动 worker/scheduler → wake 回执 → Harbor phase context.metadata,另有本地生成 Stop 命令。清单保存在 trial home,主机 Stop 命令复用 native hook 注册和信任。汇总只读回执,并增加 typed 缺件状态。 同一阶段的已启动 wake 与可用回执分别跟踪。即使仍有有效统计,缺件会显式从聚合输入阻断 verified。缺件与旧回执使用已存在的状态语义。 复用现有 worker wake 目录、汇总函数及状态值。当前修复增加缺件计数,不额外启动 RPC 或探测。
具体改动 / Changes
精确提交 143e95a,本次对照目标 6915df6。6 文件 +1667/−35。相较上一评审头,生产增量集中于 Harbor wake 覆盖计数、汇总对部分缺件的降级与同一操作说明。其他差异是双模式及坏件测试。
关键代码讲解
-
BenchmarkCodex._wake_dirs。阶段开始前记录既有 wake,后续读取排除它们。 源码 -
BenchmarkCodex._read_wake_receipts。把目录存在、回执不可用分开计数,再交给汇总。 源码 -
aggregate_control_telemetry。只有完整的阶段计时覆盖才发布工作时间和成本比例。 源码 -
BenchmarkCodex.run。下载日志后生成阶段汇总。 源码 -
prepare_official_stop_hook。仅在显式 opt-in 的清单基线生成新 Stop 行为。 源码 -
complete-current-phase-control-tax(implemented)。研究成本按实际可比窗口计量。阶段回执覆盖不全时保留未知比值,完整覆盖才验收成本。
对主干的风险 / Risks
在 Harbor 0.20.0 的真实 adapter 实现上隔离外部执行及下载,模拟非挂载环境的日志回传。plain + checklist 和 heartbeat 都排除前一阶段回执;缺失、损坏、非字典和符号链接回执都保持未知,untimed 单独处理,完整计时才 verified。干净 base/head 的旧 plain 与 simple prompt、Stop 结果逐项一致。 对照组与 LoopX 若具有不同中止或日志缺失概率,遗漏会使二者的总成本不可直接比较。 保持对当前阶段目录与正式回执分别计数,完整缺口优先传播。
我的整体评价 / Verdict
APPROVE。 本次关闭混合回执覆盖的阻断发现。显式清单模式和已观察控制成本可用于后续独立资格验证。 只发布覆盖完整的占比,才能用对照研究比较改进的完整成本。
English verdict: APPROVE at 143e95a. The exact head fixes partial wake coverage in both modes. Real Harbor 0.20.0 adapter tests and a separate non-mounted download fixture pass; default plain and simple behavior matches the base. No live model or cost claim is made.
Goal and delivered behavior
To measure LoopX's net-of-tax effectiveness honestly against a strong non-LoopX counterfactual baseline, this PR adds an opt-in, default-off
todo_checklistStop-hook mode alongside verified monotonic control-plane overhead and tax telemetry across both Stop-hook and LoopX arms:benchmark/runtime/codex.py,benchmark/runtime/native_hooks.py,benchmark/runtime/worker.py,benchmark/runtime/harbor.py,benchmark/runtime/RUNTIME.md):official_stop_hook_mode: "simple" | "todo_checklist"(defaultNone, strictly requiringmode="plain"andofficial_stop_hook=True; rejects invalid modes, mismatched pairings, and ambientLOOPX_OFFICIAL_STOP_HOOK_MODEoverrides before host setup).baseline-todo/TODO.md(0o700dir,0o600file, symlink checks) insideLOOPX_CODEX_HOMErather than inside the workspace repository so workspacegit diff/git statusremain completely unpolluted, and limitsworkspace-writesandbox grants strictly tobaseline-todo/when enabled.hooks.jsontrust hashes, appends deterministic checklist and regression-verification guidance to the initialplainprompt, and evaluatesTODO.mdon nativeStopunderLC_ALL=C awk(scrubbing C0 control chars\001-\037\177and extending preview truncation up to byte 163 across UTF-8 continuation bytes so non-ASCII items never slice mid-codepoint or fail BSDawklocale checks).official_stop_hook_modeleavesplainand existingofficial_stop_hook=Trueprompts,hooks.json,config.toml,loopx-install.json, and empty-wake Harbor metadata unchanged.benchmark/runtime/codex.py,benchmark/runtime/worker.py,benchmark/runtime/harbor.py,benchmark/runtime/RUNTIME.md):summarize_control_telemetry/aggregate_control_telemetry) measuring local monotonic timings with zero extra RPCs:hook_prepare_seconds,control_overhead_seconds,work_wall_seconds,control_tax_ratio,control_telemetry_verified, andcontrol_telemetry_status("verified","missing_receipt","untimed_receipt").BenchmarkCodex._wake_dirs()excluded against pre-phase wakes inrun(), and returned alongside missing/corrupt wake counts byBenchmarkCodex._read_wake_receipts()->aggregate_control_telemetry(..., missing_receipts=...)) rather than scanning only readablewakes/*/receipt.jsonfiles. When a multi-wake phase (inplain + todo_checklistorheartbeat) starts a wake whosereceipt.jsonis missing, a symlink, unreadable, truncated/corrupt JSON, or a non-mapping JSON value, observed validhook_prepare_secondsandcontrol_overhead_secondsare preserved whilework_wall_seconds=None,control_tax_ratio=None,control_telemetry_verified=False, andcontrol_telemetry_status="missing_receipt".work_wall_seconds == 0.0with complete timing receipts ->control_telemetry_verified=True,control_telemetry_status="verified",control_tax_ratio=1.0) from missing/corrupt receipts ("missing_receipt") and untimed/legacy wake dicts ("untimed_receipt").self._last_phase_telemetryper phase inBenchmarkCodex.run()(even whennew_wakes == [] and prep_elapsed == 0.0) so prior-phase wakes never leak into subsequent phases, while keepingpopulate_context_post_runempty-wake metadata parity intact.benchmark/tests/test_stop_hook_baseline_telemetry.py):git initworkspace isolation + multi-locale (C,en_US.UTF-8)LC_ALL=C awkStophook execution across C0-control/UTF-8 boundaries/open/empty/missing/symlink/all-checked states, deterministic monotoniccontrol_tax_ratioaccounting (todo_checklist, LoopX SQLite heartbeatcontext_delivery="on", early budget exhaustion1.0), partial-missingaggregate_control_telemetry,observed_zerovsuntimed_receiptvsmissing_receiptdifferentiation, andBenchmarkCodex.run+populate_context_post_runmulti-wake phase coverage acrossplain + todo_checklistandheartbeat(missing,corrupt_json,non_dict_json,symlink_receipt,untimed,complete, excluding prior-phase wakes) in both real-harbor(when installed) and uninstalled-harborstub paths.Verification (at exact head
143e95a2543fe92950115dd75d8d2ea7d91492d6, rebased ontoorigin/main6915df67db6a8836df344a661f295006873a3ba8)pytest(benchmark/tests/test_stop_hook_baseline_telemetry.py):17 passed, 18 skipped in 3.56s(the 18 skips require the optionalharborpackage;test_harbor_adapter_executes_mode_isolation_and_telemetry_with_stub_if_uninstalledexecuted all 5 single-wake counterfactuals plus all 12 multi-wakeplain+heartbeatpartial-coverage cases live via stub).pytest(benchmark/tests/test_stop_hook_baseline_telemetry.py,benchmark/tests/test_worker_phase_budget.py,benchmark/tests/test_harbor_usage_completeness.py,benchmark/tests/test_native_child_parity.py,benchmark/tests/test_causal_attribution.py,benchmark/tests/test_five_arm_causal_attribution.py):62 passed, 28 skipped in 50.77s(0failures; optionalharborskips).pytest -n 4(benchmark/tests/test_shared_codex_runtime.py,benchmark/tests/test_task_entry.py,benchmark/tests/test_sforge_runtime.py,benchmark/tests/test_native_checkpoint_handoff.py,benchmark/tests/test_interruption_recovery.py):240 passed, 426 skipped in 237.83s(0failures; native binary / optionalharborskips).ruff check(0issues on all 5 Python files),git diff --check,git merge-tree origin/main HEAD,scripts/check_rfc_bilingual.py,npm run typecheck:control-plane(0errors),examples/semantic-vocabulary-drift-smoke.py,examples/control_plane/control-plane-maintainability-ratchet-smoke.py(0unreviewed), andloopx check(6files,0errors,0warnings) passed.cqr_d7e40a14e3164b742c63(decision: "pass",receipt_valid: true, scoped7e40a14e3164b742c634b1f72c174b757cd567fdc31e898a8e68664ffffeb66).canary premerge --tier standard:4/4direct checks +1/1py_compile+9/9catalog canaries passed (0failures;gate.status="manual_review_required"solely due tobenchmark_sensitivemanual hold — PR leftOPENfor review).