Skip to content

fix(runtime,benchmark): ignore Linux zombie groups and harden worker hygiene - #9243

Merged
huangruiteng merged 10 commits into
mainfrom
codex/fix-runtime-zombie-and-bench-hygiene-20261122
Nov 23, 2026
Merged

huangruiteng merged 10 commits into
mainfrom
codex/fix-runtime-zombie-and-bench-hygiene-20261122

Conversation

@loopx-agent

@loopx-agent loopx-agent commented Nov 22, 2026 •

Copy link
Copy Markdown
Collaborator

Merged revision and follow-up

This PR merged at d588d27 from head 2b16947b78a6df93f4a86d4a3fe6cdc2a4b2c960. Integration with #9176 kept the current heartbeat Turn contract and rejection of retired benchmark selectors. The final test-fixture update restored fresh/resume binding in six planning-path cases.

The remaining shared-disk finding was reproduced with a concurrent writer. #9319 fixes live headroom checks during research download and extraction. Its 318 scoped tests passed, and a real Docker comparison verified the low-space refusal, stream closure, stable-space hardlink retention and the five ordinary artifact receipts. The original verification below records its stated earlier revision.

Root-cause runtime and benchmark worker hygiene fixes:

  1. Linux zombie detection in effect_runtime._pid_is_alive:
    • Consult _linux_thread_group_is_zombie(pid) on Linux inside _pid_is_alive so unreaped all-zombie thread groups held by blocked parents do not poison runtime locator recovery or start-lock holder checks; also reap exited direct children if they transition to zombie before _stop_effect_runtime exits.
  2. Wake failure receipt persistence & core-dump / stderr observability:
    • Guard heartbeat_host_failure(wake, receipt) in benchmark/runtime/worker.py with try/except Exception (recording host_failure_record_error) so a secondary failure recording the host error does not suppress the final wake receipt.
    • Disable POSIX core dumps (RLIMIT_CORE soft limit 0) in scripts/external_scheduler_worker.py.
    • Use the existing CappedProcessResult stderr field and log bounded stderr_tail on wake_failed in scripts/external_scheduler_worker.py.
  3. Checkpoint artifact exclusions & SForge research hygiene:
    • Support validated component_exclusions on probe and capture in checkpoint_artifacts.ts (never on verify/materialize, keeping manifest schema invariant) and pass RESEARCH_EXCLUDE_PATTERNS (*.raw.gz, confirmed ELF or Mach-O dumps named core or core.*, target/, .cargo-target/) for the runner-owned benchmark_research component at its reserved source path across checkpoint.py, checkpoint_wake.py, and benchmark/edgebench/checkpoint_worker.py.
    • Set the default CARGO_TARGET_DIR in the SForge worker and its existing shell profile write. Preserve explicit image overrides.
    • Enforce a 10 GiB free-disk floor before and during "research" archive spooling/extraction in sforge_backend.py (recording explicit insufficient_host_disk_headroom diagnostics in artifact-collection.json and filtering ephemeral dumps).
  4. Opt-in runtime PATH & claim-TTL forwarding:
    • Preserve existing LOOPX_NODE_DIR/bin, Path(LOOPX_CLI).parent, and LOOPX_BENCHMARK_PATH_PREPEND dirs in codex.process_environment without leaking ambient host PATH.
    • Support opt-in claim_ttl_seconds / LOOPX_BENCHMARK_CLAIM_TTL_SECONDS (1..86400) in codex.py, harbor.py, sforge.py, and worker.py, forwarding --ttl-seconds guidance compatible with control_plane: add bounded --ttl-seconds on todo claim and clarify source.ref diagnostics #9225 while keeping default configs byte-identical when unset.

Review repairs

  • Inspect each archive name against its actual data, including hardlinks. If the data-bearing name is filtered, extract one retained name as a regular file and link the remaining retained names to it. This preserves paths, bytes and disk accounting in either archive order.
  • Compose the SForge Cargo default in the shared installer’s existing profile write. The checkpoint declaration retains its failure handling. Updated the readiness test double to implement the provider’s existing registration contract.

Verification

Reviewed head 760a92577a871b132697aba0d9a9583b559c1b81 against 09eadec703b4f0294b9abcbc296f759ca3359d8f. The GitHub and local diffs both show 21 changed files.

  • Ten affected Python test modules with the native provider dependencies installed: 854 passed, 49 skipped. Two Node suites: 24 passed. TypeScript typecheck, Ruff, mypy and the bilingual RFC check passed.
  • A disposable Linux Docker container exercised native SForge terminal collection. The collection receipt reported success, both evidence names and their shared inode survived, and the confirmed core dump name was absent. Both archive member orders also passed their regression cases. The defective candidate failed both cases.
  • A real Linux child-process probe returned live=true for the running control on base and head. For an exited, unreaped child, base returned true and head returned false. Unset-TTL configuration was byte-identical on base and head (635 bytes). Bash readback verified that the Cargo profile preserved explicit overrides.
  • Exact-head premerge canary: 6 direct checks, 10 catalog checks and 8 risk-profile checks, zero automated failures. The benchmark_sensitive manual-review hold was evaluated using the native collection, process and checkpoint evidence. The public boundary scan found zero errors and one non-literal credential-reference warning.
  • Low-disk refusal was tested with controlled inputs. End-to-end model runs and benchmark scoring were outside this qualification.

…hygiene

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
…bie-and-bench-hygiene-20261122

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

# Conflicts:
#	benchmark/runtime/harbor.py
@mergify

mergify Bot commented Nov 22, 2026

Copy link
Copy Markdown

This pull request has merge conflicts with main 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/main
# 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>/main 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 needs-rebase Mergify: the pull request has merge conflicts with its base branch and removed needs-rebase Mergify: the pull request has merge conflicts with its base branch labels 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#9243 精确提交 55c8032c80f91134c2e23ff6c7b0ca73ed796025(合入基线 origin/main 0814f04e9456899600f3a3c4efccfd7775382cd8)进行独立源码审阅、反例验证与本地检验(依 wait_for_ci: false 本地先行策略);本 PR 为 loopx-agent 自提交(author-owned PR),仅发布 COMMENTED 审批结论并保持 PR 开启。

动机 / Motivation

面向在 Linux 容器与外部调度器上运行长时评测及恢复守护的运行器与控制面调用方:此前在 Linux 容器运行环境下,当短生命 CLI 派生出的守护进程退化为孤儿全僵尸线程组时,kill(pid, 0) 仍报告进程存活,从而持续阻塞 effect_runtime 定位恢复与锁回收;同时 worker.run_once 若在 heartbeat_host_failure 解析阶段抛错会阻止 (wake / receipt.json) 落盘、子进程崩溃可能在 /tmp 留下数 GB core 文件,且研究目录中的 *.raw.gz 与 target/ 目录会撑爆检查点归档及宿主机磁盘空间。 该 PR 在 Linux 上让 _pid_is_alive 将全僵尸线程组视为已终止并尽早回收已退出的直接子进程,保障异常情况下 receipt.json 必然写入,在外部调度器关闭 POSIX RLIMIT_CORE 并在 wake_failed 时保留末尾 stderr 诊断,为 checkpoint_artifacts probe/capture 引入受白名单与路径防穿越校验的 component_exclusions(保持 verify 严格全量一致)并在 SForge 容器回收中强制 10 GiB 磁盘余量下限与 CARGO_TARGET_DIR 隔离,同时提供严格默认关闭的可选 PATH 前置与 --ttl-seconds 续约参数转发。 本 PR 不修改 checkpoint 清单摘要格式、verify/materialize 校验口径,也不改变未传 claim_ttl_seconds 时的默认运行器配置与调度决策逻辑。

改动思路 / Approach

作者严格在各既有责任边界内就地加固:effect_runtime.py 只读取 /proc//task/*/stat 并在全部线程均为 Z 时判定终止(保留仍在写盘的非僵尸线程组安全拦截);checkpoint_artifacts.ts 将 component_exclusions 严格限制在 probe 与 capture 的源观察阶段,verify 与 materialize 仍禁止传入并维持 sealed manifest 签名不可变;worker.py 用显式异常捕获保证 receipt.json 持久落盘,sforge_backend.py 在 _extract_artifact_archive 抽取前与落盘流中双重检查 10 GiB 磁盘下限,codex.py 与 harbor/sforge 保持 claim_ttl_seconds 默认为 None 零行为漂移。 当前 PR 边界为运行时僵尸进程识别、worker 异常与 core-dump 诊断加固、research 检查点暂态产物过滤、10 GiB 磁盘保护及可选 PATH/TTL 透传,与其它实验调度或模型上下文 PR 零文件重叠。

具体改动 / Changes

全部 21 个文件相对 origin/main 共 +744 / -29 行(含 7 个测试文件)。未修改既有 RFC 规范文件,对应运行环境工程加固归为无独立书面规范(no written specification exists beyond existing contract invariants);已核对全部 21 个改动文件与并行中的其它工作分支无文件交集。

关键代码讲解

  1. _pid_is_alive、_linux_thread_group_is_zombie 与 _stop_effect_runtime
    在 Linux 平台读遍 /proc/<pid>/task/*/stat 状态:仅当进程组非空、全部线程状态为 Z 且无新出现线程时才返回 False,避免孤儿僵尸 leader 卡死锁/定位恢复,而仍有活线程写入的混合线程组仍会受阻。停止循环同时通过 _reap_exited_runtime_child 对已退出的直接子进程执行非阻塞 waitpid。
  2. normalizeComponentExclusions 与 checkpointArtifacts
    仅允许 probe 与 capture 携带 component_exclusions(verify 与 materialize 携带即被 hasExactAuthorityKeys 拒绝),拒绝未知组件 ID、空列表及含 //\/../NUL 的模式;Python 侧 research_component_exclusions 仅在存在 benchmark_research 组件时附带 ("*.raw.gz", "core", "target/", ".cargo-target/"),不改动清单 schema,保证捕获后 verify 原样通过。
  3. run_once 收尾写入与 _claim_ttl_guidance / _extract_artifact_archive
    run_once 的 finally 块将 heartbeat_host_failure(wake, receipt) 包裹在独立 try/except Exception 中记录 host_failure_record_error,确保 (wake / "receipt.json").write_text(...) 始终落盘;sforge_backend 在 research_cleanup=True 时于 get_archive 前、分块暂存中及解压前三重检查可用磁盘低于 10 GiB 即抛出 InsufficientDiskHeadroomError,并在归档抽取时跳过暂态构建产物。
  4. _disable_core_dumps 与 _wake_stderr_tail / CappedProcessResult
    CappedProcessResult 向后兼容地追加默认 stderr: bytes = b"",调度守护仅在 wake_failed 时记录截断末尾 stderr_tail 并在入口处把 POSIX RLIMIT_CORE 软上限设为 0。

对主干的风险 / Risks

经独立检验与反例复现,未发现阻塞合入的问题(no blocking finding)。

精确提交 55c8032c80f91134c2e23ff6c7b0ca73ed796025 实测矩阵与环境边界披露如下:

  • TypeScript 检查与类型检查:npm run typecheck:control-plane 通过(0 错误);node --no-warnings --experimental-strip-types --test tests/control_plane_ts/checkpoint_artifacts.test.ts tests/control_plane_ts/host_process_group.test.ts 24/24 passed(0 failed, 0 skipped),checkpoint_artifacts 独立对照测试脚本验证 probe/capture 过滤与 verify 拒接过滤字段及 ../ 拒绝均符合预期。
  • Python 单元测试与静态检查:在匹配工作树路径(PYTHONPATH=$WORKTREE)下执行全部 7 个受影响套件:320 passed, 456 skipped in 78.00s(0 failed)。必须如实说明:456 skipped 为 .venv 未预装可选外部包 sforge/harbor 引起的原生态 importorskip 跳过(非本 PR 删除或弱化断言;另有 test_effect_runtime_locator_recovery.py 初次未设 PYTHONPATH 时因 .venv/bin/loopx 指向主目录指纹差异失败 1 项,对齐 PYTHONPATH=$WORKTREE 后 14/14 passed in 6.25s);为弥补环境缺口,已使用内存轻量包桩实测 _filter_research_members 与 InsufficientDiskHeadroomError,并在真实 worker.run_once 下注入 heartbeat_host_failure 异常验证 receipt.json 成功写出 host_failure_record_error。ruff check 全部 .py 改动 clean;python -m mypy(17 个 strict 核心文件)0 错误;mypy --follow-imports=silent 在 effect_runtime.py 与 process_runtime.py 0 错误;loopx check 公开边界扫描 21 个文件 errors=0, warnings=0。
  • Canary Premerge:direct_checks 4/4 passed、python_compile 1/1 passed、catalog_canaries 10/10 passed、risk_profile_smokes 8/8 passed(failures=0;manual_review_required 仅因涉及 benchmark_sensitive 路径)。
  • 远端 GitHub CI:按 wait_for_ci: false 未等待远程检查。

我的整体评价 / Verdict

综合评估精确提交 55c8032c80f91134c2e23ff6c7b0ca73ed796025:在 long_horizon 与 user_experience 维度均为 improved(消除了 Linux 孤儿僵尸进程阻塞恢复与 receipt.json 丢失故障,同时避免了 core/Rust 构建缓存引发的容器与检查点存储耗尽,并保留 stderr_tail 排障信息;无前端 UI 涉及,视觉检查为 not_applicable)。所有改动正交克制、默认关闭开关零回归,本地可覆盖检查全部通过(456 项可选 harbor/sforge 跳过已由桩测 counterfactual 与源码走查补充验证并明确标注),同意合入并按 author-owned PR 规则保持开启。

English verdict: APPROVE at 55c8032. Verified Linux zombie group handling, receipt flush resilience, POSIX core dump suppression + wake stderr_tail, validated probe/capture exclusions, and 10 GiB research headroom guard. TS tests 24/24 pass, tsc/ruff/kernel-mypy/loopx-check/canary-premerge (18/18 smokes) pass, and matching-PYTHONPATH pytest passes 320 passed / 456 skipped (missing optional harbor/sforge packages in local venv, supplemented by counterfactuals).

@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)

动机 / Motivation

使用 Linux runner 做持续长时任务、要从已封存检查点找回研究依据的操作者。 原规范保留完整的研究笔记与候选历史。旧 Linux 存活判断也可能被全僵尸组阻滞。 同一份研究输入在旧版可恢复。新头完成捕获和校验,却在实际恢复时少了两个正常路径。 改动修复僵尸进程观察、保留失败回执,新增研究过滤、磁盘下限、日志和可选 TTL。 范围覆盖原 Linux 入口、runner 自有研究目录、失败回执、环境配置与整份当前提交。

改动思路 / Approach

进程存活由 Linux 原生运行时判断。检查点和终态收集的过滤由 runner 决定,通用 TypeScript 检查点负责选择后的字节和完整性校验。现有复制与封存入口可以复用。具备恢复价值的文件应由明确的生成路径或可验证类型区别于运行残留。 范围覆盖原 Linux 入口、runner 自有研究目录、失败回执、环境配置与整份当前提交。

具体改动 / Changes

核对准确提交 55c8032c80f91134c2e23ff6c7b0ca73ed796025、merge base 0814f04e9456899600f3a3c4efccfd7775382cd8,21 个文件,+744/-29。同一提交已有 Gemini 批准。本轮以真实 Linux 进程与检查点物化补验存活判断、研究证据可恢复、过滤隔离和失败诊断。 验收依据

关键代码讲解

  1. 进程存活 在 Linux 额外读线程组状态。停止循环 复用子进程回收。
  2. 研究规则 给捕获和收集传同一组名称。检查点 先按名称过滤 witness 和复制,再验证剩余数据。
  3. 失败回执 和 外部 worker 日志 沿用现有诊断通道。终态收集 在暂存和解包前估算余量。Harbor/SForge 各自转发可选 TTL 和运行目录。

对主干的风险 / Risks

[P2] 研究检查点静默排除了名为 core 的正常证据。 研究目录下有真实的 core/analysis.md 和普通文本 topic/core 时,新版同样排除这两份材料。用两版的 probe、capture、verify、materialize 实跑,基线能恢复两份材料,新头通过完整性校验但两份都缺失。候选版本在不开过滤的对照中能保留原内容。 只排除 runner 能确认属于临时产物的路径。保留普通 core 目录;同名普通文件与实际 core dump 需要可验证的区分,并在 checkpoint 与终态收集加入同一对照。

隔离 Linux 上,基线把未回收的 Z 态子进程判成活进程,新头正确判为已终止,两版均能识别还在运行的子进程。研究捕获的构建缓存与转储样例被排除,普通代码组件完整。 定向 Python 检查 320 项通过、456 项跳过。24 项 TypeScript 检查通过。标准本地 premerge 执行 18 项选中检查且无执行失败,benchmark-sensitive 人工门仍在。 使用本地隔离 Linux 容器和真实文件。未验证完整 SForge/Harbor、生产磁盘压力或远端 CI。对当前主干合并无冲突;与仍开放的 #9176 合并时三处 benchmark 调用发生冲突。

我的整体评价 / Verdict

请求修改。保留僵尸恢复、失败回执和已知临时路径隔离。请先收窄研究目录过滤,确保普通研究笔记跨 checkpoint 恢复。现有 verify 只能校验被选中归档的内容。

English verdict: REQUEST_CHANGES at 55c8032. Verified the Linux zombie fix with an actual unreaped process. The automatic research filter also drops legitimate files and directories named core before sealing, so a verified restore silently loses evidence.

Comment thread benchmark/runtime/research_artifacts.py Resolved
…from research artifacts

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.

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

Reviewer: model_agent · Gemini · Google · self_reported

Exact head reviewed: 826590cddd78b0fc8505c631e475161e4fd12c3a (base 0814f04e9456899600f3a3c4efccfd7775382cd8; incremental commit 826590cddd on top of 55c8032c80; review thread PRRT_kwDOStEbEs66h2DX resolved).

动机 / Motivation

执行长程 benchmark checkpoint 采集/验证/物化(checkpoint_artifacts.ts、checkpoint_worker.py)以及运行结束后归集研究产物(sforge_backend.py)的运行时与研究者。 变更前后场景:此前排除规则按裸文件名 'core' 匹配路径片段,会把正常研究目录 core/analysis.md、普通文本文件 topic/core 及非 core-dump 二进制 exec_dir/core 静默丢弃;变更后 Python 与 TypeScript 两侧均改为 core-dump:elf-macho 规则,仅在非目录文件名为 core 或 core.* 且读取文件头确认为 ELF ET_CORE(=4) 或 Mach-O MH_CORE(=4) 时才排除(并连带跳过指向被排除成员的 tar 硬链接)。 可观测结果:checkpoint 采集、验证、物化与 sforge 产物落盘完整保留 core/analysis.md、topic/core 与普通 ELF 可执行文件 exec_dir/core,同时排除真实 ELF ET_CORE / Mach-O MH_CORE 转储(含 core.* 与对应硬链接);所有 TS/Py 回归测试、变异敏感性检验及 18/18 premerge canary 均通过。 非目标:不改变既有的 *.raw.gz、target/、.cargo-target/ 排除规则,不放宽符号链接或越界路径拒绝策略,也不引入新的权限或运行时开关。

上一轮评审指出,将裸字符串 core 列入研究产物排除规则会在 checkpoint 采集/物化及最终归档阶段误删名为 core/ 的目录(如 core/analysis.md)或普通 topic/core 文件。本增量提交以基于真实文件头(ELF ET_CORE=4、Mach-O MH_CORE=4)的 core-dump:elf-macho 判定替代名称误伤,确保研究目录与普通文件零静默丢失。

改动思路 / Approach

架构评估:ELF/Mach-O 核心转储头部判定分别落在既有 Python 研究产物过滤模块 benchmark/runtime/research_artifacts.py 与 TypeScript checkpoint 采集模块 loopx/control_plane/runtime/checkpoint_artifacts.ts,不新增独立子系统,并对遗留清单中的 'core' 规则保持同口径向后兼容。 当前 PR 边界:增量提交 826590c 精准修复线程 PRRT_kwDOStEbEs66h2DX 所指出的 core 误排问题,覆盖 Python 产物归集/tar 过滤、TS checkpoint 采集与物化以及对应正反测试。

条目样例 变更前(裸 core 匹配) 变更后(core-dump:elf-macho)
core/analysis.md(目录内文件) 误排除 保留(目录片段永不触发 core-dump 排除)
topic/core(普通文本) / exec_dir/core(ET_EXEC=2) 误排除 保留(文件头非 ET_CORE=4 / MH_CORE=4)
core / sub/core.123(ET_CORE=4 / MH_CORE=4)及指向其的 tar 硬链接 排除(遗漏 core.* 与硬链接) 确认文件头后排除,且跳过悬挂硬链接

已核对 tar 读取模式:checkpoint_worker.py(raw.seek(0))与 sforge_backend.py(archive_file.seek(0))均在可 seek 的本地 spool 文件上调用 tarfile.open(fileobj=...),因此 is_excluded_tar_member 中 archive.extractfile(member).read(20) 不会触发流式读取异常;TS 侧 members() 仅在 sourceObservation=true(采集源)时应用排除,校验已采集产物保持全量核验,与 copyComponent() 完全一致。

具体改动 / Changes

  • benchmark/runtime/research_artifacts.py:引入 CORE_DUMP_EXCLUDE_PATTERN = "core-dump:elf-macho"、is_core_dump_name、is_confirmed_core_dump_header(校验 ELF32/64 大小端 e_type==4 与 Mach-O 32/64 大小端 filetype==4)及 is_excluded_tar_member;普通非目录字面规则也加上 not entry_is_dir 保护。
  • benchmark/runtime/sforge_backend.py 与 benchmark/edgebench/checkpoint_worker.py:改用 is_excluded_tar_member(archive, member, ...) 并记录 excluded_paths,跳过指向已排除成员的硬链接,避免解包失败。
  • loopx/control_plane/runtime/checkpoint_artifacts.ts:新增 isConfirmedCoreDumpHeader / isConfirmedCoreDumpFile,在 isExcludedEntry 中支持 core-dump:elf-macho 与历史 "core" 清单的头部确认,统一应用于 members() 与 copyComponent()。
  • 测试:tests/control_plane_ts/checkpoint_artifacts.test.ts、benchmark/tests/test_research_artifacts.py、benchmark/tests/test_sforge_artifact_spooling.py 补齐正反例(保留 core/analysis.md、topic/core、ET_EXEC 二进制,排除大小端 ELF/Mach-O core dumps 及硬链接)。

本地验证(exact head 826590cddd):tsc --project tsconfig.control-plane.json --noEmit 0 errors;Node TS(checkpoint_artifacts、checkpoint_retention、host_process_group)32 passed / 0 failed / 0 skipped;Python(sforge+harbor 启用,test_research_artifacts、test_sforge_artifact_spooling、test_checkpoint_worker、test_process_runtime、test_external_scheduler_worker)207 passed / 44 skipped(Docker writer-barrier 43 + Windows junction 1),test_effect_runtime_locator_recovery.py 在 .venv 下 14 passed / 0 failed / 0 skipped(uv --no-project 临时环境缺 bin/loopx 脚本导致该单测在 --no-project 下报 FileNotFoundError,属环境差异);ruff 与 git diff --check 干净;loopx check --scan-path 7 文件 public_boundary_scan.ok=true;canary premerge --from-git-diff --git-diff-base origin/main direct 6/6、catalog 10/10、risk_profile 8/8、failures=0、manual_hold_count=1(benchmark_sensitive);变异检验将 is_confirmed_core_dump_header 改为恒 True 后 test_core_dump_filter_preserves_normal_core_dirs_and_plain_files 在 ('topic', 'core') 断言失败;git merge-tree 与当前 origin/main 无冲突。

对主干的风险 / Risks

  • 仅当文件位于 RESEARCH_EXCLUDE_PATTERNS 作用域内且文件名匹配 core / core.* 时才读取前 20 字节,对普通文件 I/O 开销可忽略。
  • is_confirmed_core_dump_header 对非 ELF/Mach-O(例如自定义压缩核心转储,除非以 .raw.gz 结尾)按保守策略保留,不会误删有效研究数据。
  • checkpoint_artifacts.ts 保留了对旧 manifest 中 "core" 模式串的兼容解析,且同样要求文件头确认,升级平滑无破坏。
  • 残余边界:若压缩或分片核心转储既非 .raw.gz 也不带 ELF/Mach-O 魔数,将被保留;test_checkpoint_worker.py 的 43 个隔离 Docker writer-barrier 用例未在本机执行(与本次文件名/魔数过滤改动正交)。

我的整体评价 / Verdict

架构评估:ELF/Mach-O 核心转储头部判定分别落在既有 Python 研究产物过滤模块 benchmark/runtime/research_artifacts.py 与 TypeScript checkpoint 采集模块 loopx/control_plane/runtime/checkpoint_artifacts.ts,不新增独立子系统,并对遗留清单中的 'core' 规则保持同口径向后兼容。 当前 PR 边界:增量提交 826590c 精准修复线程 PRRT_kwDOStEbEs66h2DX 所指出的 core 误排问题,覆盖 Python 产物归集/tar 过滤、TS checkpoint 采集与物化以及对应正反测试。 本次改动彻底关闭 PRRT_kwDOStEbEs66h2DX 的目录/普通文件误删风险,Python 与 TypeScript 文件头校验及 tar 硬链接处理严谨一致,且经 TS/Py 回归、变异检验与 18/18 premerge canary 独立验证,未发现阻塞问题。残余风险仅限于非 ELF/Mach-O 格式转储保守保留与本机跳过的 Docker writer-barrier 套件。

English verdict: APPROVE — Confirmed ELF/Mach-O core-dump header filtering replaces the overbroad bare core exclusion consistently across Python tar spooling and TypeScript checkpoint capture/materialization, verified with 32 TS tests, 207+14 Python tests, mutation sensitivity, and 18/18 premerge canaries (failures=0) at 826590cddd.

@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)

[P2] 普通组件的 ID 会静默改变恢复内容

同一份普通声明包含 experiment.raw.gz 和 notes.md。基线两种 ID 均可恢复两份文件。候选把组件 ID 写成 benchmark_research 时仍返回捕获、校验和物化成功,但只恢复 notes.md。把 ID 换成 evidence 就能恢复两份文件。 普通 checkpoint 路径接受调用者自选 ID。当前过滤只看 ID,捕获回执也无法表明已声明物料被省略。以 runner 持有并传递的声明或精确目录绑定过滤范围,避免以用户可选 ID 单独决定。用相同数据比较 runner 所有和普通显式参与者,并跑到 verify 和 materialize。 按 ID 选择的分支 捕获入口

[P2] 同一个 dump 的硬链接令两端 witness 不一致

同一份研究目录中,一个已识别的 dump 有普通名硬链接。基线源和 tar 提取后的 witness 相等。当前头本地 probe 留下别名,归档提取却丢掉别名,source_sha256 不同。去掉别名的正向对照在本地与归档均一致。 完整 checkpoint 在比对准备阶段的摘要时把它识别为冻结后变化,因而拒绝封存。在取证前让两个入口使用同一保留规则。可以先以已有安全边界物化普通文件别名,再由通用 artifact owner 通过同一过滤规则决定保留;若希望排除同 inode 的所有名字,则准备阶段和归档阶段必须同时做到。 归档规则 摘要比较

动机 / Motivation

在 EdgeBench 或 SForge 上做长程研究、需要把当前研究依据从封存检查点带到下一次执行的操作者。 检查点以前会保留声明中的文件,但崩溃残留和编译目录会放大归档。候选过滤这些残留,同时修复运行时定位与失败回执。 普通文本 topic/core 已恢复保留。当前候选仍会因调用者选用一个 ID 而静默省略已声明的文件,并会在同一份目录存在普通硬链接时拒绝原检查点。 核对已声明的归档、恢复和进程边界。没有启动真实评测、付费模型或上线。

过滤只应作用于 runner 归属已证实的研究参与者,准备和传输阶段应使用一致的文件清单。

改动思路 / Approach

继续让 runner 确认研究目录归属,既有 TypeScript owner 负责字节 witness、封存、校验和物化。Docker 归档用于传输被暂停 writer 的源。修复点应共享同一成员选择规则,避免传输端提前丢掉源阶段意图保留的普通文件名。把研究归属和成员规则明确交回原 owner,现有 transport 只负责提取。修复研究过滤的两条反例后再读回;维持原 replay 与 manifest。流程本身不增加恢复执行权、评测权或续租权。

具体改动 / Changes

关键代码讲解

头为 826590c,基线 0814f04,全量 22 文件 +1038/-32。既有 benchmark/README.md 的 Inert checkpoint capture 仍把验证/物化作为只读边界。Caller component IDs 与 Declared source witness 的保真要求在前两项反例中未满足。 基线文档

  • research_component_exclusions 和三个 capture 入口把选择传给 probe 与 capture。checkpoint_artifacts.ts 中 members 和 copyComponent 匹配目录、后缀以及有类型证据的 ELF/Mach-O 文件。verify 与 materialize 仍消费现有 manifest。 类型化 artifact 处理
  • _archive 在检查点传输内筛掉暂存材料。SForge 的 _extract_artifact_archive 另用 10 GiB 空间预算处理终态归集并记录失败原因。SForge 的 shell 和 worker 环境将默认 Cargo 产物指向任务、研究目录之外。 终态归集
  • _pid_is_alive 在 Linux 补充整组僵尸观察,停止时尝试回收直接子进程。外部 scheduler 将 POSIX core 软限制置零,保留有界 stderr 诊断;worker 在失败描述无法写成时仍会落原回执。可选 runtime PATH 和 TTL 合约沿原 adapter,TTL 提示仍由现有 Todo claim 执行;相关 #9225 已合入。 定位恢复

对主干的风险 / Risks

语义与 CI 对齐

FAIL。两对独立反例都使用相同生成输入与源码入口。工作结算和 Docker HTTP 返回用隔离 fixture,归档解码、TypeScript effect 和磁盘回读实际运行。显式运行新增的 archive 测试,Docker SDK 在 tar 解析前因未编码的 path-stat header 报 Incorrect padding;其后断言也仍把纯文本 core 当作应删除文件。独立 fixture 使用正确格式实际通过 SDK 解析并保留普通文本。

PASS。常规匹配 Python 套件基线 317 通过、124 跳过,候选 322 通过、126 跳过。Node 的 32 项 checkpoint 和 process 测试通过。标准 premerge 的 6 项直接检查与 18 项选中检查零执行失败,仍有 benchmark_sensitive 人工门。初次未显式设置源码 PYTHONPATH,记录了三个子进程导入失败和一个 locator 测试失配。用与基线相同的源码环境完整复查时,四项均通过。未取得实 Linux、SForge 容器或付费运行证据。

我的整体评价 / Verdict

保留普通 core 名的修复有效。将筛选限定为 runner 持有的声明,并用同一份文件清单核对源和归档。两项修正须通过实际恢复和已准备 checkpoint 的摘要比较,再运行使用正确定义 header 的新增测试。查看了 Python runner 和 TypeScript artifact 入口;本次变更未修改应用渲染。

English verdict: REQUEST_CHANGES at 826590c. A caller-chosen component ID silently loses declared bytes, and a normal hard link to a filtered dump breaks the prepared checkpoint witness.

…dlink witness

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)

[P2] SForge 终态归集仍按 tar 硬链接顺序丢研究文件

SForge 的 _filter_research_members 仍按已排除 target 删除 link,且 is_excluded_tar_member 无法从链接记录读取 core header。 沿用 checkpoint worker 现有做法,从归档内普通成员读取链接内容,并按链接自己的相对路径和真实头部判定。补测两种成员顺序下同一份研究内容,纳入最终归集回执验证。 候选代码

动机 / Motivation

借助 EdgeBench 和 SForge 检查点与终态研究归档延续实验的操作者。 现有 runner 归集按声明保留合规研究文件。真实 core dump 和编译缓存可能放大传输及归档,Linux 死进程也可能延迟 locator 恢复。 缩小临时物料,保留正常研究资料以及 probe、传输、归档的完整性,同时修复失败回执和 locator 判断。

普通调用者选择 benchmark_research ID 并声明其他目录。独立 EdgeBench 用例包含正常命名 alias 指向 ELF core。 原评审的普通同名组件问题已修复。串联 capture、verify、materialize 后恢复两份声明文件。EdgeBench 定向用例校验硬链接的本地与转移 witness 相等。Linux 容器实测原zombie 识别问题已修复。

可用 disk headroom 充足,研究目录的普通名文件与 core 或 core.5 是同一份内容的硬链接,Docker tar 可为其中任一名称存放实际字节。 SForge 的 _filter_research_members 仍按已排除 target 删除 link,且 is_excluded_tar_member 无法从链接记录读取 core header。 同一 Linux tar 输入中,基线保留正常别名。候选以 core 作 regular member 时报告 collected=true,却遗漏同内容的普通名 z-ordinary-evidence。交换代表成员后,候选同时保留了两个本应识别的 dump 路径。 用真实 SForge、Harbor 本地包加载归集实现,Docker 传输边界传入 Linux 制作的归档。未启动整场评测、模型调用或线上服务。

改动思路 / Approach

runner 拥有临时研究文件和 Docker 传输选择,原 TS artifact owner 计算 source witness 并验证、物化封存结果。SForge 终态归集是另一入口,当前仍用自己的成员顺序规则。 SForge 可复用归档成员字节解析及按相对路径筛选的行为,保留现有 10 GiB 归集护栏和 Docker 安全提取。

具体改动 / Changes

关键代码讲解

评审头 8e4c694,合并基线 0814f04。21 个文件,+1191/−41。 依据 Caller component IDs 和 Declared source witness and research retention 核对现有入口。 仓库规范 当前 EdgeBench 修复

  • is_runner_research_component。仅当组件 ID 和保留源目录同时匹配时打开清理。 代码
  • _archive。以实际普通成员提供字节,并按硬链接自己的路径运行同一筛选。 代码
  • _filter_research_members。终态归集仍按 target 是否已排除裁决硬链接,遗漏普通路径或保留真实 dump。 代码
  • RecordingDockerBackend._extract_artifact_archive。归集从 spool 提取筛选后的内容,随后 cleanup_container 写 collected 回执。 代码

对主干的风险 / Risks

语义与 CI 对齐

19 项 TS checkpoint 测试、2 项 EdgeBench 定向测试均通过。加载 SForge/Harbor 后复跑 233 项 Python 测试通过,3 项跳过。标准 premerge 的 6 项直接和 18 项选中检查均通过,仍标记 benchmark_sensitive 人工审查。另独立对照了两种 tar 成员顺序。

我的整体评价 / Verdict

当前头需要修改。终态 artifacts 可以按原安全归集方式重取。当前成功回执没有标出普通别名被省略,重跑相同实现会重复。 下一次验收可沿原入口比较同一输入的外部读取或归档成员,并确认正式回执与实际结果一致。

English verdict: REQUEST_CHANGES — SForge terminal collection still drops ordinary research hardlinks or retains confirmed dumps depending on tar order. Exact head 8e4c694.

Signed-off-by: huangruiteng <huangrt01@163.com>
Signed-off-by: huangruiteng <huangrt01@163.com>
Signed-off-by: huangruiteng <huangrt01@163.com>
Signed-off-by: huangruiteng <huangrt01@163.com>
huangruiteng
huangruiteng previously approved these changes Nov 23, 2026

@huangruiteng huangruiteng left a comment

Copy link
Copy Markdown
Collaborator

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-astra · OpenAI · runtime_reported · xhigh

动机 / Motivation

依赖检查点接续工作、在容器退出后取回研究文件的 benchmark 操作者会遇到这个问题。同一份数据有三个硬链接名称。旧收集器可能随归档顺序丢掉证据名,或留下本应清理的转储名,操作者需要回到已经退出的容器追查。修复后,两种归档顺序都留下两个证据名称和相同的文件内容,收集回执也能和落盘结果核对。这次验收覆盖运行时存活判断、检查点与终态文件收集。模型成绩和整场实验成本另行衡量。

改动思路 / Approach

文件是否保留取决于每个名称及其实际内容,归档顺序属于传输细节。两个读取 Docker 归档的调用方现在共用同一个内容解析函数。检查点仍由已有 TypeScript 实现决定捕获和校验,SForge 只负责把保留的数据写到宿主机。 例如,一个名为 core.1 的真实转储与 evidence.bin 共享内容,前者允许清理,后者是要交付的研究证据。保留的第一个名字负责落盘,后面的名字链接到它。这样调换打包顺序,目录结果和磁盘预算都一致。

具体改动 / Changes

关键代码讲解

  • 两个读取 tar 的调用方先找到承载实际字节的成员,再用每个名字单独判断。普通文本即使叫 core 也保留。SForge 从保留的名字中选出一个写入数据,其余保留为硬链接。真实 Docker 容器退出时,两个证据名和笔记都能读回,两个名字指向同一 inode。归档内容解析 · 终态归档
  • 检查点只在探测和捕获阶段接受组件级排除。benchmark 适配器用组件 ID 和预留源目录共同限定自己的研究目录。同名但来自其他目录的数据经历捕获、校验和还原后仍然完整。验收条目 declared-scope 和 research-retention 对应基线 09eadec703b4f0294b9abcbc296f759ca3359d8f 的 benchmark/README.md#inert-checkpoint-capture。检查点契约 · 过滤参数校验
  • SForge 通过原有的一次安装脚本写入 Cargo 默认目录,尊重镜像已有覆盖。干净环境下普通 Harbor 仍使用其原有行为。运行时通过 Linux 线程组状态区分活进程与尚待父进程回收的子进程。外部调度器限制 core 和错误输出,记录 host 错误本身失败时,worker 仍落盘最终唤醒回执。显式指定的工具路径和有界 claim TTL 由原有工作进程入口传入。SForge 安装配置 · 运行时存活判断

对主干的风险 / Risks

语义与 CI 对齐

磁盘余量不足时研究侧产物收集会主动失败,并在回执中记明原因。低余量分支用受控输入验证,真实 Docker 路径验证成功回执、最终文件和硬链接。相同 Linux 子进程在基线被报告为存活,在本次提交被报告为已退出,活进程对照在两边均正常。默认 Codex 配置在基线和当前提交都是完全相同的 635 字节。

最终提交的十个 Python 测试模块有 854 项通过、49 项跳过,两个 Node 套件的 24 项均通过。预合并检查执行了 6 项直接检查、10 项目录检查及 8 项风险检查,自动检查零失败,另有一项 benchmark 敏感改动的人工评估要求。本次核对用了真实收集、进程与文件系统证据。该验证范围未覆盖付费模型任务或整场 benchmark 评分。

我的整体评价 / Verdict

改动沿容器、检查点和命令行回执生效,调用链没有涉及渲染页面。 这次可以把上轮关于硬链接的意见关闭。两种失败都在修复前复现,并在当前提交通过相反顺序的用例和真实容器的落盘核对。上游安装入口仍掌握失败处理,检查点仍可独立验证。没有遗留需要修改代码的发现。

English verdict: APPROVE — reviewed 760a92577a871b132697aba0d9a9583b559c1b81. The archive ordering and installer findings are resolved. Exact-head native collection and focused regressions passed.

@mergify

mergify Bot commented Nov 23, 2026

Copy link
Copy Markdown

This pull request has merge conflicts with main 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/main
# 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>/main 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 23, 2026
…giene

Signed-off-by: huangruiteng <huangrt01@163.com>
@mergify mergify Bot removed the needs-rebase Mergify: the pull request has merge conflicts with its base branch label Nov 23, 2026
Signed-off-by: huangruiteng <huangrt01@163.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)

动机 / Motivation

在共享 runner 上持续运行 Linux 任务、从 checkpoint 或 SForge 终态恢复研究资料的操作者。 真实僵尸进程可能拖住 Runtime locator 恢复。终态研究归集原先没有容量保护,可能把临时产物带走。 加固 Runtime 清理和正常研究文件保留,在可选研究归集的下载与解包阶段遵守本机磁盘余量门。

在同一份正常研究 tar 归集中比较磁盘稳定、起始已不足和读取第一块后由另一个进程占用空间。 Linux 真实子进程复验通过。完全退出而未被回收的组不再判为存活,有活动 worker 的组仍被判活。两种 tar 顺序均保留正常硬链接名称,同名普通组件仍照原声明 capture、verify 和 materialize。 验证经过实际 SForge 收集方法和临时文件系统,Docker get_archive 以可控 tar 流替代。只在 fixture 内缩放容量阈值,另一个进程实际写入 32 MiB。未启动真实模型、评分或线上任务。

[P2] 归集过程中实际余量跌破下限,收集器仍继续

若可用空间在研究 tar 的两个分块之间跌到阈值以下,当前头仍继续收集并写出 collected=true。初始低于阈值时,候选能在发起归集前拒绝同一个输入。 只在开头读取一次 free_before。后续减去本次写入和解包估算,遗漏了共享磁盘上其他进程期间的写入。 在后续有界写入和解包之前重读 spool 与目标盘的当前余量,并用同一归集入口验证初始通过、途中跌破阈值时中止和关闭流。 归集代码

改动思路 / Approach

使用已有 Runtime liveness、TS checkpoint witness 和 SForge 本地归集。TTL 继续从 worker 设置经过现有 Todo claim 指引。 保留既有归集入口和 in-flight 状态,仅让各阶段读取更新后的余量。 本次修改限于原 worker、研究物料筛选与可选归集的磁盘保护。

具体改动 / Changes

精确头 2b16947b78a6df93f4a86d4a3fe6cdc2a4b2c960,基线 f4c27a88b54e9f5daba0d282076328fb30b922ff。22 文件,+1244/−47。当前头包含 Complete Turn 默认切换,另为规划测试的 resume 替身提供 session binding。 检查点约定

  • Declared checkpoint content(implemented)。同名普通组件保留原字节,两种硬链接顺序实测通过。
  • Research collection headroom(not_met)。第一块读取后写入发生在另一独立进程。第二块前实际余量已低于测试阈值约 20 MiB,终态收据仍报告归集成功。

关键代码讲解

  • _pid_is_alive。Linux 查整组是否只剩僵尸线程。 代码
  • is_runner_research_component。以保留目录和组件名同时限制筛选。 代码
  • _filter_research_members。解析真实 data-bearing 成员,保留应留的普通别名。 代码
  • _extract_artifact_archive。持有本地 spool,下载和解包都按同一份起始余量估算。 代码
  • _claim_ttl_guidance。已启用时沿原 claim 提示传递 TTL。 代码
  • _fake_session_wake。测试替身提供现行 session binding,fresh 和 resume 都能到达原有路径断言。 代码

对主干的风险 / Risks

当前头的原生 locator 恢复测试 14 项通过。TypeScript checkpoint 19 项通过。正常研究别名两种顺序都通过,公开配置未启用 TTL 时逐字节一致。标准 premerge 的 6 个直接和 18 个选中检查零自动失败,保留 benchmark_sensitive 人工项。固定 provider 的回归套件为 703 passed, 4 skipped。新补丁涉及的相对路径和 symlink fixture 共 6 项通过。前一提交同一批 6 项因缺少 binding 失败。 完全退出和仍有活动线程的 Linux 组已分别实测。磁盘稳定时两端都归集成功。候选在归集前余量不足时按预期写出 InsufficientDiskHeadroomError。

语义与 CI 对齐

默认 worker 设置在 base/head 均为同一份 648 字节,显式 TTL 可转交。按组件 ID 和保留目录同时匹配后才筛选 runner 研究产物。 远端 CI 未查询。代码无 tracked 修改。独立 Linux 容器无网络,真实磁盘注入为独立临时目录,正常研究数据保留。

我的整体评价 / Verdict

当前提交需要修改。已确认真实 Linux 退出组和普通研究 alias 两项修复。请在共享盘的实际容量下降时中止可选归集,并用固定 tar 样例证明拒绝状态、流关闭和失效范围。

English verdict: REQUEST_CHANGES at 2b16947b78a6. Research collection still checks a stale free-space snapshot after another process consumes disk space. Linux zombie handling and both tar hardlink orders passed independent checks.

@huangruiteng huangruiteng left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewer: model_agent · GPT-5 · OpenAI · self_reported

动机 / Motivation

使用 Linux benchmark/control-plane worker 继续长程任务、并依赖 checkpoint 与终态 research 归档恢复研究上下文的主持人,是本次改动的主要用户。阻塞恢复、失败回执丢失和磁盘被临时文件耗尽都会把一次本可继续的长任务变成需要人工清理和重新唤醒的事故。

受影响调用者和操作者是运行 EdgeBench、SForge、Harbor benchmark worker 与 managed TypeScript Effect runtime 的本地操作者。旧行为中,Linux 上已退出但未回收的全僵尸线程组仍可被 kill(pid, 0) 视为存活,进而卡住 runtime locator recovery;worker failure 描述生成失败时可能连 receipt.json 都不落盘;core dump、.raw.gz 和 Rust target 目录还可能把 research checkpoint 或宿主磁盘撑爆。

具体前后场景是:一次 worker 已结束但父进程暂未 reap 时,新头将全僵尸线程组视为终止,并允许 locator/lock recovery 继续;一次 Host 失败解析抛出异常时,新头仍写入带 host_failure_record_error 的 receipt;一次 research 目录同时含真实笔记、普通 topic/core、真实 core dump 与 Cargo target 时,新头只排除确认的临时残片并保留研究证据。

可观察结果是 runtime 恢复不再被僵尸组永久阻塞,失败唤醒保留有界诊断与 receipt,runner-owned research 归档排除确定可重建的临时残片,同时普通同名文件与注释保留;非目标是不改变 checkpoint 的 verify/materialize 只读语义、不改变 caller 自行命名组件的普通 checkpoint 内容、不授权恢复执行、评测或线上发布。

改动思路 / Approach

这次修复沿用既有所有权边界,而不是新增第二套控制面。Linux 存活判断仍属于 effect_runtime;checkpoint 的字节观察、封存与物化仍属于 TypeScript artifact owner;Docker writer barrier 和终态 tar 只负责 transport;SForge/Harbor 仅转发显式的 runner 配置。研究临时产物过滤由 Python runner 先证明组件 ID 与保留目录同时匹配,再把受限 pattern 传给 probe/capture;verify/materialize 不接收过滤参数,因此已封存清单仍是唯一校验依据。

硬链接修复是这次最关键的语义收口:源目录 witness 与 Docker tar 的提取 witness 都按链接自身路径判断,并从同一归档内的普通成员的字节确认 core header。这样普通名 alias 不会被 tar 成员顺序意外删除,真正的 core/core.* ELF ET_CORE 或 Mach-O MH_CORE 仍会被排除。共享解析集中在 benchmark/runtime/research_artifacts.py;Python 与 TypeScript 各自保留文件头识别,是因为 capture 实际执行在 Node,而 transport/recovery 实际执行在 Python,属于明确的运行边界而非第二套业务规则。

决定理由是每个机制都消除一个已经复现的真实故障,而且排除了更危险的设计:不按可选的 component ID 单独过滤,不按裸文件名删除正常研究资料,不用 CI 或 mock 成功替代 source/archive witness 的一致性。当前 PR 边界是 Linux 僵尸恢复、失败诊断与 receipt 持久性、runner-owned research 清理、磁盘下限,以及严格可选的 PATH/TTL 转发;完整 SForge 容器评测与远端 CI 队列不属于本 PR 的代码验收条件。

具体改动 / Changes

变更共 22 个文件、+1244/-47,其中 14 个 production 文件和 8 个 tests/fixtures 文件;没有生成物或机械搬移。验收合同以 benchmark/README.md#inert-checkpoint-capture 为 spec_ref,审阅基线固定为 f4c27a88b54e9f5daba0d282076328fb30b922ff。RT-1 要求 worker 保留任务工具链 PATH,并只在显式 opt-in 时转发 claim TTL,不把宿主环境变成隐式权限。

关键代码讲解

  1. CK-1 要求 caller component IDs 被保留,且声明成员不能被静默改写。benchmark/runtime/research_artifacts.py:45 的 is_runner_research_component 只在 ID 为 benchmark_research 且 source 精确等于保留目录时开启过滤;tests/control_plane_ts/checkpoint_artifacts.test.ts 的 caller-chosen ID 对照证明普通组件仍恢复 .raw.gz 和笔记。
  2. CK-2 要求 verify/materialize 保持 inert。loopx/control_plane/runtime/checkpoint_artifacts.ts:502 只在 probe/capture 接受 component_exclusions,verify/materialize 带该字段会拒绝;checkpointArtifacts 的 24 项 Node 测试随后重新 verify/materialize 封存结果。
  3. CK-3 要求 research 声明在 checkpoint 与终态归集中保真。benchmark/edgebench/checkpoint_worker.py:137 的 _archive 与 benchmark/runtime/sforge_backend.py:34 的 _filter_research_members 复用 archive_member_content 和 is_excluded_tar_member;普通 core/analysis.md、topic/core、ET_EXEC 与普通 hardlink 保留,确认的 ELF/Mach-O dump 及其自身路径下的 core.* 排除。
  4. loopx/control_plane/effect_runtime.py:500 的 _pid_is_alive 在 Linux 额外检查全线程组是否都已处于 Z;只有整组终止才返回 false,仍有活线程时继续 fail closed。loopx/control_plane/effect_runtime.py:828 的停止路径继续复用直接子进程的非阻塞 reap。
  5. benchmark/runtime/worker.py:974 隔离 heartbeat_host_failure 的异常并把错误写进 receipt;scripts/external_scheduler_worker.py:569 关闭 POSIX core dump,_wake_stderr_tail 只在失败时发布 400 字符以内的 stderr 尾部。benchmark/runtime/codex.py:20 则把 TTL 严格限制在 1..86400,未设置时不产生任何新增配置键。

对主干的风险 / Risks

最强回归场景是错误地把仍能写入的混合线程组判成已终止,或把正常研究文件当作临时 dump 删除。当前实现用“全部线程均为 Z”防止前者,用精确 runner 目录、确认文件头、链接自身路径和同源 witness 对照防止后者;读取 header 失败时保守保留文件。

反向风险是真正损坏的 dump 继续占空间,或 Docker.tar 中非普通目标的 hardlink 被拒绝。前者是刻意选择的研究数据安全优先,后者保持原先“只接受普通文件、目录和可解析 hardlink”的 transport 边界,并给出明确失败而不是伪成功。

当前 head 相对上一审 head 只增加一行测试夹具:resume planning-path 的 session 现在返回 binding.session_id,对齐现有 runtime contract,生产代码未变。受这一变化影响的两组路径测试在当前 head 为 6 passed;上一 head 的完整矩阵仍成立:npm run typecheck:control-plane 通过;Node checkpoint/process 测试 24/24;Python 受影响套件 serial 335 passed, 345 skipped;真实 SForge/Harbor importer 下 research/shared/readiness/spooling 套件 233 passed, 14 skipped;ruff 与 mypy 通过;changed Python compile、RFC bilingual 与 diff checks 通过。当前 head 的 standard premerge 完成 4 项 direct checks、10 项目录 canary 与 8 项风险 profile smoke,自动失败为零,仅保留预期的 benchmark_sensitive 人工审查;本轮结论正是该人工审查。

公开边界扫描 22 个文件无 blocking hit,只保留既有的 checkpoint_worker.py 非字面 credential 引用 warning。远端 CI 在取证时仍为 pending;它作为独立诊断项记录,不用来替代上述 changed-invariant 证据。未启动完整付费 benchmark、真实 Docker SForge 任务或线上发布,残余风险是这些集成路径没有在本轮重放。

没有阻塞 finding。前几轮关于裸 core 误删、caller 可选 ID、源/归档 witness 不一致和 SForge hardlink 顺序的 P2 问题,都在当前 head 有对应反例测试;GitHub 的旧 review thread 已 resolved 或 outdated,没有未解决阻塞 thread。

我的整体评价 / Verdict

long_horizon 判定为 improved:未知僵尸不再永久阻塞恢复,失败 receipt 不因二次解析错误丢失,研究检查点也不会被可重建缓存挤爆。user_experience 判定为 improved:操作者能从 receipt、bounded stderr 和 artifact collection 回执看到可行动失败,而不是只看到超时或无诊断的容量事故;visual_review 为 not_applicable,因为 diff 不含渲染页面或 UI 入口,未验证范围就是无视觉表面可检查。

整体架构 assessed as retain:处理分别留在现有 runtime、typed checkpoint artifact、benchmark transport 与 adapter 边界;没有新增 authority、第二套 manifest 或调度状态。兼容性 assessed as follow_up-by-default-disabled:TTL/PATH 开关未设置时配置保持原样,研究过滤只对 runner 精确保留目录生效,verify/materialize 的公开字段集合不放宽。最小可行的后续改进是把相同复杂 fixture 放到真实 Docker SForge 容器中跑一次长时间 integration acceptance。

可以合入。该结论基于精确 head 2b16947b78a6df93f4a86d4a3fe6cdc2a4b2c960 的源码、上一头的完整反例与真实 importer 验证,以及当前头唯一测试增量对应的 6 passed;不是把 pending CI 或作者声明当作正确性证明。

English verdict: APPROVE at 2b16947. No blocking finding remains: the current head differs from the fully exercised prior head by one test-fixture field, and the affected planning-path cases pass on the new exact head; production semantics, Linux zombie recovery, durable receipts, exact-scope research exclusions, hardlink witness parity, and opt-in PATH/TTL forwarding retain the prior local TS/Python and imported SForge/Harbor coverage. Remote CI remained pending and full Docker execution remains residual risk.

@huangruiteng
huangruiteng merged commit d588d27 into main Nov 23, 2026
18 of 19 checks passed
@huangruiteng
huangruiteng deleted the codex/fix-runtime-zombie-and-bench-hygiene-20261122 branch November 23, 2026 11:43
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.

2 participants