Skip to content

fix(benchmark): route admitted continuation clocks into automatic captures - #8398

Merged
huangruiteng merged 3 commits into
mainfrom
codex/benchmark-retained-phase-clock
Nov 10, 2026
Merged

huangruiteng merged 3 commits into
mainfrom
codex/benchmark-retained-phase-clock

Conversation

@loopx-agent

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

Copy link
Copy Markdown
Collaborator

Problem and outcome

原地恢复中断 benchmark worker,随后保存 held checkpoint 或终止现场的运行者。 原时钟作为恢复证据保留且已经过期,scheduler 成功选择剩余 800 秒的新阶段;旧默认 supervisor 却仍把两个捕获请求指向旧文件,只有手动传新参数才有效。原 PR 的可选参数没有到达正常调用者。

成功选择续跑阶段后原子发布该阶段时钟,两种默认捕获自动读取同一物理文件;新建 worker 继续读原 400 秒时钟。真实 Linux/Docker 对照旧实现 1 失败/1 通过,新实现两项通过,原时钟字节均保持。

Design and scope

scheduler.resume_state_file 是现有准入 owner,只在成功选择或同阶段重放之后发布向下取整的 active-phase-deadline。Host 的一个 resolver 同时服务 held 和 terminal 路径;保留非默认显式路径,缺少新时钟的新 worker 使用旧路径。删除 FailurePreservation 的重复路径配置,避免两个适配器漂移。

新文件是已获准 phase deadline 的派生物理运输值,原 phase witness 和 append-only phase state 不变。未知 IO 或非法时钟不以旧值静默兜底,拒绝续跑不发布新时钟。

不增加 scheduler 或 native evaluator 预算、评分机会、冷却、恢复权限或自动失败重试;不把失败 Turn 伪装成已完成。

Validation

相关源码套件 116 passed / 335 skipped;最终阶段套件 20 passed / 2 opt-in Docker skipped。另在隔离 Linux Docker 真实 scheduler 和 archive 路径上显式执行 fresh/continued 两种情况,2 passed;同夹具旧实现仅续跑失败。Ruff 与 Python 编译通过。

Reproduction: uv run --extra test python -m pytest -q benchmark/tests/test_scheduler_phase_resume.py benchmark/tests/test_terminal_preservation.py benchmark/tests/test_interruption_recovery.py benchmark/tests/test_stopped_recovery.py benchmark/tests/test_sforge_runtime.py; LOOPX_EDGEBENCH_DOCKER_SMOKE=1 python -m pytest benchmark/tests/test_scheduler_phase_resume.py::test_scheduler_continuation_clock_reaches_both_host_capture_paths

Ruff/diff hygiene 与 exact-head canary direct/run checks 无失败;manual_hold_count=1。手工 benchmark/authority 判断由本次完整评审执行,不把该 hold 写成自动通过。

Docker 资格运行了真实 Linux guest scheduler、Host 两个入口和 Docker 归档;native seal 与 evaluator 调用用隔离替身,未重跑原作者报告的 pinned SForge seal 或付费模型,335 项原生环境相关跳过未计为通过。macOS 本地导出卷未通过 Linux 存储资格,实际 Docker 测试在 Linux /tmp 完成,未放宽生产校验。

Reviewed head: f0625c3bd16a91e466df2cc14b7370946b809d37. Historical timing claims or failures are not reused as evidence for an unmeasured final implementation.

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.1-sol, OpenAI, runtime_reported, reasoning_effort=max

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

动机 / Motivation

原地续跑保留旧阶段时钟作为恢复凭证,恢复后的 scheduler 则使用单独获准的新时限。此时再捕获 checkpoint,记录的剩余额度应该来自这次续跑。评审覆盖已发布的续跑入口、正常 runner 的 supervisor 构造、held capture 和失败后的 terminal preservation。这次对照为同一保留 worker 提供已过期的原文件和独立的新时钟。当前改动使两个适配器都能接收新文件,但续跑入口没有把新时钟交给它们。评审走实际入口和捕获请求,Docker daemon 与 evaluator seal 由夹具模拟。

改动思路 / Approach

复用已有的 phase_deadline_path 请求字段和捕获 owner。显式选择一份物理时钟后,held 和 terminal 请求都用这份文件,原文件及 evaluator 机会和冷却仍由原 owner 管理。改动范围限于 benchmark 适配器构造和捕获请求。缺少的是在已有续跑路径上绑定已经获准的新时钟。

具体改动 / Changes

评审 3535876,基线 c44eb15,6 个路径,+49/−14。对照原地继续的入口契约:same-active-clock 的续跑入口尚未接线,capture-routing 和 fresh-default-and-source-retention 的适配器行为已验证。

关键代码讲解

对主干的风险 / Risks

P2 · 受支持的原地续跑仍无法让自动捕获使用新时钟。 同一份保留 worker 夹具放入已过期的原文件和剩余 800 秒的新文件。实际 scheduler 入口选择新阶段,正常 runner 构造的 supervisor 却在基线和候选上都让 held、terminal 请求读到旧文件和 0 秒。候选显式给构造函数传入新路径后,两条请求都读到 800 秒;新建阶段在两版都读到默认文件的 400 秒,原文件字节均不变。把当前已核准的时钟接到现有续跑和捕获交接处,并从该入口覆盖两个请求;保留旧证据和未继续时的默认值。

我的整体评价 / Verdict

请求修改续跑接线。独立对照检查了两个捕获请求、归档读取和阶段预算计算。两版各 4 个对照用例及 43 个现有显式恢复用例通过;候选的相关源码套件 448 项通过、45 项跳过。standard premerge 的 5 项直接检查和 19 项自动检查通过,benchmark 人工门单独保留。本次没有复跑作者报告的 Linux/Docker seal。

English verdict: REQUEST_CHANGES. Both adapters honor an explicit alternate clock, but the shipped in-place continuation still leaves automatic capture on the expired default. Wire the verified active clock into that caller while preserving the original witness.

@mergify

mergify Bot commented Nov 9, 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 9, 2026
Signed-off-by: huangruiteng <huangrt01@163.com>

# Conflicts:
#	benchmark/tests/test_terminal_preservation.py
…ure paths

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 10, 2026
@huangruiteng huangruiteng changed the title Bind benchmark checkpoints to the resumed phase clock fix(benchmark): route admitted continuation clocks into automatic captures Nov 10, 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.1-sol, OpenAI, runtime_reported, reasoning effort max

动机 / Motivation

原地恢复中断 benchmark worker,随后保存 held checkpoint 或终止现场的运行者。 原时钟作为恢复证据保留且已经过期,scheduler 成功选择剩余 800 秒的新阶段;旧默认 supervisor 却仍把两个捕获请求指向旧文件,只有手动传新参数才有效。原 PR 的可选参数没有到达正常调用者。

成功选择续跑阶段后原子发布该阶段时钟,两种默认捕获自动读取同一物理文件;新建 worker 继续读原 400 秒时钟。真实 Linux/Docker 对照旧实现 1 失败/1 通过,新实现两项通过,原时钟字节均保持。

不增加 scheduler 或 native evaluator 预算、评分机会、冷却、恢复权限或自动失败重试;不把失败 Turn 伪装成已完成。

改动思路 / Approach

scheduler.resume_state_file 是现有准入 owner,只在成功选择或同阶段重放之后发布向下取整的 active-phase-deadline。Host 的一个 resolver 同时服务 held 和 terminal 路径;保留非默认显式路径,缺少新时钟的新 worker 使用旧路径。删除 FailurePreservation 的重复路径配置,避免两个适配器漂移。

新文件是已获准 phase deadline 的派生物理运输值,原 phase witness 和 append-only phase state 不变。未知 IO 或非法时钟不以旧值静默兜底,拒绝续跑不发布新时钟。

入口为 现有 benchmark.runtime.scheduler 的原地续跑入口 → 默认 CheckpointSupervisor;权威输入来自 已核准 phase_deadline、锁内阶段状态、Docker 容器中的原物理时钟,由 resume_state_file 现有准入及 capture_phase_deadline_path 运输选择 决定,结果交给 checkpoint_worker 的实际归档读取与捕获请求。active-phase-deadline 可由锁内已接受 phase_deadline 重建,仅在成功选择后、派发前更新;随容器生命周期退役,不是额外预算或调度准入 owner。 相同领域的可逆精简已经在本次完成;没有把职责搬成另一套平行规则。

具体改动 / Changes

关键代码讲解

resume_state_file:只在成功分支或原阶段合法重放返回前发布既有 deadline;没有在拒绝分支扩大时间。 输入来自已核准 phase_deadline、锁内阶段状态、Docker 容器中的原物理时钟,下游为checkpoint_worker 的实际归档读取与捕获请求;失败由拒绝保持原阶段;发布失败不派发;同请求可重放,未知读取错误保持失败现场处理。

capture_phase_deadline_path:通过实际 Docker archive 判断是否有获准续跑时钟,默认新建路径保留,非默认自定义路径优先。 输入来自已核准 phase_deadline、锁内阶段状态、Docker 容器中的原物理时钟,下游为checkpoint_worker 的实际归档读取与捕获请求;失败由拒绝保持原阶段;发布失败不派发;同请求可重放,未知读取错误保持失败现场处理。

finish:终止保存复用 supervisor 的同一选择,不维护第二份时钟配置;失败现场保留和 stop 流程仍由原 owner 处理。 输入来自已核准 phase_deadline、锁内阶段状态、Docker 容器中的原物理时钟,下游为checkpoint_worker 的实际归档读取与捕获请求;失败由拒绝保持原阶段;发布失败不派发;同请求可重放,未知读取错误保持失败现场处理。

规格依据:https://github.com/loopx-project/loopx/pull/8398#discussion_r4508289910,固定修复前版本 353587646b01a17dacaddac2643fa5ace90a988d。映射标签 default-capture-active-clock:受支持原地续跑后的两个自动捕获必须读取已获准的新阶段时钟,同时保留原时钟证据和新建 worker 默认值。 —— implemented,验证来自公开测试入口 uv run --extra test python -m pytest -q benchmark/tests/test_scheduler_phase_resume.py benchmark/tests/test_terminal_preservation.py benchmark/tests/test_interruption_recovery.py benchmark/tests/test_stopped_recovery.py benchmark/tests/test_sforge_runtime.py; LOOPX_EDGEBENCH_DOCKER_SMOKE=1 python -m pytest benchmark/tests/test_scheduler_phase_resume.py::test_scheduler_continuation_clock_reaches_both_host_capture_paths。该标签是本次评审的映射名,不伪称规格原有编号。

差异形态:production: 4 files +46/-12; tests_or_fixtures: 3 files +117/-8; docs: 1 files +10/-0; generated: 0 files +0/-0; mechanical_moves: 0 files +0/-0。新建 worker 没有续跑时钟时沿用 phase-deadline;未启用 terminal preservation 的普通成功清理保持原流程。

对主干的风险 / Risks

派生时钟若在资格判断之前写入或与两个捕获器分别配置,会产生虚假剩余时间。当前发布在原阶段锁内的成功出口,floor 不增时;Docker 只在 NotFound 时回默认,其他错误不吞掉。阶段状态已写但时钟写失败时不得继续派发,原请求重放可重建时钟。

正向:真实 guest scheduler 选择新阶段后,两种 Host 捕获请求读取约 800 秒;未续跑的对照均读取约 400 秒;原文件摘要不变。 负向与恢复:后续阶段出现硬失败、未完成原生执行或无有效 receipt 时保持原阶段,不更新已发布时钟;重复同请求不延长截止时间,缺失和非法路径按现有物理读取规则处理。

验证:相关源码套件 116 passed / 335 skipped;最终阶段套件 20 passed / 2 opt-in Docker skipped。另在隔离 Linux Docker 真实 scheduler 和 archive 路径上显式执行 fresh/continued 两种情况,2 passed;同夹具旧实现仅续跑失败。Ruff 与 Python 编译通过。 Ruff/diff hygiene 与 exact-head canary direct/run checks 无失败;manual_hold_count=1。手工 benchmark/authority 判断由本次完整评审执行,不把该 hold 写成自动通过。 历史失败保留为反例,不把新 head 的通过反写成历史通过。GitHub CI 与合并策略是单独的 readiness 判断;本结论不从红绿状态推导代码正确性。

Docker 资格运行了真实 Linux guest scheduler、Host 两个入口和 Docker 归档;native seal 与 evaluator 调用用隔离替身,未重跑原作者报告的 pinned SForge seal 或付费模型,335 项原生环境相关跳过未计为通过。macOS 本地导出卷未通过 Linux 存储资格,实际 Docker 测试在 Linux /tmp 完成,未放宽生产校验。

既有维护性预算报告未触及本次路径的 chat_agent.py 债务,canary 自身标为 advisory_inherited_failure;未把它写成全树预算通过。

远端 CI 已单列核对:kernel-static-checks 的五个 E702 均在未修改的 tests/test_chat_codex_auth.py,该文件与 9201d84 基线 Git blob 完全一致。stage2c 的汇总记录 skipped,checks、pytest 和 merge-gate 随前置静态失败或跳过而失败,并非这些汇总实际运行后发现新的测试回归。CI 未全绿,不计作已通过;当前改动的不变量由上述本地和真实入口证据独立验证。

我的整体评价 / Verdict

最终评审版本为 f0625c3bd16a91e466df2cc14b7370946b809d37,检查覆盖整个剩余 diff 与当前调用方,不仅是最后一条 comment。成功选择续跑阶段后原子发布该阶段时钟,两种默认捕获自动读取同一物理文件;新建 worker 继续读原 400 秒时钟。真实 Linux/Docker 对照旧实现 1 失败/1 通过,新实现两项通过,原时钟字节均保持。 新文件是已获准 phase deadline 的派生物理运输值,原 phase witness 和 append-only phase state 不变。未知 IO 或非法时钟不以旧值静默兜底,拒绝续跑不发布新时钟。 上述已有缺陷均有入口级反例与恢复读回,未发现仍需阻止本次交付的具体问题。

已检查 benchmark/runtime/scheduler.py 及现有消费者,本 PR 不改变渲染布局或内容层级;本次验证集中于入口、状态与恢复。 没有对已安装 App、真实个人账号或付费模型作额外观测。

不增加 scheduler 或 native evaluator 预算、评分机会、冷却、恢复权限或自动失败重试;不把失败 Turn 伪装成已完成。 合并仍需该版本的远端 head、未解决线程、旧阻塞评审与 readiness 读回;本评审不自行赋予合并或付费执行权限。

English verdict: APPROVE. Head f0625c3. The bounded fixes preserve existing authority and recovery contracts; the stated untested boundaries are not claimed as verified.

@huangruiteng
huangruiteng merged commit 2206f8a into main Nov 10, 2026
24 of 47 checks passed
@huangruiteng
huangruiteng deleted the codex/benchmark-retained-phase-clock branch November 10, 2026 06:23
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