Skip to content

Fix delegated host lease expiry after wall-clock rollback - #9523

Merged
huangruiteng merged 2 commits into
mainfrom
codex/host-lease-deadline-fix
Nov 28, 2026
Merged

huangruiteng merged 2 commits into
mainfrom
codex/host-lease-deadline-fix

Conversation

@hhyykk

@hhyykk hhyykk commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator

Problem

Re-reading an unchanged delegated Host lease after a backward wall-clock correction could rearm the expiry timer from the corrected clock. A local regression fixture reproduced a Host returning successfully and writing a marker after the previously proved deadline.

Fix

  • Carry process-local monotonic elapsed time across wall-clock corrections when scheduling expiry, deciding when to renew, and validating a returned proof.
  • Keep or shorten the deadline on unchanged-version readback. Accept a later deadline from an advanced version only while the currently proved window is still open.
  • Preserve the original process cancellation and cleanup path. Document the deadline rules and add a Lean model with a counterexample for raw wall-clock comparison.

Verification

  • On the submitted source, the delegated Host regression passed with one test and zero failures. It uses a real child process, changes only the supervisor's test clock, and asserts both the deadline cancellation reason and absence of the late marker.
  • Lean 4.22.0 checked six declarations with trust level 0 and warnings treated as errors. The model covers elapsed-time projection and proof acceptance. The runtime test checks the link to the supervisor.
  • Both checks were run by the requesting operator. The repository-wide suite and machine suspend behavior were not evaluated in these runs.

Author declaration

Written by OpenAI Codex. Both commits are DCO-signed. There is no UI change.

Codex added 2 commits November 27, 2026 23:24
Signed-off-by: Codex <codex@localhost>
Signed-off-by: Codex <codex@localhost>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-27T15:31:35.018961Z 5bf48eb PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@loopx-agent loopx-agent 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-sol · OpenAI · runtime_reported · xhigh

动机 / Motivation

运行本地委派任务、依赖租约限制宿主工作时间的操作者。 系统时间校正时,监督进程应继续跟踪已经确认的执行期限。 候选使用单调流逝时间监督已确认期限,同版本读回只能保留或缩短期限。 只改监督进程的时间计算和本地验证,沿用既有租约所有者、证明格式和终止清理。

改动思路 / Approach

租约存储继续提供原身份与版本。监督进程统一用单调时间约束续期与最终读回,避免在每处重新解释另一份截止时间。 只改监督进程的时间计算和本地验证,沿用既有租约所有者、证明格式和终止清理。 已确认截止之后仍走原来的退出和清理路径。进程结束后保留最终证明校验,普通输出、取消与诊断仍由原入口返回。独立时钟状态只存在于这一次本地执行。

具体改动 / Changes

基线 2302e42,精确提交 5bf48eb。六个文件 +149/-17。leased-host-deadline 和 preserve-host-results 均以原 Host 路径核对。版本截止规则留在监督进程,参考文档、测试和 Lean 模型陈述其边界。 原委派约束

关键代码讲解

  • leaseTime 给同一监督使用一致的流逝时间。 源码
  • currentProof 先核对原证明和现有期限。相同版本保持或缩短期限,后续有效证明须在原窗口内读取。 源码
  • schedule 保留原进程停止与清理,最终结果仍需完成原租约读回。 源码

对主干的风险 / Risks

基线 16 项、候选 17 项 Host 测试通过。共享的 16 个用例均通过,覆盖正常输出、等待、撤销和进程清理。另有 51 项租约与原生入场用例、77 项续期与交接用例通过。 候选新增的防护用例用实际本地子进程验证到期后的停止结果,没有观察到延迟写入。 TypeScript 类型和 Git 差异检查通过。本轮验证在本地隔离进程和现有测试存储中进行。Lean 编译、系统休眠、已安装发布版和远端 CI 未复验。

语义与验证对齐

复用既有取消与证明状态。说明中的截止条件与候选运行时测试一致,模型的假设只覆盖进程内时间,系统休眠仍需单独证据。

我的整体评价 / Verdict

受控 Host 在已确认期限内继续通过现有执行入口,届满仍能给出明确的取消结果。正常委派和原授权检查通过,恢复不增加用户操作。当前证据支持这一局部修复。本轮验证在本地隔离进程和现有测试存储中进行。Lean 编译、系统休眠、已安装发布版和远端 CI 未复验。

English verdict: APPROVE at 5bf48eb. The supervisor preserves the proved deadline and existing Host behavior in local validation.

@huangruiteng
huangruiteng merged commit a98ce51 into main Nov 28, 2026
30 of 33 checks passed
@huangruiteng
huangruiteng deleted the codex/host-lease-deadline-fix branch November 28, 2026 01:24
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.

3 participants