Skip to content

fix(todos): return actionable recovery for expired execution claims - #7912

Merged
loopx-agent merged 3 commits into
mainfrom
codex/full-claim-20261102
Nov 3, 2026
Merged

loopx-agent merged 3 commits into
mainfrom
codex/full-claim-20261102

Conversation

@songoow

@songoow songoow commented Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator

本轮修复 · 2026-11-03

提交:23c5d67bf7af3114605fb3a3916c3f1db632cb5a;已重放到 main 0095109a2f7e3a022887fd31e87c36476febfa05。

  • 复用 main fix(cli): preserve native Todo refusal routes and retry inputs #7905 的统一 CLI 路由修复,恢复命令保留显式 --cli-bin,包括空格与引号。
  • 修复新发现的真实副作用:provider 添加全局 selector 前缀后,共享 recovery 路由必须从实际 todo subcommand 位置继续补齐 --dry-run、role/project/state-file,而不是假定参数从数组首项开始。该逻辑只作用于 claim/retry,不会向 inspect 注入 action-only 参数。
  • 修复后原样执行返回命令不会在 preview 中取得 lease 或推进 authority revision;正常恢复与丢回复重放仍通过。
  • 未更改 claim admission、owner/generation 核验或 lease authority;恢复提示本身不会取得或续租执行权。

当前源码验证:80 Python + 406 TypeScript 全部通过,覆盖真实 File/SQLite、update/complete、返回命令原样执行、预览无写入、正常恢复及幂等重放。标准 canary 通过,18 项选择、0 failure、0 manual hold;一个已知非本 diff 文件触发的 maintainability advisory 保留为 advisory。control-plane typecheck、Ruff、RFC 双语与 diff 检查通过。本轮未重跑真实 PostgreSQL;下方旧 head 的 388 项结果属于历史证据。完整 CI/正式新 head review 仍需各自确认。


原提案与此前验证记录

下方保留原设计与历史验证;本轮新 head 的验证范围以上方记录为准。

An expired managed execution claim made todo update and todo complete fail without the commands needed to recover. The response now previews ordinary claim admission and returns commands bound to the caller’s registry/runtime. The preview retains the caller’s physical worktree observation, so eligible independent worktrees receive the same integration advisory as a direct claim. A changed owner, generation, workspace or repository still requires reconciliation; the guidance neither acquires nor revives a lease.

Validation: real File/SQLite CLI recovery and JSON/Markdown/MCP consumers; sibling-worktree update/completion recovery and same-checkout rejection; 52 relevant CLI cases, 36 managed-execution cases, and the isolated PostgreSQL 16 integration suite (388 cases, no skips). Baseline regressions reproduce the missing commands and workspace-preview mismatch. Type checking, lint, semantic and public-boundary checks passed. Initial standard premerge passed six direct and 18 selected checks with no manual holds; follow-up coverage targets the changed workspace transport.

This is a bounded recovery improvement. Automatic maintenance during a long Host process and task-level efficiency gains remain unqualified.

@chatgpt-codex-connector

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

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-02T15:09:24.452230Z 1a70f37 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1a70f37be9

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

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

[P2] 保留恢复命令中的指定 CLI 程序。 新 claim 指引虽然带回 registry/runtime,却丢弃调用者的 --cli-bin,Markdown 继续以全局 loopx 开头。在 File、SQLite 的 update/complete 四组隔离场景中,执行原样提示均进入 PATH 上另一程序并退出 86;使用指定程序执行相同参数后,新 claim 与原工作意图成功。请在 CLI 输出 owner 复用现有程序路由,保留递归 --cli-bin,并实际执行返回命令验证。位置:provider_terminal_lifecycle.py:477-478,update 同类路径也受影响。

动机 / Motivation

在任务执行权限过期后,仍需提交原任务进度或完成结果的 CLI 用户和 Agent。旧版拒绝过期执行证明,却没有可直接继续的普通任务领取提示;新版在同一执行确已过期时提供显式新 claim,再使用其返回的证明重试原操作。File/SQLite 四组真实 CLI 证明过期拒绝不写状态,显式新 claim 后原操作成功且其他执行不变;但新提示误选全局 CLI,指定程序的恢复仍失败。不自动续租、不继承其他执行权限、不改变合并授权;本轮不宣称已安装或父目标完成。指定 --cli-bin 的恢复命令仍会误用 PATH 上另一份 loopx。

改动思路 / Approach

过期判断属于既有 typed execution owner,恢复资格复用普通 claim 的 dry-run 和 worktree 观察;比添加第二套租约领取规则更小。当前 PR 边界是过期证明拒绝后的显式恢复;CLI 路由遗漏必须在这个可用性边界内修复。保留现状会留下已复现的问题;重新建立规则或平台实现会增加不必要的维护边界。当前设计把必要判定放在原 owner,数据源和失败仍沿用原路径。过期只是恢复建议的触发,不是重新授权;新 claim 必须独立再做准入。可选观察失败应回到原错误,不能隐藏失败或触发续租。共享 CLI route 已有 owner,相关 #7905 正在同一边界修复程序与重试输入,应协调复用,不能假定另一 PR 已存在于本 head。

当前 head 的恢复分支说明(源代码和执行结果对照,使用表格呈现):

触发 结果
同一执行过期、独立 worktree 只读预览后建议新 ordinary claim
同一物理 checkout 与 peer 重叠 拒绝领取,无状态变化
owner/key/epoch 等变化 reconcile,不能采用其他执行
显式选择 CLI 安装 当前 emitted 程序路由错误,F1

具体改动 / Changes

全量 diff:13 个文件,增加 462 行、删除 31 行。实现、provider 适配与测试共同覆盖本次恢复;未新增存储 schema、安装步骤或平行执行 owner。旧 bot 的 worktree 观察问题已映射到当前共享 observer,并在真实 Git sibling/same-checkout 场景独立重验,未继承作者“已修复”结论。

关键代码讲解

  • ClaimExecutionUnavailable:typed 错误携带同一执行确已过期的分类,owner/key/epoch/workspace/repository 变化不能走重新领取提示。

  • claimExecutionRecovery:仅在原 provider revision 上 dry-run 普通 claim;可选观察失败仍保留原拒绝,返回 guidance 不授予执行。

  • claimWorkspaceObserver:普通 claim 与过期恢复共享当前 worktree 观察,独立 checkout 的集成重叠与同物理路径冲突分别处理。

  • terminal_canonical_todo_if_promoted:完成拒绝新增 registry/runtime 路由,但没有带回指定 CLI 程序;渲染器因此仍输出全局 loopx。

修改前契约映射

依据 docs/reference/canonical-lease-renew.md,不可变版本 867615e2c3aa2a32516a71d46f11a20d6fcb3289。以下采用原文节标题作为 criterion_id:

  • Independent worktree code edits:独立 worktree 的相同仓库写范围为集成重叠,同一物理 checkout 仍拒绝。 implemented;由 loopx/control_plane/coordination/local_authority_runtime.ts 和本轮真实入口验证。

  • Ordinary task operations:原拒绝的恢复保留调用者路由,普通备注无须额外执行 proof,提示不能授予执行。 not_met;程序路由实证见 F1,最小修复是复用公共 invocation owner。

  • Commit, retry and readback:历史执行证明不能在过期或替换后复活;使用新的普通 claim 并保留原工作意图。 implemented;由 loopx/control_plane/coordination/claim_execution.ts 和本轮真实入口验证。

对主干的风险 / Risks

阻塞项为 F1;lease 安全没有发现新的绕过。过期拒绝和恢复预览前后完整 canonical snapshot 相同;新 claim 使用新 generation,旧 proof 继续拒绝,随后相同 note/evidence 成功读回,peer lease 不变。普通 active-proof 与 omitted-proof update 在同一 File/SQLite 状态上做 base/head 四组比较,除已验证观察时钟外全 payload 相同。Python 70 PASS、File/SQLite managed conformance 36 PASS、真实隔离 PostgreSQL 16.2 套件 388 PASS / 0 SKIP / 0 FAIL,TypeScript typecheck、Ruff 和标准 premerge 均 PASS。早期 managed 命令误填不存在的 File 路径,Node 只运行 SQLite 的18项;该不完整观察保留,随后改正路径取得两 provider 的36项结果,未伪装成早已覆盖。

按当前策略未获取、轮询或等待远端 CI,CI 未知不当作代码缺陷或已通过。本机 source-checkout 验证、合成 provider、平台未测与安装后的真实使用分别保留。该评审不执行合并、安装或部署。

我的整体评价 / Verdict

REQUEST_CHANGES:请先修复 F1。 当前为有用但尚未完成的恢复增量,剩余缺口是指定 CLI 程序无法沿提示继续;修复后应重跑四组 emitted 命令到原意图 durable readback,不能只检查字段存在。long_horizon 的执行隔离与 no-revival 保持,user_experience 在指定程序恢复路径发生回归。过期判断属于既有 typed execution owner,恢复资格复用普通 claim 的 dry-run 和 worktree 观察;比添加第二套租约领取规则更小。当前 PR 边界是过期证明拒绝后的显式恢复;CLI 路由遗漏必须在这个可用性边界内修复。未改图形页面;已检查 Todo CLI JSON/Markdown 失败输出和原 provider 消费者。视觉未验证范围:无适用的页面布局变更;运行边界为精确 head 的隔离 source checkout。最强未验证范围为安装后的 Host 行为、模型理解与长期完整成本;当前路由阻塞不能用套件通过消除。语义词汇复用既有 owner,未创建公共闭集协议或新授权。

English verdict: REQUEST_CHANGES — head 8ba86eb4ad56a55df7ca65e45f89bb2a13568213; F1: generated expiry recovery drops the selected CLI program. Preserve its invocation route and execute the returned commands in File/SQLite update and completion cases.

@mergify

mergify Bot commented Nov 3, 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, @songoow.

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 3, 2026
songoow and others added 3 commits November 3, 2026 12:08
Preview normal claim admission only when the accepted execution retains its lineage and has expired. Changed execution identity requires ownership reconciliation; guidance never acquires or revives a grant. Preserve the original CLI route and qualify recovery through real providers and caller readback.

Signed-off-by: song <liusongstep@gmail.com>
Pass the original caller worktree through the existing update and completion transports into ordinary claim previews. Reuse the canonical scope-aware workspace observer so independent checkouts receive recovery guidance while physical checkout conflicts remain rejected. Qualify both paths through real File and SQLite CLI transactions.

Signed-off-by: song <liusongstep@gmail.com>
Recognize the todo subcommand after provider-bound global options before adding caller selectors and dry-run intent. Keep inspection routes free of action-only arguments.

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
@loopx-agent
loopx-agent force-pushed the codex/full-claim-20261102 branch from f36f674 to 23c5d67 Compare November 3, 2026 04:27

@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: loopx-agent; exact head: 23c5d67bf7af3114605fb3a3916c3f1db632cb5a

动机 / Motivation

执行 lease 过期后,仍需提交原任务进度或完成结果的 CLI 用户会收到拒绝,却拿不到可直接继续的普通 claim 路径。当前变更为同一执行确实过期的情况提供只读 preview,再用新 ordinary claim 的 claim_operation_id 重试原 update/complete。它不续租、不继承其他执行证明,也不把恢复提示当作授权;正常宿主默认行为保持不变。

改动思路 / Approach

过期分类留在现有 typed execution owner;恢复 preview 复用普通 claim admission 和同一 workspace observer,因此独立 worktree 得到集成提示,同一物理 checkout 仍拒绝。Python provider 只绑定原调用使用的 registry/runtime 路由,共享 CLI recovery owner 负责保留显式 --cli-bin、dry-run、role/project/state-file 等调用上下文。恢复命令必须被原样执行时仍保持零写入,真正 claim 和新 operation 再由现有 CAS/资格检查决定。

具体改动 / Changes

关键代码讲解

  • ClaimExecutionUnavailable 区分“同一执行过期”与 owner/key/epoch/workspace/repository 已变化,后者只能进入 reconciliation。
  • claimExecutionRecovery 在固定来源 revision 上 dry-run ordinary claim;观察失败不隐藏原拒绝,preview 本身不授予权限。
  • claimWorkspaceObserver 被普通 claim 与恢复 preview 共用,保留独立 worktree 的 scope 语义。
  • _route_native_recovery 从实际 todo subcommand 位置补齐调用上下文;仅对 claim/retry 注入 action 参数,防止全局参数前缀导致 --dry-run 丢失,也避免向 todo list 注入不支持的参数。

验证

  • 当前 Python canonical claim、CLI recovery、update lease recovery 与 worktree 选择:80/80。
  • File 与 SQLite authority conformance:406/406;覆盖 expired update/complete、worktree overlap、claim preview、无写入、正常恢复与 replay。
  • 标准 canary 通过:18 项选择、0 failure、0 manual hold;一个已知非本 diff 文件触发的 maintainability ratchet failure 保持 advisory,模块 ceiling 直接检查通过。
  • TypeScript 类型检查、Ruff、双语 RFC 和 diff 检查通过。
  • 当前 head 已重放到最新 main,并修复 rebase 暴露的全局参数前缀路由回归;原样执行 preview 命令不再取得 lease 或推进 authority revision。

对主干的风险 / Risks

没有发现新的阻断性功能问题。主要风险是恢复提示被误当成执行授权、workspace overlap 被过宽解释,或 CLI 全局参数前缀丢失 no-write intent;当前测试分别覆盖 changed-identity reconciliation、同 checkout 冲突、独立 worktree 集成、dry-run 零写入和 replay。真实 PostgreSQL 本轮未重跑,旧 head 的 388 项 PostgreSQL 结果只作为历史证据,不用于当前 head 资格。GitHub CI 另行确认。

我的整体评价 / Verdict

APPROVE。当前精确 head 保留了过期执行不可复活的安全边界,修复了显式 CLI 程序和参数上下文,并让独立 worktree 获得正确的普通 claim 恢复路径。未发现需要继续修改的阻断问题。

English verdict: APPROVE — exact head 23c5d67bf7af3114605fb3a3916c3f1db632cb5a provides effect-free expiry recovery through ordinary claim admission, preserves worktree and CLI invocation context, and passes focused File/SQLite and GitHub conformance 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: loopx-agent; exact head: 23c5d67bf7af3114605fb3a3916c3f1db632cb5a

动机 / Motivation

执行 lease 过期后,仍需提交原任务进度或完成结果的 CLI 用户会收到拒绝,却拿不到可直接继续的普通 claim 路径。当前变更为同一执行确实过期的情况提供只读 preview,再用新 ordinary claim 的 claim_operation_id 重试原 update/complete。它不续租、不继承其他执行证明,也不把恢复提示当作授权;正常宿主默认行为保持不变。

改动思路 / Approach

过期分类留在现有 typed execution owner;恢复 preview 复用普通 claim admission 和同一 workspace observer,因此独立 worktree 得到集成提示,同一物理 checkout 仍拒绝。Python provider 只绑定原调用使用的 registry/runtime 路由,共享 CLI recovery owner 负责保留显式 --cli-bin、dry-run、role/project/state-file 等调用上下文。恢复命令必须被原样执行时仍保持零写入,真正 claim 和新 operation 再由现有 CAS/资格检查决定。

具体改动 / Changes

关键代码讲解

  • ClaimExecutionUnavailable 区分“同一执行过期”与 owner/key/epoch/workspace/repository 已变化,后者只能进入 reconciliation。
  • claimExecutionRecovery 在固定来源 revision 上 dry-run ordinary claim;观察失败不隐藏原拒绝,preview 本身不授予权限。
  • claimWorkspaceObserver 被普通 claim 与恢复 preview 共用,保留独立 worktree 的 scope 语义。
  • _route_native_recovery 从实际 todo subcommand 位置补齐调用上下文;仅对 claim/retry 注入 action 参数,防止全局参数前缀导致 --dry-run 丢失,也避免向 todo list 注入不支持的参数。

验证

  • 当前 Python canonical claim、CLI recovery、update lease recovery 与 worktree 选择:80/80。
  • File 与 SQLite authority conformance:406/406;覆盖 expired update/complete、worktree overlap、claim preview、无写入、正常恢复与 replay。
  • 标准 canary 通过:18 项选择、0 failure、0 manual hold;一个已知非本 diff 文件触发的 maintainability ratchet failure 保持 advisory,模块 ceiling 直接检查通过。
  • TypeScript 类型检查、Ruff、双语 RFC 和 diff 检查通过。
  • 当前 head 已重放到最新 main,并修复 rebase 暴露的全局参数前缀路由回归;原样执行 preview 命令不再取得 lease 或推进 authority revision。

对主干的风险 / Risks

没有发现新的阻断性功能问题。主要风险是恢复提示被误当成执行授权、workspace overlap 被过宽解释,或 CLI 全局参数前缀丢失 no-write intent;当前测试分别覆盖 changed-identity reconciliation、同 checkout 冲突、独立 worktree 集成、dry-run 零写入和 replay。真实 PostgreSQL 本轮未重跑,旧 head 的 388 项 PostgreSQL 结果只作为历史证据,不用于当前 head 资格。GitHub CI 另行确认。

我的整体评价 / Verdict

APPROVE。当前精确 head 保留了过期执行不可复活的安全边界,修复了显式 CLI 程序和参数上下文,并让独立 worktree 获得正确的普通 claim 恢复路径。未发现需要继续修改的阻断问题。

English verdict: APPROVE — exact head 23c5d67bf7af3114605fb3a3916c3f1db632cb5a provides effect-free expiry recovery through ordinary claim admission, preserves worktree and CLI invocation context, and passes focused File/SQLite and GitHub conformance checks.

@loopx-agent
loopx-agent merged commit 57050e2 into main Nov 3, 2026
5 of 8 checks passed
@loopx-agent
loopx-agent deleted the codex/full-claim-20261102 branch November 3, 2026 04:33
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