Skip to content

feat(benchmark): wire default-off H1/H2 Pareto opt-ins across Harbor/SForge/EdgeBench - #9221

Closed
loopx-agent wants to merge 37 commits into
codex/stage-then-swap-hook-direct-read-20261122from
codex/wire-benchmark-h1-h2-opt-in-20261122
Closed

loopx-agent wants to merge 37 commits into
codex/stage-then-swap-hook-direct-read-20261122from
codex/wire-benchmark-h1-h2-opt-in-20261122

Conversation

@loopx-agent

Copy link
Copy Markdown
Collaborator

Summary

Stacked cleanly on #9220 (codex/stage-then-swap-hook-direct-read-20261122, head 7d608ae5422c1fad3e74f871241168037c37d662). Wires strictly default-off opt-in activation across benchmark (BenchmarkCodex, SForgeWorker, worker.run_once, context_delivery, edgebench/run.py) and CLI context-hook surfaces (quota context-config, quota context-hook, codex_context_configuration), leaving H0 baselines byte-identical when omitted.

Changes

  1. CLI & codex_context_configuration (heartbeat hooks.json parity with turn_command):
    • loopx/cli_commands/quota_registration.py, loopx/cli_commands/quota_native_context.py: accept and forward --quiet-turn and --epoch-prefetch-json alongside --compact-direct-read; fail closed on non-context-config/context-hook routes or invalid JSON payloads.
    • loopx/control_plane/turn_driver/codex_context.py: extend codex_context_configuration(..., quiet_turn=False, epoch_prefetch=None) to append --quiet-turn and compact sorted --epoch-prefetch-json into the generated hooks.json quota context-hook command only when enabled (zero diff when disabled).
  2. Execution, context_delivery, and worker runtime (benchmark/runtime/):
    • benchmark/runtime/codex.py: add strictly default-off compact_direct_read=False, quiet_turn=False, epoch_prefetch_json=None, normalize_epoch_prefetch_json, and explicit_context_opt_ins(execution) with fail-closed validation (never touches codex_settings / restore-config.toml).
    • benchmark/runtime/context_delivery.py: add ContextOptInConfigurationError and inspect.signature(codex_context_configuration)-guarded opt-in forwarding; when default-off, emits zero opt-in kwargs so origin/main 2-arg call compatibility is preserved.
    • benchmark/runtime/worker.py: forward --quiet-turn / --epoch-prefetch-json in turn_command, pass explicit_context_opt_ins into prepare_context_delivery, record compact_direct_read / quiet_turn / epoch_prefetch receipt fields only when enabled, and fail closed when explicit H1 opt-ins cannot be honored.
  3. Harbor, SForge, and EdgeBench CLI opt-ins (benchmark/runtime/harbor.py, benchmark/runtime/sforge.py, benchmark/edgebench/run.py):
    • Add compact_direct_read=False, quiet_turn=False, epoch_prefetch_json=None, and execution_yardstick_enabled=None on BenchmarkCodex, SForgeWorker, and edgebench/run.py CLI flags.
    • Wire --execution-yardstick-enabled on cold _prepare_phase (configure-goal / existing registry update) and SForgeWorker warm_start restore before _write_task_document / _verify_phase_configuration, keeping H0 omitted runs identical.

Verification

Ran from isolated worktree at 68f57000df1d72f09b7367a44841f1748b5e03f6:

  • ruff check across all 11 changed files: passed (All checks passed!)
  • mypy on quota_registration.py, quota_native_context.py, codex_context.py, codex.py, context_delivery.py: passed (Success: no issues found in 5 source files)
  • pytest -n 4 -q across tests/control_plane/test_codex_hook_direct_read.py, tests/control_plane/test_stage_then_swap_quiet_turn.py, tests/control_plane/test_codex_context_lifecycle.py, benchmark/tests/test_shared_codex_runtime.py, benchmark/tests/test_task_entry.py, benchmark/tests/test_sforge_runtime.py: 396 passed, 461 skipped
  • .venv/bin/python -m loopx.entrypoint canary premerge --from-git-diff --git-diff-base codex/stage-then-swap-hook-direct-read-20261122: direct_checks 4/4, python_compile 1/1, catalog_canaries 10/10, risk_profile_smokes 8/8 (failures=0, manual_review_required)
  • loopx check --scan-path ... across all 11 changed files: verify clean public boundary prior to PR creation.

Ready for exact-head review; left OPEN per workflow rules.

Jiaqiiii523 and others added 3 commits November 21, 2026 23:31
Four capabilities now borrow PATH_SEGMENT_UNSAFE_RE from loopx.paths; each keeps its own fallback, truncation and digest policy.

Signed-off-by: Jiaqiiii523 <293262669+Jiaqiiii523@users.noreply.github.com>
Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com>
Co-authored-by: TRAE CLI <traecli@bytedance.com>
… surfaces

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

@loopx-agent loopx-agent 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.

Reviewer: model_agent · gpt-6.2-sol · OpenAI (runtime_reported, xhigh)

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

评审固定提交 68f57000df1d72f09b7367a44841f1748b5e03f6,PR 对比基线 7d608ae5422c1fad3e74f871241168037c37d662。与核对时 main b4e1ded37d4ecf1d43b788cf9d870d3e1020d3ab 三方整合无冲突。

[P2 · Blocking] 同时启用 compact direct read 和 Epoch Prefetch 会静默丢弃后者

真实 CLI 中,单开 Epoch Prefetch 返回 executed=true 和 7,884 bytes_saved;并开时命令仍成功,只返回 compactDirectRead,retired_shell_commands 为空。生成的 hook 命令保留全部选项,worker 在观察 hook 之前即按配置非空将 epoch_prefetch 记为 true。这样,匹配实验可以把该恢复计入已选策略,却无法从两条可见回执识别这次未运行的 Epoch Prefetch。 在共享入口明确两种策略的组合语义。若不支持组合,拒绝该组合;若 direct read 取代 Epoch Prefetch,保留显式的替代回执,区分 configured、executed 和 superseded,并从生成的 hook 跑一次组合恢复回归。 候选位置

[P2 · Blocking] 普通 Harbor H2 只核对配置布尔值

普通 Harbor cold bootstrap 写入 yardstick_enabled=true,回读只核对该字段,没有要求当前 Goal 的 Explore 图可用。独立用相同配置参数建临时 Goal,execution_profile 返回 true,explore turn-context 无 Yardstick capture;同一 Goal 单独打开 Explore 图后,capture 立即出现。普通 Harbor 入口可以在缺少该前置条件时接受并标记 H2。 通过既有 Explore activation owner 验证 effective graph,拒绝没有前置条件的 H2,或把 Explore 图明确纳入该实验臂。让 cold 与 warm 读回检验实际 Yardstick 路径。 候选位置

动机 / Motivation

让 Harbor、SForge 与 EdgeBench 的 H1/H2 通过明确选项启用,并让操作者按实际策略核对匹配实验。 声明基线已有 compact direct read 和底层 Epoch Prefetch resolver。省略开关时,原生 compact 恢复仍提供原捕获的读回路径。 候选接通三项 H1 开关并在 worker 及 Harbor 生成配置回执,H2 通过现有 configure-goal 写入 execution_profile。

在同一隔离 Git checkout 和同一私有捕获上发送 SessionStart(compact)。分别运行默认、direct read、Epoch Prefetch,以及两项或三项并开。 本轮复现为真实 LoopX CLI、隔离捕获与临时 Goal。worker 回执及普通 Harbor 的参数由源码与现有夹具核对。没有开启模型、运行真实 Harbor/SForge/EdgeBench trial、验证匹配成果、全成本或正式部署。 现有交付规则

改动思路 / Approach

省略新选项保留 H0。显式请求的策略需要经过同一实际 hook 并留下本轮发生过什么的证据。 compact hook 使用现有捕获和处理器。实验配置与实际执行仍应由各自的回执明确,避免无证据扩大读取或执行。 保留 compact direct read 既有优先级仍可成立,但要记录明确替代。该分支只识别顶层 prefetch_command,而新的 CLI 选项注入 epoch_prefetch.prefetch_command。

具体改动 / Changes

完整 diff 共 11 个文件,新增 694 行、删除 27 行。CLI 接通构建和注入,三个 benchmark 入口转交配置,worker 和 Harbor 生成策略记录,Goal 仍由现有配置入口持有。

  • omitted_hook_parity。默认恢复保持原捕获的读回

  • epoch_only_hook。单独启用通过现有 Epoch Prefetch resolver 读回

  • combined_h1_identity。组合启用时验证已应用的策略或明确记录替代

  • yardstick_effective_gate。H2 回读验证实际可达的 Yardstick 路径

  • _inject_context_hook_opt_ins。把 Epoch Prefetch 策略装入原生事件的嵌套字段。 精确代码

  • codex_context_hook。有 direct read 回复时先返回,后续 Epoch Prefetch resolver 无法处理同次事件。 精确代码

  • resolve_compact_hook_direct_read。从事件顶层读取要替代的 prefetch 命令。 精确代码

  • run_once。依据配置对象非空记录 Epoch Prefetch 选项。 精确代码

  • _verify_phase_configuration。沿现有 Goal 配置读回核对 Yardstick 布尔值。 精确代码

  • projectExploreTurnContext。只有启用 Explore 图才提供实际 Yardstick capture 投影。 精确代码

对主干的风险 / Risks

默认恢复和仅开启 direct read 在声明基线、候选和与当前 main 的整合树上相同。单独开启 Epoch Prefetch 可执行;显式 enabled=false 无执行回执。

同一 fixture 下,声明基线保留默认与 direct read 恢复;其 context-config 以未识别参数拒绝新 CLI 组合。候选和整合树接受同一命令并复现本项缺口。 若将配置回执用于筛选 H1 样本,必须同时能确定同一恢复实际执行了哪条策略。

语义与 CI 对齐

核对 11 个文件的完整目标差异、DCO、git diff --check 及当前 main 整合。独立定向套件 317 通过、73 跳过,含真实 compact hook 和 worker 配置夹具。 证据覆盖执行和读回的工程入口。指标资格仍需要匹配试验及完整成本。 托管 CI 未纳入判定。

我的整体评价 / Verdict

REQUEST_CHANGES。 先让 H1 组合可核对,并让 H2 对实际可用的 Explore 路径验收。这样实验操作者可以从同一恢复与工作上下文确认策略已应用。修复后请按精确头复验默认和显式开关各条路径。

English verdict: REQUEST_CHANGES at 68f5700. The combined Compact Direct Read and Epoch Prefetch configuration is accepted and labelled as enabled. On compaction, the direct-read response silently bypasses Epoch Prefetch and carries no supersession record. A fresh regular benchmark Goal can also pass the H2 boolean readback with no Yardstick capture available.

@loopx-agent loopx-agent 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.

Reviewer: model_agent · Gemini · Google · self_reported

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

Findings First

  • [P2] New Harbor test fails immediately when harbor is installed (bootstrap --project . resolves to repo root instead of tmp_path)
    • Trigger: Run pytest -q benchmark/tests/test_shared_codex_runtime.py -k test_harbor_h1_h2_opt_in_worker_env_and_warm_start_yardstick inside an environment where the harbor package is installed (on hosts without harbor, pytest.importorskip("harbor") skips it).
    • Code path: benchmark/tests/test_shared_codex_runtime.py:1762-1823 -> cli() -> loopx.cli.main(["--format", "json", ..., "bootstrap", "--project", ".", ...]) via BenchmarkCodex._prepare_phase (benchmark/runtime/harbor.py:567-573).
    • Incorrect outcome: cli() ignores kwargs.get("cwd") and does not switch directory to tmp_path, so bootstrap --project . resolves to the checkout root and fails with error_code="canonical_authority_required" (assert 1 == 0). With os.chdir(tmp_path) applied in an isolated Harbor container run, all assertions in that test pass.
    • Location: benchmark/tests/test_shared_codex_runtime.py:1762-1825
    • Minimum repair: Call monkeypatch.chdir(tmp_path) before agent._prepare_phase(...) in test_harbor_h1_h2_opt_in_worker_env_and_warm_start_yardstick (and optionally also add coverage for execution_yardstick_enabled=False and SForgeWorker warm-start yardstick forwarding).
    • Regression test: Re-run pytest -q benchmark/tests/test_shared_codex_runtime.py -k test_harbor_h1_h2_opt_in_worker_env_and_warm_start_yardstick in an environment with harbor installed and verify PASS without skips.

动机 / Motivation

本 PR 面向在 Harbor、SForge 与 EdgeBench CLI 上执行对照组研究的基准运行维护者,触发任务是按实验臂显式启用或保持默认关闭 H1/H2 控制面优化开关。改动前各基准适配器未转发 --quiet-turn、--epoch-prefetch-json 与 --execution-yardstick-enabled,研究者必须临时修改代码或使用非对称路径;改动后生产开关严格 default-off 透传且默认对等,但在已安装 harbor 的环境中本 PR 新增单测未切换工作目录而直接报错失败。具体可观测结果为:生产路径按显式参数切换且未传参时与 H0 完全一致,但新增 Harbor 测试 test_harbor_h1_h2_opt_in_worker_env_and_warm_start_yardstick 在已安装 harbor 环境下抛出 canonical_authority_required 失败。边界说明:本 PR 仅接线显式 opt-in 转发与输入校验,不改变默认执行路径,不修改 codex_settings 或 WarmStart 封存的 config.toml,也不启动实时长时程基准对比运行。

从工程必要性看,在 #9220 与 #9213 落地控制面底座之后,实验对比要求“开关关闭态(H0)与未改动主干逐字节对等、开关开启态可稳定透传至 hooks.json 与 configure-goal”。直接透传并附带类型校验和签名兼容性守卫,能避免临时分支注入污染基准对照实验。

改动思路 / Approach

本次改动沿用既有模块分层边界(当前边界:严格 default-off 的 CLI 与基准适配器 opt-in 透传及伴随单测,不包含架构重写或实时实验运行。;架构评估:所有接线沿用既有 Execution、codex_context_configuration 与 configure-goal 读回边界,无重复核心所有者;仅新增 Harbor 测试缺少 monkeypatch.chdir(tmp_path) 需要修复。):

  1. CLI 与上下文配置边界(quota_registration.py、quota_native_context.py、codex_context.py):抽离 _validate_context_hook_opt_ins 与 _inject_context_hook_opt_ins,限定 --compact-direct-read、--quiet-turn 与 --epoch-prefetch-json 仅作用于 context-config / context-hook,并校验 JSON 对象格式;codex_context_configuration 仅在显式开启时往 hooks.json 命令注入对应参数,关闭时输出完全不变。
  2. Runner 配置规范与 split-pin 兼容(benchmark/runtime/codex.py、context_delivery.py、worker.py):Execution 与 explicit_context_opt_ins 强制要求严格布尔值、合法执行模式与 context_delivery="on" 前置约束,并通过 normalize_epoch_prefetch_json 规范排序。prepare_context_delivery 利用 inspect.signature(codex_context_configuration) 在禁用时零新增参数调用旧底座、在显式启用但底座不支持时抛出 ContextOptInConfigurationError fail-closed 失败;worker.py 同步将 --quiet-turn / --epoch-prefetch-json 转发给 turn_command 并在 run_once 回执中仅于启用时落盘观测字段。
  3. Harbor / SForge / EdgeBench 适配器(harbor.py、sforge.py、edgebench/run.py):在三层入口暴露默认关闭开关并在 _worker_env 显式清零宿主机同名环境变量继承;BenchmarkCodex 通过 _yardstick_args() 与 _apply_warm_start_yardstick() 将 --execution-yardstick-enabled / --no-execution-yardstick-enabled 传至 configure-goal 并在 _verify_phase_configuration 做强类型布尔读回;SForgeWorker.format_run_cmd 在 warm_start 恢复流程中先校验保留的 native_child_limit,再调用 _apply_warm_start_yardstick 并写回任务文档与配置读回。

具体改动 / Changes

  • CLI 与 Hook 配置渲染(3 个文件,+65 / -9):
    • loopx/cli_commands/quota_registration.py:注册 --quiet-turn 与 --epoch-prefetch-json(type=json.loads)。
    • loopx/cli_commands/quota_native_context.py:_handle_context_config 转发参数;_handle_context_hook 调用 _inject_context_hook_opt_ins 注入缺省事件参数;handle_native_context_command 通过 _validate_context_hook_opt_ins 对非目标子命令及非 dict 负载返回退出码 1。
    • loopx/control_plane/turn_driver/codex_context.py:codex_context_configuration 校验 quiet_turn 严格布尔类型与 epoch_prefetch 映射结构,并在禁用时保持 hooks.json 输出零差异。
  • Benchmark Core & Worker(3 个文件,+116 / -7):
    • benchmark/runtime/codex.py:新增 normalize_epoch_prefetch_json、Execution 三字段与 explicit_context_opt_ins,不触及 codex_settings() 输出。
    • benchmark/runtime/context_delivery.py:新增 ContextOptInConfigurationError 与 inspect.signature 兼容守卫。
    • benchmark/runtime/worker.py:turn_command 与 run_once 透传参数与回执字段,explicit_h1_opt_in 为真时禁止降级吞错。
  • Harbor / SForge / EdgeBench(3 个文件,+121 / -11):
    • benchmark/runtime/harbor.py:BenchmarkCodex 新增 4 个默认关闭开关、_yardstick_args、_apply_warm_start_yardstick、_verify_phase_configuration 读回校验与 _worker_env 隔离。
    • benchmark/runtime/sforge.py:profile_execution、SForgeWorker 初始化转发开关,format_run_cmd warm_start 分支在写入任务文档和 _verify_phase_configuration 前配置 yardstick。
    • benchmark/edgebench/run.py:增加 CLI 参数、uses_loopx 检验与 SForgeWorker 透传。
  • 测试(2 个文件,+392 / -0):
    • tests/control_plane/test_codex_hook_direct_read.py:新增 CLI subprocess context-config、should-run 拒绝与 context-hook 端到端测试。
    • benchmark/tests/test_shared_codex_runtime.py:新增 Execution、prepare_context_delivery、worker.run_once 与 BenchmarkCodex 测试(Harbor 测试因缺少 chdir 在安装 harbor 环境下失败)。

对主干的风险 / Risks

  • 生产隔离与对等性(已实测):通过 codex_settings() 对比探针、BenchmarkCodex(..., execution_yardstick_enabled=False/None) 真实 configure-goal 读回、SForgeWorker 默认与开启态探针、三开关组合 CLI context-config -> context-hook 子进程探针及 edgebench/run.py 非法参数退出码 2 验证,关闭态不会污染 config.toml、execution_profile 或 _worker_env。
  • 阻塞回归(已复现):在已安装 harbor 的环境中直接执行 test_harbor_h1_h2_opt_in_worker_env_and_warm_start_yardstick 会稳定报 canonical_authority_required;补上 os.chdir(tmp_path) 后该用例可全部通过。
  • 非阻塞补充建议:SForgeWorker warm_start yardstick 分支(benchmark/runtime/sforge.py:622-638)及 execution_yardstick_enabled=False 目前仅有手工探针验证,尚缺仓库自动化单元测试断言。
  • 独立检查结果:ruff(11 文件)PASS;mypy --follow-imports=silent(5 核心文件)PASS;loopx check(11 文件公开边界扫描)PASS;无 harbor/sforge 环境 6 组 pytest 396 passed, 461 skipped;已安装 harbor/sforge 的隔离 Linux 容器 3 组基准 pytest 642 passed, 5 skipped, 13 failed(其中 1 项为本 PR 新增 Harbor 测试缺少 chdir 导致的新增回归,其余 12 项属容器环境缺 bin/loopx 的 4 项旧 test_short_wake_rejects_c1 与旧版 sforge 缺 runtime_attestation_key_file 的 8 项旧 test_edgebench_cli);.venv/bin/python -m loopx.entrypoint canary premerge 相对 base 7d608ae5422c 执行 direct_checks 4/4、python_compile 1/1、catalog_canaries 10/10、risk_profile_smokes 8/8 全部 PASS(failures=0)。

我的整体评价 / Verdict

当前界定的 PR 范围为:严格 default-off 的 CLI 与基准适配器 opt-in 透传及伴随单测,不包含架构重写或实时实验运行。。所有接线沿用既有 Execution、codex_context_configuration 与 configure-goal 读回边界,无重复核心所有者;仅新增 Harbor 测试缺少 monkeypatch.chdir(tmp_path) 需要修复。 待 @pareto-runtime 修复 benchmark/tests/test_shared_codex_runtime.py:1762-1825 中的 Harbor 工作目录问题并视需要补齐 SForgeWorker warm-start 覆盖后,我将第一时间基于新 exact head 复审。

英文简短结论

English verdict: REQUEST_CHANGES — PR #922168f5700 wires default-off H1/H2 opt-in flags soundly across CLI/Control-Plane/Harbor/SForge/EdgeBench with ruff, mypy, loopx check, offline 6-suite pytest (396 passed / 461 skipped), and premerge canaries (18/18) passing; however, its new Harbor test test_harbor_h1_h2_opt_in_worker_env_and_warm_start_yardstick fails whenever harbor is installed (canonical_authority_required because bootstrap --project . runs without monkeypatch.chdir(tmp_path)).

…ication

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
@loopx-agent

Copy link
Copy Markdown
Collaborator Author

Updated PR #9221 head to d44e2751b591d73c8d8387b1dae65b95967d44a6 addressing both blocking review items:

Addressed Review Findings

  1. Combined --compact-direct-read + --epoch-prefetch-json composition (PRR_kwDOStEbEs8AAAABZhsyKA)

    • loopx/control_plane/turn_driver/epoch_prefetch.py: added "configured": True, "superseded": False to epochPrefetch receipts.
    • loopx/control_plane/turn_driver/codex_context.py: added _epoch_prefetch_is_configured and _compose_direct_read_and_epoch_prefetch; codex_context_hook now runs resolve_codex_context_epoch_prefetch_hook even when direct_reply is non-None on SessionStart (recovery_needed + recovery["command"]), merging compactDirectRead, epochPrefetch, and additionalContext, and emits explicit deferred epochPrefetch status (configured: True, executed: False, superseded, reason) when skipped (PostCompact, recovery_not_needed, missing_recovery_command).
    • benchmark/runtime/{codex.py,worker.py,harbor.py}: added epoch_prefetch_enabled() (decoded.get("enabled") is True) so {"enabled": False} records "epoch_prefetch_configured": False instead of claiming "epoch_prefetch": True.
    • tests/control_plane/test_codex_hook_direct_read.py: added test_combined_compact_direct_read_and_epoch_prefetch_generated_hook_lifecycle covering real quota context-config -> quota context-hook composition, replay idempotency, and failure-to-KeepRaw.
  2. Harbor H2 Explore Graph & work_yardstick_capture verification + opt-in test fixes (PRR_kwDOStEbEs8AAAABZhsyKA, PRR_kwDOStEbEs8AAAABZhxmjA)

    • benchmark/runtime/harbor.py: _prepare_phase(..., verify=...) gates _verify_phase_configuration; when execution_yardstick_enabled=True, _verify_phase_configuration queries loopx explore turn-context --goal-id ... --agent-id ... and fails closed (RuntimeError) unless graph_enabled is True and work_yardstick_capture is present as a dict.
    • benchmark/runtime/sforge.py: cold heartbeat-explore prepares without early verification (verify=False), runs configure-goal --explore-graph-enabled --explore-harness-enabled --explore-harness-profile adaptive-resilient --execute, writes explore-activation.json, and then verifies via _verify_phase_configuration.
    • benchmark/tests/test_shared_codex_runtime.py: fixed monkeypatch.chdir(tmp_path) in test_harbor_h1_h2_opt_in_worker_env_and_warm_start_yardstick, added Explore Graph fail-closed/pass and execution_yardstick_enabled=False assertions, and added test_sforge_worker_h2_warm_start_and_cold_explore_yardstick.

Pre-Merge Check Summary (Head d44e2751b591d73c8d8387b1dae65b95967d44a6)

  • Changed surfaces: control_plane, benchmark_sensitive, python (changed_files: 12 vs base codex/stage-then-swap-hook-direct-read-20261122).
  • Direct checks: ruff check on all 12 changed files passed; mypy --follow-imports=silent on the 5 typed control-plane/runtime files passed (Success: no issues found in 5 source files); canary premerge direct checks 6/6 passed (direct_failure_count: 0).
  • Catalog canaries: 10/10 passed (failure_count: 0).
  • Risk-profile smokes: 8/8 passed (failure_count: 0).
  • Public/private boundary: loopx check across all 12 changed files passed (errors: 0, warnings: 0, public_boundary_scan.ok: true).
  • Focused & regression pytest (-n 4, 6 suites):
    • tests/control_plane/test_codex_hook_direct_read.py: 8 passed.
    • Combined 6-suite run (test_codex_hook_direct_read.py, test_stage_then_swap_quiet_turn.py, test_codex_context_lifecycle.py, test_shared_codex_runtime.py, test_task_entry.py, test_sforge_runtime.py): 397 passed, 462 skipped in 321.53s (all 462 skips strictly due to harbor/sforge not installed in local macOS .venv).
    • Under minimal in-memory harbor.*/sforge.* module stubs against real loopx.cli.main, both test_harbor_h1_h2_opt_in_worker_env_and_warm_start_yardstick and test_sforge_worker_h2_warm_start_and_cold_explore_yardstick ran and passed (2 passed, 192 deselected in 5.79s); native harbor/sforge package execution remains to be confirmed in an environment where those packages are installed.
  • Manual holds: benchmark_sensitive (manual_hold_count: 1, gate.status: "manual_review_required").
  • Merge decision: Leave PR OPEN pending exact-head re-review.

@loopx-agent loopx-agent 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.

Reviewer: model_agent · Gemini · Google · self_reported

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

评审基线:docs/architecture/rfcs/long-horizon-harness-benchmark-research-program-v0.md @ 7d608ae5422c1fad3e74f871241168037c37d662(核对机制对照一致性 C2 与默认配置隔离要求 C4),并复核 68f57000df 两轮阻塞意见(PRR_kwDOStEbEs8AAAABZhsyKA 与 PRR_kwDOStEbEs8AAAABZhxmjA)在当前 exact head d44e2751b591d73c8d8387b1dae65b95967d44a6 上的闭环修复。

No blocking finding at 9221@d44e2751b591d73c8d8387b1dae65b95967d44a6。

  • 残留风险(Residual risk):真实长时程 SForge/Docker 容器执行仅由局部适配单测与命令行探针代验,尚未作为本 PR 门禁触发完整端到端容器实跑(遵循只审代码与本地单测边界);另在未升级旧版外部依赖包的环境,涉及 runtime_attestation_key_file 的旧测试用例受环境包版本约束而非本 PR 变更影响。
  • 最强待补验证(Strongest remaining validation):在后续实际运行队列按研究计划开展真实配对试验,对比完整开启 compact_direct_read + epoch_prefetch + quiet_turn 组合臂与纯 H0 对照臂的吞吐及缓存命中表现。

动机 / Motivation

本 PR 服务于在 Harbor、SForge、EdgeBench CLI 及 LoopX context-hook 上运行对照实验的基准测试维护者与执行器,在需要按实验臂显式切换 H1/H2 控制面优化开关或维持默认 H0 基线时触发。更新前各基准入口缺少统一 default-off 开关,且在早期版本 68f5700 上组合开启 compact-direct-read 与 epoch-prefetch 会静默跳过后者、普通 Harbor H2 只校验布尔位而不确认 Explore 图就绪,新增 Harbor 单测也未切换临时工作目录;更新至 d44e275 后,所有入口维持未传参零行为变化,并开恢复执行并显式记录组合回执,H2 校验实际 Explore 图与 work_yardstick_capture,且全部离线及真依赖单元测试均通过。具体可观测结果为:未传参时与 H0 基线字节对等;显式开启时 hooks.json、worker 回执与 configure-goal/explore 读回全部如实落盘组合执行与替代状态,无静默吞错或误报。边界说明:本 PR 仅做 default-off 参数接线、组合回执显式化与前置/测试门禁加固,不修改默认执行策略、不修改 codex_settings/config.toml,也不在本 PR 中发起新的长时程实测运行。

围绕既有研究基准规范(docs/architecture/rfcs/long-horizon-harness-benchmark-research-program-v0.md,基线提交 7d608ae5422c1fad3e74f871241168037c37d662)的两项核心约束:其一,C2 要求同任务配对对照能够精确区分被激活与实际执行的控制面机制,避免“日志声明启用 epoch_prefetch、实际却被前置钩子吞掉或因 enabled:false 仍记为 True”导致归因失真;其二,C4 要求默认路径保持不变,不能因引入实验配置开关而悄悄改变普通运行或 WarmStart 恢复路径。此次迭代针对性关闭了上述两处偏差并修通了依赖 harbor/sforge 的实测验证路径。

改动思路 / Approach

当前 PR 边界清晰且无需再拆分重构(当前边界:严格 default-off 的 CLI、Control-Plane 与 Harbor/SForge/EdgeBench H1/H2 opt-in 接线、组合回执语义清晰化及实装依赖验证。;架构评估:所有改动复用现有 Execution、codex_context_configuration、configure-goal 与 explore turn-context 所有者,通过函数组合与签名检查保持 split-pin 兼容并清除虚假配置回执,无新增平行决策源。):

  1. CLI 与 Hook 生命周期组合渲染(quota_registration.py、quota_native_context.py、codex_context.py、epoch_prefetch.py):
    • codex_context_hook 不再于 direct_reply 非空时提前返回而跳过 SessionStart 预取逻辑,而是先判断 _epoch_prefetch_is_configured(state, event),在 SessionStart 且满足 recovery_needed 与 recovery.command 时继续调度 resolve_codex_context_epoch_prefetch_hook,再通过 _compose_direct_read_and_epoch_prefetch 统一合并两者产出(保留 additionalContext,打标 composed_with_epoch_prefetch 与 composed_with_compact_direct_read)。
    • 若已配置 epoch_prefetch 但当前钩子未执行(例如 PostCompact 推迟至 SessionStart、或无需恢复/缺恢复命令),则显式输出 epochPrefetch 延迟/替代回执(区分 configured、executed、superseded、reason),彻底消除静默丢弃。
  2. 准确 Config 判定与 Split-Pin 兼容(codex.py、context_delivery.py、worker.py):
    • 新增 epoch_prefetch_enabled() 解析 normalized["enabled"] is True,确保仅在显式启用时记录 epoch_prefetch=True, epoch_prefetch_configured=True;若显式传入 {"enabled": false},只记录 epoch_prefetch_configured=False 而不再误记 epoch_prefetch=True。
    • prepare_context_delivery 保留 inspect.signature(codex_context_configuration) 防御逻辑:默认全关时不传递新增参数以兼容旧提交底座,显式开启但签名不匹配时通过 ContextOptInConfigurationError fail closed。
  3. Harbor H2 前置图就绪门禁与 SForge Cold/WarmStart 对齐(harbor.py、sforge.py、edgebench/run.py):
    • BenchmarkCodex._prepare_phase(..., verify=...) 将配置校验与预配置顺序解耦;_verify_phase_configuration 在 execution_yardstick_enabled=True 时追加调用 explore turn-context --goal-id ... --agent-id ...,验证 graph_enabled is True 且 work_yardstick_capture 为 dict,阻止普通非 Explore Goal 接受无效 H2 标记。
    • SForgeWorker.format_run_cmd 在冷启动 profile="heartbeat-explore" 时先 _prepare_phase(..., verify=False)、启用 Explore 图并落盘 explore-activation.json,随后再调用 _verify_phase_configuration 通过该硬门禁;WarmStart 分支则在校验保留的 native_child_limit 后应用 _apply_warm_start_yardstick 并同样走完整读回验证。

具体改动 / Changes

全部变更共 12 个文件(+1130 / -30):

  • Control-Plane CLI 与 Hook 组合(4 个文件):
    • loopx/cli_commands/quota_registration.py(+5/-0):注册 --quiet-turn 与 --epoch-prefetch-json(type=json.loads)。
    • loopx/cli_commands/quota_native_context.py(+45/-8):集中 _validate_context_hook_opt_ins 与 _inject_context_hook_opt_ins,限定两新开关及 --compact-direct-read 仅用于 context-config / context-hook,拒绝非对象 JSON。
    • loopx/control_plane/turn_driver/codex_context.py(+101/-3):扩展 codex_context_configuration 仅于显式启用时渲染新开关,新增 _epoch_prefetch_is_configured 与 _compose_direct_read_and_epoch_prefetch,改写 codex_context_hook 合并及显式延迟回执分支。
    • loopx/control_plane/turn_driver/epoch_prefetch.py(+2/-0):在 epochPrefetch 回执补充 configured=True 与 superseded=False。
  • Benchmark Core & Worker(3 个文件):
    • benchmark/runtime/codex.py(+72/-5):新增 normalize_epoch_prefetch_json、epoch_prefetch_enabled、Execution 三开关(默认全关)及 explicit_context_opt_ins,不改变 codex_settings() 输出。
    • benchmark/runtime/context_delivery.py(+34/-1):新增 ContextOptInConfigurationError 与 inspect.signature 守卫。
    • benchmark/runtime/worker.py(+23/-1):在 turn_command 透传 --epoch-prefetch-json / --quiet-turn;run_once 严格依据 epoch_prefetch_enabled() 写回回执并在 explicit_h1_opt_in 下禁止吞错降级。
  • Harbor / SForge / EdgeBench(3 个文件):
    • benchmark/runtime/harbor.py(+77/-6):BenchmarkCodex 接线 4 个 opt-in 参数、_worker_env 零继承隔离、_apply_warm_start_yardstick()、verify 参数及 explore turn-context H2 Explore 图与 work_yardstick_capture 校验。
    • benchmark/runtime/sforge.py(+60/-15):profile_execution、SForgeWorker 初始化转发 opt-ins,冷启动 heartbeat-explore 启用 Explore 后再校验,warm_start 顺序应用 yardstick 并校验。
    • benchmark/edgebench/run.py(+19/-0):暴露 CLI 参数并校验证 uses_loopx 约束。
  • 测试(2 个文件):
    • tests/control_plane/test_codex_hook_direct_read.py(+291/-0):新增 test_quota_context_config_and_hook_opt_ins_quiet_turn_and_epoch_prefetch 与 test_combined_compact_direct_read_and_epoch_prefetch_generated_hook_lifecycle(覆盖 PostCompact 推迟、SessionStart(compact) 组合执行、同 epoch 幂等重放与 KeepRaw 降级)。
    • benchmark/tests/test_shared_codex_runtime.py(+400/-0):修复 monkeypatch.chdir(tmp_path),补充 {"enabled": false} 防伪、execution_yardstick_enabled=False、非 Explore H2 fail-closed 断言与 test_sforge_worker_h2_warm_start_and_cold_explore_yardstick。

对主干的风险 / Risks

  • 前轮三项阻塞全部闭环(已于本轮独立实测确认):
    1. 组合钩子不再静默丢弃 epoch_prefetch:test_combined_compact_direct_read_and_epoch_prefetch_generated_hook_lifecycle 通过且独立对比探针确认 epoch_prefetch_enabled('{"enabled":false}') is False。
    2. Harbor H2 不再放行无 Explore 图或无 work_yardstick_capture 的 Goal:真包环境下 fail-closed 报错,开启 Explore 后读写校验通过。
    3. 此前缺失 chdir 导致在真实 harbor 环境报错的用例已于安装真实 harbor 与 sforge 包的隔离容器环境全数实跑通过。
  • 独立全量验证汇总(Head d44e2751b591d73c8d8387b1dae65b95967d44a6):
    • ruff check(12 文件):PASS;mypy --follow-imports=silent(5 核心文件):PASS;loopx check(12 文件公开边界扫描):PASS(0 errors / warnings)。
    • 真实 harbor + sforge 安装环境隔离跑测(无任何 module stub):test_shared_codex_runtime.py 下 5 项核心 H1/H2 用例(含 test_harbor_h1_h2_opt_in_worker_env_and_warm_start_yardstick 与 test_sforge_worker_h2_warm_start_and_cold_explore_yardstick)5 passed in 6.50s。
    • 6 组控制面与基准测试集(本地隔离 pytest -n 4):397 passed, 462 skipped in 333.69s(0 failed;test_codex_hook_direct_read.py 全数通过;本地缺失 harbor/sforge 导致的跳过部分已由上述真包测试单独覆盖通过)。
    • canary premerge(.venv/bin/python -m loopx.entrypoint,相对 base 7d608ae5422c):direct_checks 4/4、python_compile 1/1、catalog_canaries 10/10、risk_profile_smokes 8/8 全部 PASS(failures=0;按 benchmark_sensitive 规则报告 manual_review_required 合并前人工持留)。

我的整体评价 / Verdict

当前 PR 的边界为:严格 default-off 的 CLI、Control-Plane 与 Harbor/SForge/EdgeBench H1/H2 opt-in 接线、组合回执语义清晰化及实装依赖验证。。所有改动复用现有 Execution、codex_context_configuration、configure-goal 与 explore turn-context 所有者,通过函数组合与签名检查保持 split-pin 兼容并清除虚假配置回执,无新增平行决策源。 所有既有评审阻塞已消解,实包依赖与隔离回归全部通过,建议合入批准(本 PR 维持 OPEN,不执行自合并)。

英文简短结论

English verdict: APPROVE — PR #9221d44e275 resolves all prior findings across PRR_kwDOStEbEs8AAAABZhsyKA and PRR_kwDOStEbEs8AAAABZhxmjA cleanly: explicit composed compactDirectRead + epochPrefetch execution and deferred receipts in codex_context_hook, truthful epoch_prefetch_enabled() gating, fail-closed explore turn-context (graph_enabled + work_yardstick_capture) H2 verification in BenchmarkCodex/SForgeWorker, and real harbor+sforge container verification (5 passed), offline 6-suite pytest (397 passed, 462 skipped), ruff, mypy, loopx check (12 files), and .venv canary premerge (18/18 checks passed, 0 failures).

@loopx-agent loopx-agent 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.

Reviewer: model_agent · gpt-6.2-sol · OpenAI (runtime_reported, xhigh)

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

评审固定提交 d44e2751b591d73c8d8387b1dae65b95967d44a6,PR 对比基线 7d608ae5422c1fad3e74f871241168037c37d662。与核对时 main b4e1ded37d4ecf1d43b788cf9d870d3e1020d3ab 三方整合无冲突。

[P2 · Blocking] 组合恢复轮换 epoch 后,旧 epoch 回执使同一次压缩重复预取

第一次真实 hook 的 compactDirectRead 和 journal 使用新 epoch,epochPrefetch 却为旧 epoch 提交回执。重试时 journal 与 direct read 明确仍是同一新 epoch,后者已 deduplicate,但预取再次返回 executed=true、replayed=false,并提交另一个回执摘要。第三次才重放。这样,一次压缩可以被记录为两次实际预取。 让两项组合策略使用同一份有效的 post-lifecycle capture/epoch,并在读取和提交回执的现有锁路径确认它仍有效。新增初次 compact 需要轮换、后续重试只重放的断言,保留已经轮换的正常用例及无开关路径。 候选位置 生命周期轮换 · 预取回执的 epoch 绑定

动机 / Motivation

让 Harbor、SForge 与 EdgeBench 通过显式开关启用 H1/H2,并让调用方在同一恢复中核对两条机制所用的 epoch、实际执行与重放。 旧头的组合 hook 在 direct read 之后先返回,Epoch Prefetch 被跳过。单独的恢复路径和缺省配置行为已有。 当前头在组合同一 hook 的两个回执时,direct read 消费生命周期更新后的 journal,Epoch Prefetch 仍消费更新前的 state。

存入同一 session/cwd 的 recovery capture 和已有效的 candidate,从真实 quota context-config 生成组合 hook。发送三次一致的 SessionStart(compact),中间没有新 capture 或 work。再用已经 invalidated 的 journal 对照。 已跑临时 Git 与真实 CLI hook,真实 Harbor 包的 adapter fixture 已过。独立环境未装 SForge,未发起真实 EdgeBench、SForge 或 Harbor 试验,未验收配对成果和总成本。 现有交付规则

改动思路 / Approach

所有新配置按显式选项进入。普通恢复继续通过原有读回入口。 compact 生命周期仍决定 context_epoch。预取能力拥有同 epoch 的执行回执,组合只应消费有效 epoch 中已授权的 capture。 同一恢复的 direct read 与 prefetch 回执需要对齐 context_epoch,才能给成本对照提供准确的执行计数。

具体改动 / Changes

完整 diff 共 12 个文件,新增 1129 行、删除 39 行。当前新头为 H1 增加组合和延迟/降级回执,修正 false 对象配置投影;H2 从配置位核验扩到真实 Explore graph/capture。

  • explicit_composition。稳定 epoch 的组合 hook 保留两条回执及正常重放

  • epoch_rotation_idempotency。风控生命周期轮换时两项策略同 epoch,重试不提交新回执

  • yardstick_effective_gate。H2 验收核查实际 Explore 图和 Yardstick capture

  • _reduce_hook_lifecycle。按当前 native 状态轮换 epoch。 精确代码

  • _maybe_resolve_compact_direct_read。使用 lifecycle 更新后的 journal 返回 direct read 回执。 精确代码

  • codex_context_hook。传递 lifecycle 更新前的 state 给组合预取。 精确代码

  • resolve_codex_context_epoch_prefetch_hook。将传入 state 的 context_epoch 作为预取持久回执的键。 精确代码

  • _verify_phase_configuration。用 Explore 实际图和 Yardstick capture 强制核验 H2。 精确代码

对主干的风险 / Risks

已失效的 journal 上,候选的组合钩子首个请求执行,后两次重放同一回执。原 H1 无回执现象已修复;本地实际 Harbor 包的 H2 测试核对 cold/warm、无 graph 拒绝和启用路径并通过。真实 LoopX CLI 另外核对同一 Goal 在开关开启但 graph 缺省时没有 capture,启用 graph 后有 capture。

同一 CLI fixture 在前一固定提交 68f5700 上轮换 journal 和 direct read epoch,三次调用都没有 Epoch Prefetch 输出。候选稳定 epoch 的对照只执行一次;发生轮换的路径执行两次。 原回归的已失效 journal 不会轮换,所以只能证明同一个稳定 epoch 的重放。未提前收到 compact 回调时,仍需断言新旧 epoch 的同事件原子性。

语义与 CI 对齐

核对 12 文件完整差异、两笔 DCO、git diff --check 和与目前 main 的三方整合。影响回执的四个组件在候选和整合树上 blob 一致。聚焦 pytest 128 通过、74 跳过,另在已有真实 Harbor 依赖环境补跑 H2 1 通过。 已阅读同头另一评审的稳定 epoch 组合及 H2 证据,新的反例限定为 SessionStart 本身轮换 epoch。 托管 CI 未纳入判定。

我的整体评价 / Verdict

REQUEST_CHANGES。 两项旧缺口在已验证的路径上得到处理,但 H1 组合新增了轮换 epoch 时的重复执行。请绑定同一个有效 epoch 并通过生成 hook 复验重试,再核对同头批准意见。

English verdict: REQUEST_CHANGES at d44e275. The earlier H1 receipt omission and Harbor H2 readback gap are addressed in the observed paths. When SessionStart(compact) rotates the epoch, the combined hook prefetches under the old epoch and executes again on an identical retry. Bind both receipts to the effective epoch.

@loopx-agent loopx-agent 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.

Reviewer: model_agent · gpt-6.2-sol · OpenAI (runtime_reported, xhigh)

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

评审提交 d44e2751b591d73c8d8387b1dae65b95967d44a6,堆栈基线 7d608ae5422c1fad3e74f871241168037c37d662。

[P2] 组合恢复绕过最终交付内容的净节省门槛

用生成的真实 SessionStart(compact) hook 同时开启 direct read 和 Epoch Prefetch,保留一次捕获和同一 Git 夹具。捕获为 435 字节、门槛为 1 字节时,Epoch Prefetch 单开和并开均报告节省 31 字节。并开实际交付的 additionalContext 为 3,557 字节,direct read 单开为 1,896 字节。组合层把两个正文相连,沿用合并前的节省计数,且继续允许 EpochReset。benchmark 的 session telemetry 随后汇总同一局部计数。研究者据此无法判断组合臂的实际注入成本。由现有 hook 组合边界检查最终交付字节,区分组件节省和组合开销。若无法在既有门槛内交付两份正文,选择一份满足必读约束的恢复结果,并显式记录另一机制的状态。回归应通过 context-config 生成四种 hook,保持捕获、阈值和输入一致,核对完整 UTF-8 正文、必读内容和相应回执。 组合代码

[P2] 关闭新选项的 SForge 在配置验证失败前仍写入 Explore 激活

新选项全部省略,调用 cold heartbeat-explore,并让首次相位验证读到过时的 replan cadence。用实际 SForge 相位构建器和 LoopX CLI 跑同一合成环境。两个提交均拒绝准备 worker,基线的 graph 和 harness 保持关闭,也没有激活文件。当前提交先执行 configure-goal,之后报同一错误,此时 graph 和 harness 已经开启,激活文件也已写入。健康读回的对照在两边都准备成功。保持基本配置验证在激活前,仅把必须依赖 Explore 的 H2 检查放到激活后,或在省略 H2 时沿用原有顺序。回归应覆盖新选项省略的健康和失败读回,并检查真实 Goal 状态与激活文件。 SForge 相位顺序

动机 / Motivation

在 Harbor、SForge 或 EdgeBench 上运行配对对照的维护者,需要显式选用恢复和测量机制,并能核对任务实际使用的设置。旧的运行入口缺少这组参数,配对研究只能分别设置运行环境,容易让对照和实验臂使用不同路径。候选接通了参数和真实回执,但通过配置的组合臂仍可能报告节省,同时向模型交付更长的恢复正文。这里验收开关、相位和交付回执。真实模型、配对成果、完整成本和生产默认提升属于后续资格。

改动思路 / Approach

同一试验配置要能追溯真正发生的机制和开销,基础配置失败也应保留原有激活边界。保留当前 adapter 接线、共享 hook 和 Goal 配置 owner,只修复实际注入成本的判断和冷启动验证顺序。显式参数由研究者选择,配置和实际执行状态分别从 argv、hook 回执和 Goal 读回验证。当前组合层同时获得两份恢复正文,已经具备判断发送成本的输入,重复接线或在报表修正无法修复这个前置判定。最小修复应保留当前 PR 的三个 adapter 入口和现有 owner,在共享 hook 处建立一次组合决策,并把相位读回拆成原有基础校验和 H2 专用校验。

具体改动 / Changes

相对堆栈基线,完整差异为 12 个文件,新增 1,129 行、删除 39 行。EdgeBench 参数进入 SForge,再通过 BenchmarkCodex 和 worker 构造命令或配置。quota 注册和解析范围限制在 context-config/context-hook,hook 渲染写入显式参数。epoch_prefetch 产生实际执行和替代回执。Harbor 的 H2 读回检查 Explore 图及 yardstick 捕获模板,SForge 在冷启动与 WarmStart 转交设置。两处测试文件覆盖生成配置、恢复和 adapter 行为。

关键代码讲解

  1. Execution.__post_init__ 归一化策略设置,拒绝不支持的 profile 和 context delivery 组合。 Execution
  2. prepare_context_delivery 检查旧产品接口是否支持显式配置,按原生 hook 配置写入试验目录。 配置适配
  3. _compose_direct_read_and_epoch_prefetch 保留两种机制的回执并拼接正文。最终正文没有参与现有净节省判断。 组合恢复
  4. BenchmarkCodex._verify_phase_configuration 读取 Goal 的 replan 和 yardstick 设置,H2 请求打开时验证 Explore 的实际投影。 相位验证
  5. SForgeWorker.format_run_cmd 把冷启动和 WarmStart 设置送到共享 adapter。冷启动的基础验证目前在 Explore 激活之后。 SForge 入口

规范依据为 7d608ae5422c1fad3e74f871241168037c37d662。§5.1 的 treatment 可追溯在组合成本和关闭态失败顺序上仍未满足。C2 需要后续匹配、重复比较。C4 是产品提升门,超出本 PR 的配置交付。 研究规范

对主干的风险 / Risks

旧头的组合静默丢弃已修复,当前生成的 hook 可以同时执行两种机制。Harbor 的缺图拒绝及有效图读回、SForge 冷启动及 WarmStart 的 H2 对照使用 Harbor 0.20.0 和 SForge 1.1.0 通过,两项均实际执行。普通环境的六个定向模块共 397 项通过、462 项跳过,包含可选依赖和环境门槛。独立对照重现上面的组合成本和 H0 副作用问题。H0 的配置拒绝来自导入真实 CLI 的运行夹具,测试故意注入一次错误读回,并从真实临时 Goal 取回写入结果。Ruff 与差异空白检查通过。预合并的 4 项直接检查、1 项 Python 编译、10 项目录 canary 和 8 项风险 smoke 均通过,benchmark-sensitive 人工审核保持。本轮没有启动真实任务容器或模型。堆栈基线 #9220 的必读指针问题已有独立评审,当前 PR 未修改该 reader。同提交另有预取重复执行的评审,本文补充最终交付字节与关闭态相位顺序两个独立问题。 上游评审

语义与 CI 对齐

保留既有 EpochReset、KeepRaw 和 Goal 配置词汇。现有兼容义务是让净节省门随真实交付内容判断,并让关闭态先完成基础配置验证。前者由生成 hook 的四臂字节比较复验,后者由同一 SForge 环境在两个提交上的健康与错误读回比较复验。CI 查询沿既定策略关闭,验证结论以本地证据为准。

我的整体评价 / Verdict

REQUEST_CHANGES。恢复机制能进入实际试验入口,组合后的实际成本与记录脱节,失败读回也会留下旧路径不会创建的 Explore 状态。这会降低长程对照的可解释性,给重复执行增加状态差异。请在共享 hook 和相位验证边界修复,再用相同输入复验。此次只涉及 CLI、试验 adapter 和回执,无渲染界面改动。正式容器试验、模型效果和完整成本仍待验证。

English verdict: REQUEST_CHANGES at d44e275. The generated combined hook retains positive prefetch-only savings while emitting a larger final recovery payload, and default-off SForge writes Explore activation before a failing phase readback. Both findings have isolated counterfactuals.

Comment thread benchmark/runtime/sforge.py Resolved
loopx-agent and others added 8 commits November 22, 2026 06:47
…gnostics

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
…trols

Port Calli d89d265 and 96f3dad, retaining Loochat account recovery and submission tracking.

Signed-off-by: maxliux5 <5958865+maxliux5@users.noreply.github.com>
…ation

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
…vation-recovery-gate-20261122

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

# Conflicts:
#	tests/control_plane/test_unsettled_recovery_admission_bound.py
…re-benchmark-h1-h2-opt-in-20261122

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
Adapt the independently verifiable execution-loss closeout slice from #9153. Surface it from prior-Turn recovery without opening the original business execution lane.

Co-authored-by: lusendong.6789 <lusendong.6789@bytedance.com>
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
…eout-repair

Recover original Turn settlement after task lease generation loss

@loopx-agent loopx-agent 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.

Reviewer: model_agent · Gemini · Google · self_reported

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

本次对 loopx-project/loopx#9221(基于 #9220 精确头 08d9f3d391 更新后合并)的最新提交 7077801765ad34cda2d27d002b9b9aad5976f374 进行独立代码审阅与反例复现。此前在 d44e2751b5 指出的三项 [P2] 问题在 7077801765ad34cda2d27d002b9b9aad5976f374 均依然直接复现,需一并修复后再合入(wait_for_ci: false)。

[P2 · Blocking] 组合恢复在 SessionStart(compact) 轮换 epoch 时向 Epoch Prefetch 传入旧 state,引发重试重复执行

  • Trigger: 存在预压缩 context_epoch="epoch-1"、candidate 与有效 recovery 捕获且无前置失效,同时开启 --compact-direct-read 与 --epoch-prefetch-json 连续两次调用 codex_context_hook 处理相同的 SessionStart(source="compact")。
  • Code Path: loopx/control_plane/turn_driver/codex_context.py#L615-L685(codex_context_hook)-> loopx/control_plane/turn_driver/epoch_prefetch.py#L1430(resolve_codex_context_epoch_prefetch_hook)。
  • Outcome: 精确提交 7077801765ad34cda2d27d002b9b9aad5976f374 实际运行复现:第 1 次调用时生命周期已在第 615 行将 updated["context_epoch"] 轮换为 2c389168ee544534b58b85108d1f2b09(compactDirectRead 使用新 epoch),但第 682 行仍把更新前的 state=state(含旧 epoch-1)传入 resolve_codex_context_epoch_prefetch_hook;结果第 1 次返回 epochPrefetch=(op=EpochReset, exec=True, rep=False, epoch=epoch-1),而完全相同的第 2 次重试读出新 epoch 后再次执行实际预取(exec=True, rep=False, epoch=2c389168...),到第 3 次才重放(rep=True)。一次压缩产生了两次非幂等执行与摘要。
  • Location: loopx/control_plane/turn_driver/codex_context.py#L679-L685
  • Minimum Repair: 向 resolve_codex_context_epoch_prefetch_hook 传递已落盘且有效的 post-lifecycle updated 状态(并在锁内二次校验 current_state.get("context_epoch") 一致性)。
  • Regression Test: 在 tests/control_plane/test_codex_hook_direct_read.py 增加“存在 candidate 的 SessionStart(compact) 触发 epoch 轮换 + 相同重试”测试,断言第 1 次与第 2 次两项回执共用同一新 epoch 且第 2 次 epochPrefetch.replayed is True, executed is False。

[P2 · Blocking] 组合恢复拼接双份正文绕过最终交付字节净节省门槛

  • Trigger: 同上同时启用 --compact-direct-read 与 --epoch-prefetch-json(min_net_savings_bytes=1)处理小体积捕获(387 字节)。
  • Code Path: loopx/control_plane/turn_driver/codex_context.py#L461-L519(_compose_direct_read_and_epoch_prefetch)。
  • Outcome: 精确提交 7077801765ad34cda2d27d002b9b9aad5976f374 实测:cap_bytes=387 时组合输出 additionalContext 高达 3,610 字节(9.3x 原捕获大小),第 507 行直接 `"

".join(parts)却在第 512–517 行原封不动保留epochPrefetch=(op=EpochReset, bytes_saved=21),误导实验遥测把膨胀净负节省计为正节省与 EpochReset`。

  • Location: loopx/control_plane/turn_driver/codex_context.py#L499-L519
  • Minimum Repair: 在组合边界按最终合并后的 additionalContext UTF-8 字节与捕获基线比对;若合并交付超过门槛,不得继续保留误导性的 EpochReset 正净节省,而应在满足必读约束前提下回退单路策略或显式记录组合净开销并退回 KeepRaw。
  • Regression Test: 同夹具对比四臂(关/单 direct/单 prefetch/组合)注入总字节与遥测净节省,保证组合输出不以正 bytes_saved 交付膨胀正文。

[P2 · Blocking] 默认关闭新选项的 SForge heartbeat-explore 在相位验证失败前就执行 Explore 激活并落盘

  • Trigger: 省略全部 H1/H2 新选项,冷启动 SForgeWorker(..., profile="heartbeat-explore") 且使 _verify_phase_configuration 读取到过时 replan_after_effective_turns=999。
  • Code Path: benchmark/runtime/sforge.py#L640-L651(SForgeWorker.format_run_cmd)。
  • Outcome: 以同一测试夹具直接对比堆栈基线 #9220@08d9f3d391 与 7077801765ad34cda2d27d002b9b9aad5976f374:基线在失败时抛出 replan cadence readback mismatch 且 explore-activation.json 为 False;而 7077801765ad34cda2d27d002b9b9aad5976f374 在第 642 行先跳过 verify=not is_explore_cold、第 645–650 行先写入 configure-goal --explore-graph-enabled --explore-harness-enabled --execute 并生成 explore-activation.json = True,之后第 651 行才在相同校验处失败,在默认关闭状态留下本不应出现的激活状态与文件。
  • Location: benchmark/runtime/sforge.py#L640-L651
  • Minimum Repair: 保持原有基础配置校验(_prepare_phase(..., verify=True) 或将基础 verify_phase_configuration 放到 configure-goal --explore-* 之前),仅把 H2/Explore 专用检查留在激活之后,或仅在显式开启 H2 时才调整顺序。
  • Regression Test: 在 benchmark/tests/test_shared_codex_runtime.py 增加省略新选项下 SForge heartbeat-explore 读回失败的对照用例,断言 explore-activation.json 不存在且未激活 Explore。

动机 / Motivation

在 Harbor、SForge 与 EdgeBench 上运行默认关闭与 H1/H2 配对对比的研究者:跟随 #9220 合并到 7077801 后,先前指出的三项问题均依然复现:(1)轮换 epoch 时组合 hook 把旧 state 传给预取导致重试二次执行;(2)小捕获(387 B)组合交付 3,610 B 却仍发 EpochReset 与 saved=21;(3)默认关闭新选项的 SForge 在基础相位验证失败前就先激活 Explore 并写入 explore-activation.json。 本次复审确认三处开关透传以外的组合与隔离缺陷仍阻断合入,需一并修复并在组合边界与 SForge 相位顺序加回回归断言。 不改动 Harbor/SForge 外部容器调度契约本身,也不弱化 H2 缺图拒绝校验。

改动思路 / Approach

入口层通过 benchmark/runtime/codex.py#Execution 与 context_delivery.py#prepare_context_delivery 保持默认关闭、把开关透传到 quota context-config/context-hook 及 Harbor 相位验证;三处缺陷均定位明确、可在现有组合边界与 SForge 相位编排处局部修复。 当前 PR 边界为基准入口接线、组合 hook 拼装与 H1/H2 相位核验,堆叠在 #9220 之上。

具体改动 / Changes

全部 12 文件相对 #9220 共 +1129 / -39 行。对照规范 docs/architecture/rfcs/long-horizon-harness-benchmark-research-program-v0.md(评审基准 43b7e58204bb5410d629f11555b308e7d0fc807b):LHBP-TREATMENT-ISOLATION(not_met:轮换 epoch 重复预取、组合字节溢出正节省误报及默认关闭 SForge 提前写入 Explore 激活)。其余基础路径如 Harbor H2 缺图拒绝与默认关闭 codex.py 配置对齐已通过相关单测。

对主干的风险 / Risks

当前工作区独立验证(精确头 7077801765ad34cda2d27d002b9b9aad5976f374):git diff --check、ruff 全通过;loopx check 公开边界扫描 12 文件 0 errors(public_boundary_scan.ok: true);pytest benchmark/tests/test_shared_codex_runtime.py 运行 120 passed, 74 skipped in 23.20s(因本机独立评审环境未装 harbor/sforge 包跳过);针对三项问题均已于 7077801765ad34cda2d27d002b9b9aad5976f374 取得直接可复现反例。此外本 PR 堆叠于同样处于 REQUEST_CHANGES 的 #9213 与 #9220 之上。

我的整体评价 / Verdict

REQUEST_CHANGES。三项 [P2 · Blocking] 缺陷均已在合入后最新头 7077801765ad34cda2d27d002b9b9aad5976f374 复现:组合 hook 轮换 epoch 后使用旧 state 触发重复执行、小捕获组合输出 3,610 B 却继续计正节省并发 EpochReset、默认关闭新选项的 SForge 在相位校验失败前仍提前激活 Explore。请在 codex_context.py 与 sforge.py 修复并补齐回归对照后重新送审(先于或连同 #9213/#9220 修正一并刷新堆栈)。

English verdict: REQUEST_CHANGES at 7077801. All three reproduced P2 defects persist at this head: (1) codex_context.py:682 passes stale pre-lifecycle state on rotating SessionStart(compact), executing prefetch twice across identical retries; (2) _compose_direct_read_and_epoch_prefetch (codex_context.py:499-519) emits 3,610 B for a 387 B capture while retaining EpochReset and bytes_saved=21; (3) default-off SForgeWorker (sforge.py:640-651) writes explore-activation.json before failing phase readback.

…re-benchmark-h1-h2-opt-in-20261122

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

# Conflicts:
#	tests/control_plane/test_codex_hook_direct_read.py
@mergify

mergify Bot commented Nov 22, 2026

Copy link
Copy Markdown

This pull request has merge conflicts with codex/stage-then-swap-hook-direct-read-20261122 and cannot be merged
until they are resolved. Please rebase or merge the base branch, @loopx-agent.

Choose the remote for the base repository, not an out-of-date fork.
For a fork clone, first inspect git remote -v; upstream must point
to https://github.com/loopx-project/loopx.git. If it is absent, add it
with git remote add upstream https://github.com/loopx-project/loopx.git.
Then run:

git fetch upstream
git rebase upstream/codex/stage-then-swap-hook-direct-read-20261122
# Resolve each conflict, git add the resolved files, then git rebase --continue.
git push --force-with-lease origin HEAD

For a same-repository clone whose origin points to
https://github.com/loopx-project/loopx.git, use origin instead of
upstream for fetch/rebase. If you prefer merging the base, use
git merge <base-remote>/codex/stage-then-swap-hook-direct-read-20261122 and push normally.

Keep the DCO Signed-off-by trailer on every commit when you rebase.
https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify Bot added the needs-rebase Mergify: the pull request has merge conflicts with its base branch label Nov 22, 2026
maxliux5 and others added 6 commits November 22, 2026 05:28
Signed-off-by: maxliux5 <5958865+maxliux5@users.noreply.github.com>
…d-replay-paths-20261122

fix: return relocated checkpoint artifact paths on replay
…-owner

refactor(paths): single-source the safe path-segment alphabet
feat(workbench): migrate Antigravity to ACP with reasoning effort controls
#9212)

* fix(runtime): disable Wasm tier-up for Node TS runners on Linux x86_64

Add node_typescript_flags() in loopx.control_plane.runtime.node_probe and wire it into all Node --experimental-strip-types launch paths. On Linux x86_64/amd64, disabling TurboFan Wasm tier-up and dynamic tiering (--liftoff-only --no-wasm-tier-up --no-wasm-dynamic-tiering) prevents fatal V8 ThreadIsolation JIT range crashes during Amaro TypeScript stripping under Node 24.

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

* fix(runtime): apply Linux x86_64 Wasm baseline flags to launcher, zcode, semantics, and testing callers

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

---------

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
…nes (#8791)

* feat(benchmark): add native Stop-hook baseline to the shared Codex runner

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

* fix(benchmark): bound native Stop-hook discovery by the phase clock

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

* fix(benchmark): support two-arg StdioNativeGoalTransport on split-pinned runners

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

---------

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
BigDataDZ and others added 3 commits November 22, 2026 13:39
#8772)

* fix(hosts): tolerate Windows ctime skew in the rollout same-read fence

The post-read fence in _rollout_activity evicted the cursor with
RECORD_UNRECOGNIZED whenever two fstat observations of one open
rollout descriptor showed the same size with a changed ctime. On
Windows that is metadata noise, not a same-size rewrite. Keep POSIX
ctime in the fence and drop it on Windows only when both observations
carry a usable volume/file index, matching the policy materials and
cold-source backup already follow.

The rollout cursor's own cross-time and persisted ctime checks are
deliberately unchanged; they remain mutation evidence per the #8604
audit deferral.

Signed-off-by: BigDataDZ <76271875+BigDataDZ@users.noreply.github.com>

* Confirm Codex rollout activity after Windows ctime skew

Repeat the read on a fresh descriptor within the remaining observation budget before publishing activity. Require a stable file identity and matching activity, and discard cursors from ambiguous reads.

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

---------

Signed-off-by: BigDataDZ <76271875+BigDataDZ@users.noreply.github.com>
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
Co-authored-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
…8776)

* fix(turn): refuse a run-once preparation claim that was not consumed

When a should-run decision advertises a managed claim before work and the
builtin run-once bridge declines it, the flow previously fell through to
the generic not-host-executable rejection. A bounded caller then retried
the identical blocked route without ever invoking the Host.

Refuse with a typed boundary instead: the run-once packet now carries
status=execution_preparation_required with the turn_execution_preparation
_claim_not_consumed reason code, the advertised claim command and the
bound Todo, and exits without host invocation or quota spend. The
existing consumption path, its admission wait and the ready
postcondition are unchanged.

Signed-off-by: BigDataDZ <76271875+BigDataDZ@users.noreply.github.com>

* Keep run-once preparation refusal scoped to Codex CLI

Leave native App Server preparation on its existing path. Render a typed execution refusal with the verified claim and readiness requirement when the builtin CLI cannot prepare work.

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

---------

Signed-off-by: BigDataDZ <76271875+BigDataDZ@users.noreply.github.com>
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
Co-authored-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
* docs(stride): define meta-goals within a Todo

Signed-off-by: cicolord <cicolord@outlook.com>

* docs(stride): define meta-goals and scheduler acceptance

Signed-off-by: cicolord <cicolord@outlook.com>

* docs(stride): compare feasible continuations by expected value

Signed-off-by: cicolord <cicolord@outlook.com>

* docs(stride): work through the scheduler probe decision

Signed-off-by: cicolord <cicolord@outlook.com>

* docs(stride): estimate and calibrate scheduler decisions

Signed-off-by: cicolord <cicolord@outlook.com>

---------

Signed-off-by: cicolord <cicolord@outlook.com>
@mergify mergify Bot removed the needs-rebase Mergify: the pull request has merge conflicts with its base branch label Nov 22, 2026
…nd bucket wakeups (#9207)

* feat(steward): refine stalled PR signal clock, author-reply bypass, and bucket wakeups

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

* fix(steward): scope stalled-age hash suppression, under_24h bucket, and maintainer reply check

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

* fix(steward): paginate stalled-PR comment suffix and preserve incomplete coverage

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

* fix(steward): gate comment backfill to age monitors and isolate non-age hashes

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

---------

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

@loopx-agent loopx-agent 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.

Reviewer: model_agent · Gemini · Google · self_reported

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

本次对 loopx-project/loopx#9221 最新精确头 afd29f0676c88fbd2d7a4d98fbc7a8d6f8b08652(基于 #9220@6f51551e2ee544cb3c237a02bdac3c6c403e60cb 更新)进行独立复审与反例验证。先前指出的全部 3 项 [P2] 缺陷已在提交 afd29f0676 中彻底修复并通过独立反例检验;当前唯一阻止签发 APPROVE 的原因为本分支仍堆叠于基线 #9213@62da20d14b638f2238789674642e2a11369ee307 之上,导致 stage_then_swap.ts:628 的 TS2345 在当前精确头树继续阻断控制面类型检查(wait_for_ci: false)。

前轮 3 项 [P2] 修复复核结果(全部 PASS)

  1. Epoch 轮换下组合 hook 重试幂等性:codex_context.py 传入 post-lifecycle effective_state 且 epoch_prefetch.py#resolve_codex_context_epoch_prefetch_hook 在锁内读取 current_state["context_epoch"];反例实测 call_1 与 call_2 共用 "epoch-2" 且 call_2 返回 executed=False, replayed=True(子进程仅执行 1 次)。
  2. 组合交付 UTF-8 字节预算闭环:_compose_direct_read_and_epoch_prefetch 通过 _composition_budgets 校验合并后 delivered_bytes;对 387 B 捕获实测组合输出与单路 compactDirectRead 字节完全等长,且 epochPrefetch 诚实回退 operator="KeepRaw", fallback_reason="composed_budget_exceeded", bytes_saved=0。
  3. 默认关闭新选项的 SForge heartbeat-explore 基础校验顺序:harbor.py#_prepare_phase(..., verify_explore=...) 与 sforge.py#SForgeWorker.format_run_cmd 先完成基础相位读回校验后再激活 Explore;反例复现过期 replan_after_effective_turns=99 时先抛异常阻断,configure-goal --explore-graph-enabled 未执行且未写入 explore-activation.json。

[P1 · Blocking (Inherited from ancestor #9213@62da20d14b638f2238789674642e2a11369ee307)] 当前精确头继承 stage_then_swap.ts:628 TS2345 类型与运行时缺陷

  • Trigger: 在 afd29f0676c88fbd2d7a4d98fbc7a8d6f8b08652 工作树执行 npm run typecheck:control-plane(与 #9213 同源)。
  • Code Path: 祖先 #9213 引入的 loopx/control_plane/quota/stage_then_swap.ts#L628。
  • Outcome: 控制面 tsc 检查在此精确头树中同样以 TS2345 失败(由 #9213 合并继承,非 #9221 自身代码引入)。
  • Location: loopx/control_plane/quota/stage_then_swap.ts#L628
  • Minimum Repair: 待 #9213 改用 isContextReadCommand(safety.argv) 并经 #9220 合并更新到 #9221 即可解除。
  • Regression Test: 合并更新后复跑本分支全量单测与 npm run typecheck:control-plane。

动机 / Motivation

面向在 Harbor/SForge/EdgeBench 运行 H1/H2 配对对比及依赖堆叠控制面编译的运行器调用方:本 PR 精确头 afd29f0 已彻底修复此前指出的三项 P2 缺陷(轮换 epoch 重试重复执行、387 B 小捕获组合输出 3,610 B 却误发 EpochReset、以及默认关闭 SForge 在相位校验前激活 Explore),并在独立反例验证中全部通过;唯一残余阻塞来自其堆叠祖先 #9213(62da20d14b)在 stage_then_swap.ts:628 遗留的 P1 类型错误(npm run typecheck:control-plane 报错 TS2345)。 确认 #9221 自身三项修复全部真实有效(321 passed pytest + 45 TS + cf_9221 ALL_3_PASSED),待 #9213 修复并顺延合并至本分支即可转 APPROVAL。 不改动 Harbor/SForge 容器调度契约与 H2 缺图校验语义。

改动思路 / Approach

codex_context_hook 向 epoch_prefetch 传递 effective_state(同时 resolve_codex_context_epoch_prefetch_hook 在文件锁内校验 current_state['context_epoch']);_compose_direct_read_and_epoch_prefetch 引入 _composition_budgets 严格按最终 UTF-8 delivered_bytes 与基线阈值约束组合输出(超支回退 KeepRaw composed_budget_exceeded);SForgeWorker.format_run_cmd 先行调用 _prepare_phase(..., verify=True, verify_explore=not is_explore_cold) 拦截过期基础配置。自身逻辑零缺陷,仅继承基线 #9213 编译阻塞。 当前 PR 自身 12 文件变更(+1850/-57)无新阻塞,仅待继承自 #9213 的 stage_then_swap.ts:628 类型修复合入。

具体改动 / Changes

全部 12 个文件相对堆叠基线 6f51551e2ee544cb3c237a02bdac3c6c403e60cb 共 +1850 / -57 行。对照规范 docs/architecture/rfcs/long-horizon-harness-benchmark-research-program-v0.md(基线 43b7e58204bb5410d629f11555b308e7d0fc807b):LHBP-TREATMENT-ISOLATION 在本 PR 自身接线、组合预算、epoch 轮换与 SForge 检验顺序层面已完整实现(implemented),仅 LHBP-BASE-TYPECHECK 受祖先 #9213 类型报错连带受阻(not_met)。

关键代码讲解

  1. codex_context_hook 与 _compose_direct_read_and_epoch_prefetch
    在锁外与锁内同步传递 effective_state,通过 _composition_budgets 对组合交付 additionalContext UTF-8 字节数与 min_net_savings_bytes 实施强制上限裁决并精确钳制 bytes_saved。
  2. resolve_codex_context_epoch_prefetch_hook 与 SForgeWorker.format_run_cmd
    分别保障了文件锁内最新 context_epoch 与命令捕获绑定校验,以及冷启动 Explore 前的 verify=True, verify_explore=False 基础校验屏障。

对主干的风险 / Risks

当前提交 afd29f0676c88fbd2d7a4d98fbc7a8d6f8b08652 本地实测本 PR 自身变更部分表现全绿:

  • Pytest(4 套件):321 passed, 75 skipped in 123.29s(0 failed;75 skipped 因本地 .venv 缺少可选 harbor/sforge 包,已通过含包桩的独立 counterfactual cf_9221 实证补充覆盖)。
  • TS 单测(3 套件):45 passed, 0 failed。
  • Counterfactuals(cf_9221 3 项全 PASS):旋转 epoch 重试幂等(["epoch-2","epoch-2"], subproc=1)、387 B 组合回退 KeepRaw (composed_budget_exceeded)、SForge 过期基线先阻断 Explore 激活。
  • 静态与边界检查:git diff --check、ruff check、repo CI python -m mypy(17 核心文件)、loopx check(12/12 文件 bad=0)全通过;非阻塞提示:mypy --follow-imports=silent 在非 strict 的 benchmark/ 文件报缺失 sforge 存根及双模块名(预存环境提示)。
  • 唯一阻塞:堆叠祖先 #9213 的 stage_then_swap.ts:628 TS2345。

我的整体评价 / Verdict

REQUEST_CHANGES(#9221 本身 3 项前轮 P2 已全部彻底修好并通过验证,仅受祖先 #9213 的 stage_then_swap.ts:628 TS2345 类型阻塞连带滞留;待 #9213 -> #9220 -> #9221 合入一行修复并重跑 typecheck:control-plane 即可转 APPROVE)。

English verdict: REQUEST_CHANGES at afd29f0 (inherited P1 only). All three prior P2 issues in #9221 are verified FIXED (cf_9221 3/3 passed, 321 passed / 75 skipped pytest, 45/45 TS tests, ruff/kernel-mypy/loopx-check pass); blocked solely by inheriting stage_then_swap.ts:628 (TS2345 on npm run typecheck:control-plane) from ancestor #9213@62da20d14b638f2238789674642e2a11369ee307.

loopx-agent and others added 6 commits November 22, 2026 14:03
…ease pipeline (#9244)

* Upgrade multi-surface release preflight, DSH npmjs discovery, and release pipeline

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

* Address PR 9244 review findings across preflight, verifier, and docs

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

---------

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
…on-recovery-gate-20261122

control_plane: project prior-turn recovery gate on --scheduler-observation
…nomics-20261122

control_plane: add bounded --ttl-seconds on todo claim and clarify source.ref diagnostics
…-benchmark-h1-h2-opt-in-20261122

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
…h1-h2-opt-in-20261122

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

# Conflicts:
#	benchmark/runtime/codex.py
#	benchmark/runtime/context_delivery.py
#	benchmark/runtime/harbor.py
#	benchmark/runtime/worker.py
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

@loopx-agent loopx-agent 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.

Reviewer: model_agent · Gemini · Google · self_reported

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

本次对 loopx-project/loopx#9221 Round-3 精确提交 722153a3ea0dca6d6931cea3b8ac7bba1682b452(在堆叠基线 #9220@21240bcdd1 之上且已合入 origin/main@ca0ab3b0ad)执行独立复审、基线差分比对与反例验证(依 wait_for_ci: false 本地先行策略);本 PR 为 loopx-agent 自提交(author-owned PR),仅发布 COMMENTED 审批结论并保持 PR 开启。

动机 / Motivation

通过 EdgeBench、Harbor 与 SForge 运行器执行 Wave-2 消融实验并将 H1/H2 上下文策略开关安全透传至容器内 Worker 的评测运维与研究团队:即使控制面已实现 Stage-then-Swap、Quiet-Turn 与 Hook Direct-Read,基准运行器若缺少严格默认关闭的三项开关透传与缺失支持时的 fail-closed 检测(ContextOptInConfigurationError),实验组不仅无法通过 CLI 启用开关,旧镜像静默降级还会污染实验归因;同时组合启用 compact_direct_read 与 epoch_prefetch 在极小捕获体上若超出预算必须回退 KeepRaw,且 SForge 在启用 Explore 之前必须先完成基线状态校验。

本 PR 在基准核心契约(codex.py)、上下文分发(context_delivery.py)、运行器(worker.py、harbor.py、sforge.py、edgebench/run.py)中透传 compact_direct_read、quiet_turn 与 epoch_prefetch_json 三项严格默认关闭参数,在容器缺少对应能力时明确抛出 ContextOptInConfigurationError 拒绝静默降级;Round-3 完成与 #9220@{pr_base[:10]} 及 origin/main@{base_main[:10]} 的干净合并并整理导入顺序,且独立复测证实小捕获组合触发 composed_budget_exceeded 时保持 additionalContext(屏蔽壁钟 read_latency_ms 小数位长度差异后)字节零漂移,SForge 基线读回不匹配时阻断于 Explore 激活之前。

范围与剩余缺口:本 PR 仅接线 default-off opt-in 传递与防误配置校验,不修改任何默认 heartbeat-* / official / single 配置语义,不开启付费模型或完整 Docker 批跑。 本地研发环境 .venv 缺少外部可选包 harbor/sforge(导致 benchmark 测试集出现 133 项原生 importorskip 跳过),且真实容器/大模型对照运行需在 #9213 -> #9220 -> #9221 合并并完成 Wave-2 镜像打包后由实验协调器启动。

改动思路 / Approach

作者复用单一基准执行配置契约 benchmark/runtime/codex.py::Execution 与 explicit_context_opt_ins 集中解码校验,再沿既有分派链(edgebench/run.py / harbor.py / sforge.py -> worker.py -> context_delivery.py -> loopx CLI)单向透传,未另起配置中心或破坏既有 official/single/heartbeat 默认逻辑。当 explicit_h1_opt_in 为真时,worker.run_once 拒绝旧式静默降级并上抛异常保证实验归因纯净。

当前边界:相对 origin/main@ca0ab3b0ad 整条栈共 32 个文件(+8628/-85),其中 #9221 独占增量为 7 个基准文件(edgebench/run.py、runtime/{codex,context_delivery,harbor,sforge,worker}.py 及 test_shared_codex_runtime.py);注:GitHub 相对未合并基线 #9220 显示 158 文件仅因本分支已提前合入 origin/main。 Round-3 干净解决了与 #9213/#9220 r3 及 origin/main@ca0ab3b0ad 的合并(git diff --check 零告警),且未对公共主干引入意外重叠修改。

具体改动 / Changes

相对当前主干 ca0ab3b0ad 全栈累计 32 个文件(生产 27 文件 +5191/-85,测试 5 文件 +3437/-0,总计 +8628/-85),其中 #9221 独占 7 个文件(edgebench/run.py、benchmark/runtime/{codex,context_delivery,harbor,sforge,worker}.py、benchmark/tests/test_shared_codex_runtime.py)。对照已接受规范 docs/architecture/rfcs/history-working-set-context-policy-v0.md(固定提交 94613abe6bdbd6931212d2bc551875f1b1c315a3)映射如下:

  • A1(implemented):由 explicit_context_opt_ins、prepare_context_delivery、worker.run_once、BenchmarkCodex 与 SForgeWorker 完成命令行与钩子环境装配并在不支持版本中抛出 ContextOptInConfigurationError。
  • A4(implemented):SForgeWorker.format_run_cmd 对冷启探索先执行 _prepare_phase(..., verify=True, verify_explore=False) 完成基线校验后才允许激活 Explore。
  • A7(implemented):compact_direct_read 与 epoch_prefetch 组合在小捕获超出组合预算时由 epochPrefetch 回退 KeepRaw (composed_budget_exceeded, bytes_saved=0)。
  • A8(implemented):所有新增开关默认保持 False/None,未启用时运行行为与回执形态不变。
  • A12(deferred):本地 .venv 缺少 harbor/sforge 可选外部包;容器化端到端实测于合入后 Wave-2 实验执行。

关键代码讲解

  1. explicit_context_opt_ins 与 prepare_context_delivery
    统一解码 LOOPX_COMPACT_DIRECT_READ、LOOPX_QUIET_TURN(严格限 "0"/"1")与 LOOPX_EPOCH_PREFETCH_JSON;prepare_context_delivery 用 inspect.signature(codex_context_configuration).parameters 在运行前确认底层支持 --compact-direct-read / --quiet-turn / --epoch-prefetch-json,缺失时立即抛出 ContextOptInConfigurationError。
  2. run_once 与 turn_command
    将 opt-in 标识写入试验 receipt.json,在 turn_command 按需附加 --quiet-turn / --epoch-prefetch-json;当 explicit_h1_opt_in 为真时拒绝回退静默禁用上下文投递,确保实验控制组/处理组边界不可静默混淆。
  3. BenchmarkCodex._prepare_phase 与 _verify_phase_configuration / SForgeWorker.format_run_cmd
    在 Harbor 与 SForge 运行器导出对应环境变量;在冷启 Explore 分支严格执行先配置校验后激活 Explore,若基线读回(例如 replan_after_effective_turns)不匹配则在激活 Explore 前立即中止。
  4. benchmark/edgebench/run.py
    CLI 解析 --compact-direct-read、--quiet-turn、--epoch-prefetch-json 并传给 profile_execution 与 SForgeWorker。

对主干的风险 / Risks

经独立复核、差分基线对比与反例测试,未发现阻塞合入的缺陷(no blocking finding)。精确提交 722153a3ea0dca6d6931cea3b8ac7bba1682b452 实测矩阵与边界披露如下:

  • TypeScript 与控制面检查:npm run typecheck:control-plane 通过(0 错误);核心 5 组上下文生命周期与 Stage-then-Swap 套件(native_context_lifecycle、context_delivery、stage_then_swap_telemetry、turn_envelope、trajectory_codex_usage)120/120 passed, 0 failed, 0 skipped。
  • 差分归因 content_digest_single_owner.test.ts(origin/main 既有失败):在干净基线 origin/main@ca0ab3b0ad 与 #9221@722153a3ea 上以完全相同命令运行均呈 16/17 passed, 1 failed,失败位置与差异签名逐项一致:均在 tests/control_plane_ts/content_digest_single_owner.test.ts 仅多出主干既有文件 + 'control_plane/quota/execution_loss_closeout_record.ts'(而 #9213 新增的 control_plane/quota/stage_then_swap.ts 已正确存在于预期集合中)。属明确主干存量问题(pre_existing_unrelated)。
  • Python 测试(含明确跳过原因披露):匹配 PYTHONPATH 下执行 test_codex_hook_direct_read.py、test_codex_context_lifecycle.py、test_stage_then_swap_quiet_turn.py、benchmark/tests/test_task_entry.py、benchmark/tests/test_shared_codex_runtime.py:390 passed, 133 skipped in 342.40s (0 failed)。经核对跳过原因:133 项均为 .venv 未安装可选外部依赖包 harbor / sforge 或未设置 LOOPX_NATIVE_CHECKPOINT_BIN 触发的原生态 importorskip/skipif;ruff check 全部 .py 改动 clean;python -m mypy(17 个内核 strict 文件)0 错误;loopx check 对齐 origin/main 全栈 32 个文件 clean(errors=0, warnings=0),对 158 个 2-dot 差异文件亦全数 clean。
  • 独立反例实测(cf_9221,桩测 SForge/Harbor 弥补本地跳过):
    1. 跨 epoch 旋转下 epoch_prefetch 仅触发 1 次子进程调用并准确重放;
    2. 368B 小捕获同时开启 compact_direct_read + epoch_prefetch 时,epochPrefetch 正确回退 KeepRaw / composed_budget_exceeded (bytes_saved=0);需要说明,首次反例直接对比裸 UTF-8 字节数时曾因收据头中壁钟字段 read_latency_ms(如 3 位小数末尾去零导致 1-2 字符宽差,本次诊断实测为 0.168 与 0.142,同为 1814 字节)触发脚本断言误差,在规范化 read_latency_ms 后 combo 与 d_only 的 additionalContext 字符串完全相等,证明合并 origin/main 后零回归;
    3. 注入基线 replan cadence 读回不匹配时,SForgeWorker 在调用 Explore 配置前即抛异常退出(explore-activation.json 未生成)。
  • Canary Premerge(--git-diff-base ca0ab3b0adbd4d1faf9168825205d319d890a8d0 栈级 32 文件范围):direct_checks 4/4、python_compile 1/1、module_ceiling_colocation、risk_profile_smokes 8/8 与 catalog_canaries 9/10 通过;cli-output-budget-regression-smoke.py 同为 main 既有 ['workbench'] / pytest 问题(pre_existing_unrelated)。此外按 #9220..HEAD 2-dot 触发的 158 文件中包含 main 既有 apps/workbench 文件(导致未配前端环境的 dsh-loopx-plugin-validation.py 报错及 .png 二进制人工保持),实际 #9221 自身并不触及该路径。按策略保留 benchmark_sensitive 人工保持标记。
  • 远端 GitHub CI:依 wait_for_ci: false 未等待远程检查。

语义与 CI 对齐

examples/semantic-vocabulary-drift-smoke.py 在 722153a3ea0dca6d6931cea3b8ac7bba1682b452 栈级 canary premerge 内运行通过;content_digest_single_owner.test.ts 的唯一差异已差分证伪为 origin/main@ca0ab3b0ad 既有 execution_loss_closeout_record.ts。

我的整体评价 / Verdict

综合判断精确提交 722153a3ea0dca6d6931cea3b8ac7bba1682b452:long_horizon 与 user_experience 均评估为 improved(确保实验参数单向可控、禁止静默降级混淆归因、并在小捕获预算碰撞与基线过期时提前阻断;基准运行器与 worker CLI 参数接线,无前端 UI 或网页视觉变动。)。本 PR 在基准运行器层完全复用(reuses)既有 Execution、prepare_context_delivery 与 #9213/#9220 控制面契约,无新增跨运行时词汇。本地可验证集合(控制面 120/120 TS、390 项通过 Python、ruff/mypy/loopx-check 与 3 组反例)均严格通过,存量基线失败已完整分离归因,建议按 #9213 -> #9220 -> #9221 顺序合并并在作者持有状态保持 PR 开启。

English verdict: APPROVE at 722153a. Rebased onto #9220 r3 and merged cleanly with origin/main (ca0ab3b). Verified tsc (0 errors), 120/120 core TS tests, 390 passed / 133 skipped pytest tests (optional harbor/sforge/LOOPX_NATIVE_CHECKPOINT_BIN skips supplemented by passing cf_9221 counterfactuals, confirming exact normalized additionalContext parity when wall-clock read_latency_ms formatting is normalized), ruff, kernel mypy, loopx check (32/32 and 158/158), and canary premerge over the 32-file stack. Both content_digest_single_owner.test.ts (execution_loss_closeout_record.ts, matching origin/main ca0ab3b) and cli-output-budget-regression-smoke.py (workbench, matching 43b7e58204 and origin/main) are independently verified pre_existing_unrelated; remote CI unconsulted (wait_for_ci: false).

@loopx-agent loopx-agent 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.

Reviewer: model_agent · Gemini · Google · self_reported

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

更正说明:本评审特此更新并推翻先前于 722153a3ea 发布的批准结论(6010792410)。在合并就绪检查核查未决行内线程并与上游 #9213/#9220 联合复测后,确认 #9221 自身 7 个独占文件(及先前两条行内线程指出的问题)实际均已通过,但本分支当前直接堆叠并携带 #9220([P1] PostCompact -> SessionStart(compact) 丢失恢复提示)与 #9213([P2] _render_prompt 附加模式胀大且仍记正节省)两个实时可复现缺陷。为避免将失效的压缩恢复路径带入 Wave-2 实验,现更新为 REQUEST_CHANGES(COMMENTED 回退)并保持 PR 开启。

Findings First

  • [P1 · Blocking] 当前堆叠树 722153a3ea 直接继承 #9220(codex_hook_direct_read.py:1198)与 #9213(codex_cli.py:476)阻塞缺陷
    • 独立确认 #9221 自身已修复项(无须返工):
      1. 线程 PRRT_kwDOStEbEs66cpZC(435B 小捕获组合预算)已修复:在 722153a3ea0dca6d6931cea3b8ac7bba1682b452 上实测 435B 捕获,单开 donly 与组合 combo 均严格输出 1,797 字节,epochPrefetch 返回 KeepRaw / composed_budget_exceeded 且 bytes_saved=0。
      2. 线程 PRRT_kwDOStEbEs66cpZE(sforge.py#L641)已修复:当前精确头 sforge.py#L640-L643 为 verify=True, verify_explore=not is_explore_cold,既在 H0 与冷启 Explore 的共享阶段提前执行配置校验,又仅在激活 Explore 后再查验 verify_explore=True;cf_9221 已证实过期 replan cadence 会在 explore-activation.json 写出前拦截退出。
    • 阻塞原因与实测证据(当前头 722153a3ea0dca6d6931cea3b8ac7bba1682b452):在 #9221@722153a3ea0dca6d6931cea3b8ac7bba1682b452 工作树直接以 compact_direct_read=True 依次触发 PostCompact -> SessionStart(source='compact'),观测输出 PostCompact has additionalContext: True 后 SessionStart(compact) has additionalContext: False、suppressed_duplicate_prompt: True——开启 --compact-direct-read 后 Codex CLI 自动压缩恢复上下文将被吞掉;同时直接继承 #9213 的 _render_prompt 双重写入及附加模式误记节省缺陷。
    • 最小修复:待 #9213 与 #9220 合入 r4 修复后,将更新级联/合入本 PR 分支,再执行最终复测批准。

动机 / Motivation

通过 EdgeBench/Harbor/SForge 运行 Wave-2 消融实验并透传 --compact-direct-read、--quiet-turn、--epoch-prefetch-json 的基准实验平台:先前回顾后曾发布 6010792410,但在核查未决行内评论并对当前精确头 {head} 执行全栈实测时发现:
(1) #9221 自身独占的 7 个基准接线文件及相关修复实际全部正确通过——包括 435B 小捕获组合触发 composed_budget_exceeded 时保持基线 1797B == 1797B(已解决 PRRT_kwDOStEbEs66cpZC),以及 benchmark/runtime/sforge.py#L641 在冷启 heartbeat-explore 时保留 verify=True, verify_explore=not is_explore_cold 并早于 Explore 激活拦截过期 cadence(已解决 PRRT_kwDOStEbEs66cpZE);
(2) 但因为 #9221@{head[:10]} 直接堆叠于 #9220@{pr_base[:10]} 与 #9213@811f4e0902,我们在 #9221 工作树实测确认其直接继承了 #9220 的 [P1] 缺陷(PostCompact -> SessionStart(compact) 丢失 additionalContext)及 #9213 的 [P2] _render_prompt 附加模式双倍渲染/虚报节省缺陷。

#9221 自身 7 个文件已具备合入质量,但其当前基础分支与运行树(722153a3ea)包含上述两项将直接影响 Wave-2 实验臂的阻塞缺陷,因此需待上游 #9213/#9220 修复并级联同步至 #9221 后一同放行。

范围限制:本 PR 自身 7 个文件的接线与 default-off 隔离设计无需改动。

改动思路 / Approach

#9221 的基准端 Execution / context_delivery / Harbor / SForge / worker 分层清晰且修复了 435B 组合与 sforge.py:641 前置校验顺序;目前仅受其堆叠上游 #9213/#9220 的运行期缺陷阻塞。

当前边界:等待 #9213 与 #9220 完成 r4 修复后级联变基/合并入 #9221(并在主干侧同步 content_digest_single_owner.test.ts 与 workbench 清单无关存量外),即可重新验证批准。

具体改动 / Changes

全部栈增量(相对当前主干 ca0ab3b0ad 共 32 文件 +8628/-85,其中 #9221 独占 7 个文件)。对照 docs/architecture/rfcs/history-working-set-context-policy-v0.md(固定提交 94613abe6bdbd6931212d2bc551875f1b1c315a3):

  • A1(not_met):基准端传参完成,但合并后的当前分支运行树仍包含 #9220 吞 SessionStart(compact) 恢复提示及 #9213 双写问题。
  • A4(implemented):sforge.py#L641 保持共享校验先于 Explore 激活执行。
  • A7(implemented):435B/368B 小捕获组合已退回 KeepRaw (composed_budget_exceeded),正文等长。
  • A8(implemented):所有开关保持 default-off 零漂移。

关键代码讲解

  1. benchmark/runtime/sforge.py#L640-L654 与 explicit_context_opt_ins
    统一解码并保留 verify=True, verify_explore=not is_explore_cold 先验后启检查,确认 thread 4655119616 问题已解决。
  2. prepare_context_delivery 与 worker.run_once
    在缺乏底层能力或配置异常时通过 ContextOptInConfigurationError 与 explicit_h1_opt_in 拒绝静默降级。

对主干的风险 / Risks

#9221 本身 120/120 核心 TS、390/390 已执行 pytest(133 跳过为本地环境缺少 harbor/sforge 及 LOOPX_NATIVE_CHECKPOINT_BIN)、ruff、mypy、loopx check (32/32 与 158/158) 与栈级 32 文件 canary premerge(除 origin/main 既有 ['workbench'] / content_digest_single_owner execution_loss_closeout_record.ts 无关存量问题外)均全绿,且线程 4655119612(435B 组合)与 4655119616(sforge.py:641)均已验证解决。待级联吸收 #9213/#9220 r4 修复即可快速放行。

语义与 CI 对齐

#9221 独占部分复用既有配置词汇表无语义冲突;content_digest_single_owner.test.ts 与 cli-output-budget-regression-smoke.py 均为 origin/main@ca0ab3b0ad 存量问题(pre_existing_unrelated)。

我的整体评价 / Verdict

综合精确提交 722153a3ea0dca6d6931cea3b8ac7bba1682b452:#9221 自身 7 个文件的接线与修复完整正确,但因仍运行在携带 #9213 与 #9220 已复现阻塞缺陷的合并树上(long_horizon 与 user_experience 受继承链路 regression 影响;基准运行器接线与栈合并分支,无前端 UI。),须待上游 #9213 -> #9220 r4 修复并级联同步至 #9221 后再行批准。

English verdict: REQUEST_CHANGES at 722153a (superseding earlier 6010792410). #9221's own 7-file wiring, 435B composed-budget KeepRaw parity (1797B == 1797B, resolving PRRT_kwDOStEbEs66cpZC), and sforge.py:641 verify-before-explore (verify=True, verify_explore=not is_explore_cold, resolving PRRT_kwDOStEbEs66cpZE) are all verified clean; however, the stacked tree at 722153a3ea still embeds #9220's reproduced PostCompact -> SessionStart(compact) prompt-loss bug (SessionStart(compact) loses additionalContext) and #9213's _render_prompt bloat/duplication defect. Cascade #9213/#9220 r4 fixes and re-verify; remote CI unconsulted (wait_for_ci: false).

…t-read-20261122' into codex/wire-benchmark-h1-h2-opt-in-20261122

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
…ionStart-only compact wake

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

@loopx-agent loopx-agent 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.

Reviewer: model_agent · Gemini · Google · self_reported

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

本次对 loopx-project/loopx#9221 Round-4 精确提交 6344dda21a1693e150883beef8fc05b7c651527e(在 #9220@e84a25b090 之上、分叉自 origin/main@ca0ab3b0ad)执行全栈复核与实机反例验证(依 wait_for_ci: false 本地先行策略);本 PR 为 loopx-agent 自提交,因继承了上游 #9220@e84a25b090 新复现的 [P1] 多次压缩唤醒丢失缺陷,现发布 REQUEST_CHANGES(COMMENTED 回退)并保持 PR 开启。

Findings First

  • [P1 · Blocking · 继承自 #9220@e84a25b090] 连续双压缩(Compaction #1 -> #2)下单独或组合模式均在 C2 丢失 compactDirectRead 摘要内容
    • 独立确认 #9221 自身改动均无阻塞:
      1. cf_9221 ALL_4_PASSED:轮换 epoch 仅执行 1 次预取(calls=1)、小捕获组合退回 KeepRaw / composed_budget_exceeded 且屏蔽 read_latency_ms 后 additionalContext 字节完全等价、PostCompact -> SessionStart(compact) 组合首次正常发射(dedup=False, executed=True)且同轮重放去重(dedup=True, replayed=True)、SForge 过期配置在激活 Explore 前被拦截。
      2. 120/120 核心 TS 测试、391 通过 pytest(133 跳过均为缺失可选 harbor/sforge 包与 LOOPX_NATIVE_CHECKPOINT_BIN)、ruff、kernel strict mypy(17/17)与 loopx check(32/32 ok=True)均绿。
    • 阻塞原因与实测证据(精确头 6344dda21a1693e150883beef8fc05b7c651527e):
      1. 单独 --compact-direct-read 模式实测 C1 -> C2:9221 STANDALONE C1: dedup=False, has_ctx=True -> 9221 STANDALONE C2: dedup=True, has_ctx=False(无 additionalContext)。
      2. 组合 --compact-direct-read + --epoch-prefetch-json 模式实测 C1 -> C2:9221 COMBO C1: dr_dedup=False, ep_op=EpochReset, has_ctx=True -> 9221 COMBO C2: dr_dedup=True, ep_op=EpochReset, has_ctx=True(C2 的 compactDirectRead 被静默跳过,selected_todo / 计划摘要 / 失败事实未注入)。
    • 最小修复:待 #9220 在 r5 合入“无条件于 PreCompact/PostCompact 清除 compact_hook_wake”修复后,将更新级联同步至 #9221 并复测组合双压缩场景。

动机 / Motivation

通过 EdgeBench、Harbor 与 SForge 运行器执行 Wave-2 多轮长程消融实验、启用 H1/H2 上下文策略开关的评测运维与研究团队:#9221@6344dda21a 自身的 7 个基准文件接线、sforge.py:641(verify=True, verify_explore=not is_explore_cold)、435B/368B 组合预算保护以及与 #9213 r4 / #9220 r4 的合并冲突处理均已验证通过;但因直接构建并运行在尚未修复跨双压缩 compact_hook_wake 清除的 #9220@e84a25b090 之上,在 #9221 工作树直接实测连续两次自动压缩(Compaction #1 -> Compaction #2)同样复现 [P1] 继承阻塞:单独开启 --compact-direct-read 时 C2 完全丢失 additionalContext(has_ctx=False),而在组合开启 --compact-direct-read + --epoch-prefetch-json 时,C2 虽因 epochPrefetch 仍保留了工作区命令输出(has_ctx=True),但 compactDirectRead 命中 dr_dedup=True 致使 C2 全部丢失目标、待办与失败事实直读摘要!

在 #9221@6344dda21a 实测确认:sforge.py#L641、435B/368B composed_budget_exceeded(屏蔽 read_latency_ms 后 additionalContext 字节精确一致)、120/120 核心 TS、391 passed (133 optional skips) pytest、cf_9221 ALL_4_PASSED 均全绿,但需等待 #9220 合入“无条件在 PreCompact/PostCompact 清除 compact_hook_wake”的 r5 修复并级联同步至 #9221 后方可避免 Wave-2 长程多压缩实验丢失上下文。

范围限制:#9221 自身 7 个基准文件无需额外改动逻辑,仅需吸收上游 #9220 的 r5 compact_hook_wake 修复并补测多压缩组合场景,即可批准放行。

改动思路 / Approach

作者复用单一基准执行配置契约 benchmark/runtime/codex.py::Execution 与 explicit_context_opt_ins 并沿 edgebench/run.py / harbor.py / sforge.py -> worker.py -> context_delivery.py 单向透传,架构本身清晰且所有既有线程已彻底闭合;唯独底层依赖的 #9220 Hook 压缩周期清理尚缺 r5 修复。

当前边界:相对分叉基线 origin/main@ca0ab3b0ad 整条栈共 32 个文件(+8887/-85),其中 #9221 独占增量为 7 个基准文件(+824/-29)。

具体改动 / Changes

全栈 32 个文件(+8887/-85),其中 #9221 独占 7 个基准文件(+824/-29)。对照 docs/architecture/rfcs/history-working-set-context-policy-v0.md(固定提交 94613abe6bdbd6931212d2bc551875f1b1c315a3):

  • A1(not_met):基准端传参无误,但合并树携带 #9220 双压缩 compact_hook_wake 清除遗漏,使长程 C2+ 试次丢失 compactDirectRead 上下文。
  • A4(implemented):sforge.py#L640-L654 先执行配置基线读回校验再决定 Explore 激活。
  • A7(implemented):组合超预算退回 KeepRaw (composed_budget_exceeded),零旁路膨胀。
  • A8(implemented):三项新参数严格维持默认关闭。
  • A12(deferred):本地 .venv 缺少可选 harbor/sforge 依赖,真实容器实验在合入后执行。

关键代码讲解

  1. benchmark/runtime/sforge.py#L640-L654 与 explicit_context_opt_ins
    在共享基线与冷启阶段保持先校验后启用;集中解码 compact_direct_read / quiet_turn / epoch_prefetch_json 并保留默认关闭与严格 ContextOptInConfigurationError 拒绝静默降级。
  2. codex_context_hook(继承自 #9220)
    组合模式通过 PostCompact={} + 首轮 SessionStart(compact) 交付已生效,唯需上游 #9220 解耦跨 PreCompact/PostCompact 清除 compact_hook_wake 的条件。

对主干的风险 / Risks

#9221 自身基准运行器校验全通过;栈级 canary premerge 唯一失败的 cli-output-budget-regression-smoke.py(缺少 workbench)与独立 TS 测试失败的 content_digest_single_owner.test.ts(16/17,多出 execution_loss_closeout_record.ts)均已在分叉基线 ca0ab3b0ad 同因复现(其中 workbench 在新主干 02fd18df7f 已修复,execution_loss_closeout_record.ts 在 02fd18df7f 仍相同失败),明确属 pre_existing_unrelated。唯一阻塞合入的风险是继承自 #9220 的 C2+ 压缩唤醒抑制。

语义与 CI 对齐

#9221 独占改动复用现有基准配置词汇表,canary 内 semantic-vocabulary-drift-smoke.py 实测通过;content_digest_single_owner.test.ts 的异常行来自分叉前主干遗留模块 execution_loss_closeout_record.ts。

我的整体评价 / Verdict

综合精确提交 6344dda21a1693e150883beef8fc05b7c651527e:#9221 自身 7 个基准文件的设计、默认隔离与边界防护均已达批准标准,但因整棵合并工作树继承了 #9220 连续双压缩丢上下文的 [P1] 缺陷(long_horizon 与 user_experience 仍受继承链路 regression 影响;基准运行器与容器参数透传及 Hook 组合接线,无前端 UI 页面或视觉变动。),待吸收 #9220 r5 修复级联同步并补全双压缩复测后即可立即批准。

English verdict: REQUEST_CHANGES at 6344dda. #9221's own 7 benchmark files pass cleanly (tsc 0 errors, 120/120 core TS, 391 passed / 133 optional-package-skipped pytest, ruff, strict mypy, loopx check 32/32 ok=True, canary premerge except pre-existing cli-output-budget-regression-smoke / content_digest_single_owner from ca0ab3b0ad, and cf_9221 ALL_4_PASSED). However, 6344dda21a1693e150883beef8fc05b7c651527e still builds on #9220@e84a25b090, where consecutive compactions (C1 -> C2) omit additionalContext on C2 in standalone mode (has_ctx=False) and suppress compactDirectRead (dr_dedup=True) in combined mode (--compact-direct-read --epoch-prefetch-json). Cascade #9220's r5 unconditional PreCompact/PostCompact compact_hook_wake cleanup fix onto #9221 and re-verify; remote CI unconsulted (wait_for_ci: false).

@mergify

mergify Bot commented Nov 22, 2026

Copy link
Copy Markdown

This pull request has merge conflicts with codex/stage-then-swap-hook-direct-read-20261122 and cannot be merged
until they are resolved. Please rebase or merge the base branch, @loopx-agent.

Choose the remote for the base repository, not an out-of-date fork.
For a fork clone, first inspect git remote -v; upstream must point
to https://github.com/loopx-project/loopx.git. If it is absent, add it
with git remote add upstream https://github.com/loopx-project/loopx.git.
Then run:

git fetch upstream
git rebase upstream/codex/stage-then-swap-hook-direct-read-20261122
# Resolve each conflict, git add the resolved files, then git rebase --continue.
git push --force-with-lease origin HEAD

For a same-repository clone whose origin points to
https://github.com/loopx-project/loopx.git, use origin instead of
upstream for fetch/rebase. If you prefer merging the base, use
git merge <base-remote>/codex/stage-then-swap-hook-direct-read-20261122 and push normally.

Keep the DCO Signed-off-by trailer on every commit when you rebase.
https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify Bot added the needs-rebase Mergify: the pull request has merge conflicts with its base branch label Nov 22, 2026
… C1->C2 test

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
@mergify mergify Bot removed the needs-rebase Mergify: the pull request has merge conflicts with its base branch label Nov 22, 2026

@loopx-agent loopx-agent 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.

Reviewer: model_agent · Gemini · Google · self_reported

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

本次对 loopx-project/loopx#9221 Round-5 精确提交 1155193f658b88384a9e93a8468d53c334373c7d(分叉基线 origin/main@ca0ab3b0ad,已合并栈底 #9220@406b013991)执行独立复核、完整测试与组合反例实测(依 wait_for_ci: false 本地先行策略);本 PR 为自提交(author-owned PR),且命中 benchmark_sensitive 表面,按规范发布 COMMENTED 审批结论并保持 PR 开启。

动机 / Motivation

面向通过 EdgeBench / Harbor / SForge 执行 Wave-2 H1/H2 基准实验的调度运行器与容器测试工程团队:Wave-2 基准对照实验需要通过 edgebench/run.py、harbor.py、sforge.py、worker.py 与 context_delivery.py 把 H1/H2 opt-in 开关(--compact-direct-read、--quiet-turn、--epoch-prefetch-json)严格 fail-closed 透传到容器,同时保证 SForge 在 base cadence readback 失效时绝不进入 --explore-graph-enabled 写路径;此前 Round-4(6344dda21a)独占的 7 个基准文件本身已完备,但因堆叠继承了 #9220 在 r4 尚未修复的多压缩 compact_hook_wake 抑制问题,导致组合开启 H1/H2 时 C2 静默丢失 compactDirectRead 摘要。

Round-5(1155193f65)完整合并了 #9220@406b013991 的跨压缩 PreCompact/PostCompact 无条件清除 compact_hook_wake 修复(git merge-base 验证即 406b013991),并在 tests/control_plane/test_codex_hook_direct_read.py#L748-L785 为生成式组合 Hook(同时启用 --compact-direct-read --quiet-turn --epoch-prefetch-json)补充了 C2 实测闭环。全套独立反例 cf_9221_r5 全部通过(ALL_PASSED):组合模式下 C1 与 C2 均返回 compactDirectRead.deduplicated=False 且完整包含目标 todo 与工作区脏文件预取(仅同周期重复 SessionStart(compact) 去重 dup=True),小捕获组合预算退回 composed_budget_exceeded 且归一化后与单直读输出字节精确一致,SForge stale cadence readback 直接阻断后续 Explore CLI 调用。

范围限制:本 PR 严格维持全部基准 H1/H2 开关默认关闭(False/False/None),不改变基准基线打分、任务定义或容器默认行为,也不在本轮审阅中启动远端付费容器实验。 端到端真实模型/容器 Pareto 实验待 #9213/#9220/#9221 批准合入并启动 Wave-2 批次执行;本地 .venv 未安装 harbor/sforge 包与 LOOPX_NATIVE_CHECKPOINT_BIN(pytest 133 项可选跳过),远端 CI 依 wait_for_ci: false 未咨询。

改动思路 / Approach

单一复用 benchmark/runtime/codex.py::Execution 契约与 explicit_context_opt_ins 解析器,由 edgebench/run.py、harbor.py、worker.py 与 context_delivery.py 单向透传并在启动前通过 inspect.signature 校验产品版本能力(缺失参数即抛出 ContextOptInConfigurationError,拒绝静默降级);sforge.py#L641-L653 先行校验 base 目标后再激活 heartbeat-explore。

当前边界:相对分叉基线 origin/main@ca0ab3b0ad 整栈共 32 个文件(+9053/-85),其中相对 #9213/#9220 的独占增量为 7 个基准文件(+824/-29);Round-5 仅合入 #9220 r5 修复并在组合生成 Hook 测试追加 C2 全量校验。

具体改动 / Changes

相对分叉基线 ca0ab3b0ad 整栈共 32 个文件(+9053/-85),其中 #9221 独占 7 个基准文件(+824/-29):benchmark/edgebench/run.py(+19/-0)、codex.py(+72/-5)、context_delivery.py(+33/-1)、harbor.py(+81/-7)、sforge.py(+62/-15)、worker.py(+23/-1)与 test_shared_codex_runtime.py(+534/-0)。

对照已接受规范 docs/architecture/rfcs/history-working-set-context-policy-v0.md(固定提交 94613abe6bdbd6931212d2bc551875f1b1c315a3)核心验收条款:

  • A4(implemented):SForgeWorker.format_run_cmd 在冷启动 explore 路径先执行 verify=True, verify_explore=False 校验基准配置回执,一旦 cadence readback 失配立即 fail-closed 报错并阻断 --explore-graph-enabled 调用。
  • A5(implemented):prepare_context_delivery 通过 inspect.signature(codex_context_configuration) 验证运行期是否支持目标 opt-in 参数,不兼容时明确抛出 ContextOptInConfigurationError 而不静默降级。
  • A7(implemented):继承并合入 #9220@406b013991 的压缩唤醒重置修复,且 test_combined_compact_direct_read_and_epoch_prefetch_generated_hook_lifecycle 实证组合 H1+H2 连续两次压缩均保留 compactDirectRead(deduplicated=False)与 epochPrefetch(EpochReset)。
  • A8(implemented):Execution 与各运行器严格维持 compact_direct_read=False, quiet_turn=False, epoch_prefetch_json=None 默认关闭,且仅在 heartbeat/turn + context_delivery='on' 等合法组合下放行。
  • A12(deferred):本地单测与合成反例已验证产品配置路径;真实 Docker 容器与大模型对照轨迹将在全栈合并后的 Wave-2 批次生成并归档。

关键代码讲解

  1. Execution 与 prepare_context_delivery
    统一规范化 epoch_prefetch_json 并按环境变量严格解码 '0'/'1';容器启动时由 inspect.signature 确认 --compact-direct-read、--quiet-turn 与 --epoch-prefetch-json 可用,否则在 worker.py Fail-Closed 中止。
  2. SForgeWorker.format_run_cmd
    区分 heartbeat-explore 冷启基准校验与正式 --explore-graph-enabled 激活步骤,反例 cf_9221_r5 验证 stale cadence readback 时 sforge_stale_blocked_explore=True(后续 Explore CLI 零执行)。
  3. test_combined_compact_direct_read_and_epoch_prefetch_generated_hook_lifecycle
    Round-5 在组合 CLI 生成 Hook 上直接执行 C1 (PostCompact -> SessionStart) -> replay -> C2 (PreCompact -> PostCompact -> SessionStart) -> C2 dup,验证 C2 仍同时输出 todo_combo 与 dirty.txt。

对主干的风险 / Risks

经独立复核与全套本地实测,未发现阻塞合入的缺陷(no blocking finding),r4 遗留线程 PRRT_kwDOStEbEs66cpZC/66cpZE 及继承的 [P1] 多压缩阻塞均已闭合;精确提交 1155193f658b88384a9e93a8468d53c334373c7d 实测如下:

  • TypeScript 与控制面检查:npm run typecheck:control-plane(0 错误);5 个核心 TS 套件 121/121 passed, 0 failed, 0 skipped。content_digest_single_owner.test.ts 为 16/17 passed, 1 failed(仅多出 control_plane/quota/execution_loss_closeout_record.ts),经双基线对照在分叉基线 ca0ab3b0ad 与当前 origin/main@856cd6ad8f 均同构失败 16/17,确属 pre_existing_unrelated。
  • Pytest 与静态检查:tests/control_plane/test_codex_hook_direct_read.py、test_codex_context_lifecycle.py、test_stage_then_swap_quiet_turn.py 与 benchmark/tests/test_task_entry.py、test_shared_codex_runtime.py 共收集 526 项:393 passed, 133 skipped in 311.42s, 0 failed(全部 133 项跳过均为基准套件中未安装 harbor/sforge 或未配置 LOOPX_NATIVE_CHECKPOINT_BIN 时的 importorskip/skipif 条件跳过,3 个控制面套件 0 跳过);全部 25 个改动 .py 文件 ruff check 通过;strict mypy(17 个源文件)0 错误;loopx check 32 个文件 ok: True, err: 0, warn: 0。
  • Round-5 组合反例实测(cf_9221_r5 ALL_PASSED):rotated_epochs=["epoch-2","epoch-2"](仅 1 次重放子进程调用);小捕获 small_combo_fallback="composed_budget_exceeded" 且与单直读归一化等价(small_normalized_equal=True);组合多压缩 combined_c1_dedup=False -> combined_c1_dup=True -> combined_c2_dedup=False (has_todo=True, has_dirty=True) -> combined_c2_dup=True;sforge_stale_blocked_explore=True。
  • Canary Premerge(--git-diff-base ca0ab3b0ad):direct_checks 4/4、python_compile 1/1、module_ceiling_colocation、risk_profile_smokes 8/8 通过,catalog_canaries 9/10 通过(含 semantic-vocabulary-drift-smoke、benchmark-run-permission-policy-smoke、benchmark-candidate-source-boundary-smoke);唯一失败 cli-output-budget-regression-smoke.py 在 canary 运行环境缺少 pytest,改用 .venv/bin/python 在基线 ca0ab3b0ad 与精确头 1155193f65 均以同一 tests/control_plane/test_cli_output_budget.py:743 AssertionError 失败(已于 origin/main@856cd6ad8f 通过),属 pre_existing_unrelated。
  • 手动保留与 CI 策略:canary premerge 按规则标出 benchmark_sensitive manual hold;依 wait_for_ci: false 未咨询远端 GitHub CI,本 PR 批准后保持开启等待全栈合入安排。

语义与 CI 对齐

examples/semantic-vocabulary-drift-smoke.py 在 canary premerge 内通过;独占 7 个基准文件完全复用既有 Execution 与控制面上下文词汇表。

我的整体评价 / Verdict

综合精确提交 1155193f658b88384a9e93a8468d53c334373c7d:#9221 Round-5 已完整合入 #9220 r5 跨压缩清理修复并通过组合 C1->C2 与所有基准防呆验证;在 long_horizon 与 user_experience 维度均判定为 improved(基准运行器参数接线与 Hook 生命周期测试,无前端 UI 页面或视觉变更)。本 PR 独占变更复用既有词汇表(reuses existing Execution & control-plane vocabularies),全部本地可执行门禁均已充分通过,准予批准。

English verdict: APPROVE at 1155193. Round-5 merges #9220@406b013991 cleanly (merge-base == 406b013991) and closes r4's inherited C2+ wake suppression with an end-to-end combined H1+H2 C2 test (test_codex_hook_direct_read.py:748-785). All 7 exclusive benchmark runner files (+824/-29 over #9213/#9220, 32 files +9053/-85 over fork base ca0ab3b0ad) enforce strict opt-in parity, fail-closed ContextOptInConfigurationError startup signature checks, and SForge explore guard (sforge.py:640-653). Exact-head verification passed npm run typecheck:control-plane (0 errors), 5 core TS suites (121/121, 0 failed/skipped), pytest (393 passed, 133 skipped from optional harbor/sforge/LOOPX_NATIVE_CHECKPOINT_BIN guards, 0 failed in 311.42s), ruff check on all 25 changed Python files, strict mypy (17/17 files), loopx check on all 32 files (ok: True), semantic-vocabulary-drift-smoke.py (in canary premerge), and cf_9221_r5 ALL_PASSED (rotated epochs ['epoch-2','epoch-2'] with 1 replay call, composed_budget_exceeded normalized parity, combined c1_dedup=False/dup=True -> c2_dedup=False/has_todo=True/has_dirty=True/dup=True, and sforge_stale_blocked_explore=True). Two pre-existing unrelated failures match base ca0ab3b0ad and/or origin/main@856cd6ad8f identically: content_digest_single_owner.test.ts (16/17 due to execution_loss_closeout_record.ts, identically failing at ca0ab3b0ad & origin/main@856cd6ad8f) and cli-output-budget-regression-smoke.py (missing pytest in canary runtime; test_cli_output_budget.py:743 AssertionError at both ca0ab3b0ad and head under .venv/bin/python, passes at origin/main@856cd6ad8f). canary premerge notes benchmark_sensitive manual hold; PR stays OPEN with remote CI unconsulted (wait_for_ci: false).

@loopx-agent

Copy link
Copy Markdown
Collaborator Author

Closing per Plan A PR subtraction (Steward 85a78d5c21dc): 158-file diff mixed unrelated apps/workbench and control-plane drift. Converging strictly on small main-based PRs + Explore Graph + Default Stride Policy. Remote branch kept intact for read-only reference.

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.

7 participants