Skip to content

fix(checkpoint): classify occupied destinations - #8608

Merged
huangruiteng merged 1 commit into
mainfrom
codex/checkpoint-destination-conflict-20261111
Nov 11, 2026
Merged

huangruiteng merged 1 commit into
mainfrom
codex/checkpoint-destination-conflict-20261111

Conversation

@loopx-agent

Copy link
Copy Markdown
Collaborator

A checkpoint replay into an occupied directory surfaced as an unexpected handler failure. If a second capture took the destination during publication, the losing caller received a generic filesystem error. Both now return the existing state_conflict diagnostic so the caller can choose another destination.

The checkpoint owner checks occupancy before copying and translates a collision during the existing no-replace publish. A permission failure needs a confirmed destination entry before it is classified as a conflict.

Validation on macOS

  • The occupied replay and concurrent capture checks fail on the previous implementation and pass with this change. Only one capture publishes and its files remain intact.
  • Replayed a retained checkpoint into two temporary destinations through the managed runtime. A replay into the edited destination returned the conflict while preserving both copies and their source. The public CLI independently verified the untouched copy.
  • Checkpoint TypeScript tests, Python transport and CLI tests, TypeScript type checking, and Ruff passed. The optional native CLI test was skipped.

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 · gpt-6.1-sol · OpenAI · runtime_reported · max

本次评审对应提交 6a42539a807138ecf2de89a82abefdcf087166fb。

动机 / Motivation

将研究 checkpoint 封存或复制到独立目录、随后校验原件的操作者与 runtime 调用者。目标已占用时,Effect 返回意外 handler 错误。发布中的碰撞返回泛化 I/O 错误,两类情况都缺少可行动的冲突分类。预检查和最终发布的目标冲突均返回 state_conflict。普通权限拒绝保留原诊断。两个并发请求只有一个发布成功,获胜目录和原件逐字节保持。预检查和最终发布的目标冲突均返回 state_conflict。普通权限拒绝保留原诊断。两个并发请求只有一个发布成功,获胜目录和原件逐字节保持。实际验证在 macOS 使用本地 Effect、目录和原生 Codex 回环;权限错误由发布边界定点注入,未测 Windows 原生 rename、已安装采用或托管 CI。

改动思路 / Approach

保留现有的 no-replace 发布与原件校验,由 checkpoint owner 识别占用。两条写入路径在预检查和最终发布共用冲突诊断,其他 I/O 错误继续经原 Effect 映射。 只在 checkpoint 的发布边界转换可确认的占用错误。正式校验、原件摘要和暂存清理由现有 owner 处理,读取与发布权限不从错误码推导。

具体改动 / Changes

关键代码讲解

按现有 capture 契约核对。NO-REPLACE、TYPED-OCCUPANCY、RETAIN-IO-FAILURE 均通过。预检查 用 lstat 检测任何目录项,包括悬空链接。最终发布 识别真实碰撞,并在权限错误后确认目标存在。捕获和复制共用这个分支。既有发布原语继续负责独占目标,失败请求只删除自己创建的暂存目录。公开 verify 仍检查原始摘要和实际成员,也读回了并发的获胜结果。最新主干已合入 #8607 的错摘要分类,实际组合 tree 复跑得到相同结果。

对主干的风险 / Risks

用实际管理 Effect 运行已占用目录、悬空链接及并发发布。复制与捕获在最后一步遇到外部写入时均保留外部文件,失败调用清理自己的暂存。同样的 EACCES 在目标存在时为 state_conflict,目标不存在时仍为 io_permission_denied。该分支的错误由测试在实际发布点注入。两个真正并发的捕获只有一个发布,公开 CLI 以精确摘要验证了获胜产物。

语义与 CI 对齐

当前 21 项 TS、3 项传输和 3 项公开 CLI 用例通过,包含本机 Codex 的回环验证。类型检查、Ruff、diff、双语与 DCO 通过。合入 #8607 的组合预览另跑 21 项 TS 和同一组真实 Effect 反例。Windows 原生 rename 和托管 CI 未验证。

我的整体评价 / Verdict

同意当前提交。它让调用者识别已有目标与并发碰撞,验证后的产物、源文件、未占用权限拒绝和实际发布边界均通过复核。 已核对公开 CLI 的实际校验入口。 这次只改 artifact 错误分类,未测 Windows。

English verdict: APPROVE. Occupied targets now consistently report state_conflict. Independent publication races preserve the winner and ordinary permission errors; the current main combination passes.

@huangruiteng
huangruiteng merged commit 04958a8 into main Nov 11, 2026
25 of 44 checks passed
@huangruiteng
huangruiteng deleted the codex/checkpoint-destination-conflict-20261111 branch November 11, 2026 18:25
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