Repository navigation
Fix automatic task lease preparation before execution - #7987
Conversation
e8961c0 to
28472af
Compare
|
This pull request has merge conflicts with Choose the remote for the base repository, not an out-of-date fork. 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 HEADFor a same-repository clone whose Keep the DCO |
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent; model=gpt-6.1-sol; provider=OpenAI; reasoning_effort=max; runtime_reported; observation_id=48066dcce14f546cb8b6a1dbe5a7b15b73e5c20f2b2441640ffbbe4f7a30f1de
Exact head 28472af6f4047689354ea45ce7e6112af3d03d3f;base 60ef4136f4359f28688a328013c95476359fa711。结论 REQUEST_CHANGES,有两项已复现问题。
[P1] 子 Agent 事件仍执行父会话领取。 新增外层分支 在 codex_context_hook 已因非空 event.agent_id 返回空结果后,继续读取父 session/cwd 的准备请求并调用领取。native_execution_preparation_request 仅检查 session/cwd/source,没有保留子 Agent 排除。用真实 quota context-hook 和隔离 File/SQLite 复现:相同父 session/cwd、子 Agent 的 PostToolUse,base 返回空对象、租约和 provider revision 不变;head 两种 provider 都产生父 Agent 的新租约,并把父 Todo/Turn 的 ready 内容注入子 Agent。请在 effect 和内容投影之前统一复用原事件资格检查;补真实入口的子事件无写入/无父回执反例,且保持父会话领取恢复通过。仅测试内部 hook 返回空对象不能覆盖外层新增执行。
[P2] 新 executor 测试在 macOS 上被夹具路径提前拒绝。 _packet 的两条 /tmp 路径 在 macOS 上是未解析的目录别名,不满足 production 对物理路径的检查,三个测试均先拿到 None;ready 及 wrong-Todo/Turn 分支没有被执行。完整套件和单模块重复均为同三项失败。请把夹具及预期路由统一改成 tmp_path.resolve(),保留独立别名拒绝用例。仅在临时副本中规范化两条路径及相应预期,三个原有断言通过;这不表示未修改 head 的测试已绿,也不应放宽 production 路径校验。
动机
恢复长任务的 Agent、使用原生 Codex hook 或 KunlunCode Goal Host 的操作者。Todo 仍分配给本人但硬租约已缺失、释放或过期时,旧 guard 可能允许开始工作,直到写回才暴露租约缺口。新流程先投影一次普通领取,再由 Host 领取并重新核对同一 Todo/Turn;正常父会话恢复可用,但子 Agent 事件也能触发父任务领取,当前不能整体交付。不改变所有权或迁移策略,不授予子 Agent 父任务权限,也不替代执行后的校验、结算或进程监督。需先在自动执行入口保留子 Agent 隔离,并修复 macOS 上新增单元测试的非物理路径夹具。
改动思路
恢复必须继续复用普通 managed claim 与其原子权限检查;增加只读执行准备投影及 Host effect 适配有实际调用者,不能让 context 传输的启用替代原有 Agent 作用域检查。当前 PR 应限于同一已授权父会话的租约准备和重新检查;修复两个已证实缺陷后重跑原有入口,不要求新增配置页面或全面重构。 TS projectExecutionPreparation 只读 canonical Todo/lease;Python adapter 取得事实,interaction 暂时只暴露领取,Host 再调用现有 todo claim 并检查相同 Todo/Turn。这个分层避免新增 lease writer,但新的 Host effect 必须经过与原 context hook 相同的 Agent 边界。
独立规范为 docs/reference/protocols/peer-agent-runtime-v1.md,spec_revision 60ef4136f4359f28688a328013c95476359fa711,在 diff 前读取。原 Work Ownership 要求任务归属来自当前 claim/lease,不能由共享会话推得子 Agent 权限,本 head 在 P1 未满足;Workspace Isolation 保持原 ordinary claim 为 owner,新增 executor 校验 physical cwd,没有修改共享 writer。另读原 handoff-mode.md 的普通领取和保留回执规则,核对原 Turn 身份不被领取替换。新 status-data 描述本身不能证明这些原边界已成立。
具体改动
全 PR16文件 +1472/-6。新增 quota preparation158行、TS read projection123行、Codex executor244行均有实际调用者;其余改动接入 should-run、interaction、已有 hook journal 和 KunlunCode pre-model 流程。private journal 保存原 authority route,避免 hook 在其他项目启动时误找 registry;source/session 改变时拒绝记录 ready,成功的同 capture 请求可抑制重复,resume 可重新检查。状态文档新增31行,测试覆盖准备/同 Turn/跨项目 route,Lark 两处改动仅是既有 fixture 的 F811 标注。
已执行的父路径覆盖 File/SQLite 的 missing/expired claim→ready、相同 receipt-bound Turn、foreign lease 拒绝、explicit selection 不被替换及四组跨项目真实 hook。KunlunCode 的领取→重新 guard→模型初始化顺序也通过,但 app-server/model 是测试替身。上述成功并不能排除同一容器内未授权子事件,P1 正是相反方向的独立反例。
对主干的风险
本轮 head 五个 Python 模块 541 PASS / 3 FAIL;不可变 base 上同三个既有模块 520 PASS。三项当前失败全部来自新 executor unit fixture;隔离单模块重跑仍3 FAIL。新 TS7项、TypeScript typecheck、改动12份 Python 的 Ruff 均 PASS。standard premerge 六项 direct 通过,19项所选检查18通过、一项保留 formatter advisory,manual holds=0;这些都不能覆盖已复现的 Agent 作用域漏洞。
formatter ratchet 的完整失败签名在 base/head 相同,指向未修改的 render_canonical_todo_sections,magnitude regressions=0,归为无关既有 advisory。作者描述过早先 Lark timeout,本轮该既有路径通过;没有据此宣称早先间歇原因已解决。首次独立 hook probe 因缺少显式 runtime route 在进入 hook 前失败,补齐同一显式路由后才取得上述 base/head 结果;保留原失败,不把它当成 PR 回归。
CI 按 wait_for_ci=false 未查询、轮询或等待。阻断依据是当前真实入口的作用域回归与新测试失败,和远端 CI 是否通过无关。
我的整体评价
恢复必须继续复用普通 managed claim 与其原子权限检查;增加只读执行准备投影及 Host effect 适配有实际调用者,不能让 context 传输的启用替代原有 Agent 作用域检查。当前 PR 应限于同一已授权父会话的租约准备和重新检查;修复两个已证实缺陷后重跑原有入口,不要求新增配置页面或全面重构。 这条恢复路径有实际价值,也无需为内部准备机制增加独立设置页;本轮不要求全面重构。最低修复是把既有 native event 资格贯穿新增 effect 分支,并提供合法的跨平台测试夹具。修复后必须同时验证父恢复成功、子事件无副作用,不能只重跑本次失败断言。
没有 rendered UI 变化,检查范围是 CLI、Host 与生成 context 文本,visual review 不适用。未资格化原生 Codex/SSH 安装分发、实际 KunlunCode 模型、PostgreSQL、原生 Windows、自然长时过期或长期效果;真实 hook/CLI 验证限于源码环境和隔离 File/SQLite。 新主题/大分页和全部缺失 authority 的组合也未独立资格化,不将 snapshot 字段存在或测试总数解释为完整交付、模型采纳或长期收益。
English verdict: REQUEST_CHANGES. The exact head executes and discloses parent preparation during child hook events on real File and SQLite authorities; the immutable base has no such effects. Three new executor tests also fail on macOS because their fixture paths are not physical. Remote CI was not consulted; no merge was performed.
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>
Signed-off-by: huangruiteng <huangrt01@163.com>
Apply the native lifecycle parent-event qualification before directory IO, claim execution, manifest reads and receipt publication. Use physical tmp_path routes in executor tests so macOS exercises the same production path checks. Signed-off-by: huangruiteng <huangrt01@163.com>
28472af to
3bb33ea
Compare
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent; model=gpt-6.1-sol; provider=OpenAI; reasoning_effort=max; runtime_reported; observation_id=11ccb2fc8b916d0f1e37ca607ef3a1b72a0e885829ae0a0860aeafb68e605eb9
Exact head 3bb33ea13ce7b50d6d1112aedb7992101c483834;base/merge base 79b7818653bc4105ea27a8946de04a9ba997ff03。本轮结论 REQUEST_CHANGES。旧 P1 子事件越权和 P2 macOS 夹具均已独立验证修复;另有一项新的真实入口回归。
[P1] 合法任务选择被准备门拒绝,拿不到领取动作。 在同一 Agent 有两个合法候选任务、当前选中的新任务没有硬租约时,先执行 quota should-run --begin-turn,再用返回的原 --turn-instance-id --todo-id 完成显式选择。准备投影 提前设置 normal_delivery_allowed=false,interaction 也将 agent_channel.delivery_allowed 设为 false;现有选择 owner 因此拒绝升级 receipt。真实 File、SQLite 均返回 exit 1、quota_action_selection_conflict,明确显示 qualification_state=qualified、所请求与当前选中 Todo 相同,但 kind=not_admitted,receipt 为 write_failed。错误响应没有预期的普通 claim 动作,无法沿本 PR 的恢复路径继续。完全相同的合成夹具与命令在不可变 base 上两项通过,在当前 head 两项失败。
最低修复:复用现有选择 owner,把合法的任务绑定与租约交付准入分开;先保存同一 Todo/Turn 的 preparation-only 绑定,只暴露普通 claim,再重查同一 Turn 的 ready。不得把正常交付改为允许来绕过租约门。补上述完整双 provider 入口回归,并保持单任务、子事件、foreign lease 反例通过。
动机 / Motivation
恢复已分配长任务的 Agent,以及使用原生 Codex hook 或 KunlunCode Goal Host 的操作者。 Todo 仍归本人,但硬租约已缺失、释放或过期时,原流程可能工作到写回才发现权限缺口;新流程把普通领取和同一任务的重新检查提前到模型工作之前。 单任务父会话已能自动恢复,子 Agent 不再领取或收到父任务内容;但多个可选任务下,合法选择一个无租约 Todo 会被新的准备门误判为未准入,无法取得领取步骤。 不修改所有权策略,不授予子 Agent 父任务权限,不替代执行后的校验、结算或进程监督。 需修复显式任务绑定与租约准备之间的循环拒绝;安装分发、自然长时恢复和长期收益仍是独立资格。
改动思路 / Approach
只读 TypeScript 投影复用 canonical Todo/lease,Host 继续调用原子 managed claim;新增适配边界有实际调用者,当前缺陷应在已有任务选择与准备阶段的衔接处修复。 本 PR 应交付同一已授权任务的租约准备和同 Turn 重新检查,保留普通任务选择、子 Agent 隔离及原结算身份。 不处理会继续把租约恢复推迟到工作结束;只给提示仍需每个模型重建恢复。现有 claim 已有原子 ownership、write scope、物理工作区和 generation 检查,适合直接复用;无需增加第二个 lease writer 或独立设置页面。新的准备动作有实际 Host caller,但必须让已经合法选中的工作走到该动作。
以下是源代码分支比较,不作为执行证据;执行结果来自独立真实 CLI:
| 入口 | 预期与本轮观察 |
|---|---|
| 单任务父会话 | stale lease → ordinary claim → 原 Todo/Turn ready,PASS |
| 同 session/cwd 子事件 | 空输出、canonical 与 journal 不变,PASS |
| 多候选任务的合法选择 | 应进入 preparation-only;当前在 receipt 升级时被拒绝,FAIL |
具体改动 / Changes
全 PR 15 文件 +1520/-6:9 个生产路径增加 740 行,5 个测试路径增加 749 行,状态合同增加 31 行。不是只检查最后一次修复。Python 提取 canonical 事实、TypeScript 决定准备状态;普通 claim 保留 mutation authority。两处 Host 接入、interaction 的唯一领取动作以及 capture 旁的私有 route/ready journal 均已追到实际调用者。
规范 docs/reference/protocols/peer-agent-runtime-v1.md,spec_revision 79b7818653bc4105ea27a8946de04a9ba997ff03,并在实现 diff 前读普通 CLI 的 docs/reference/handoff-mode.md。Work Ownership:子事件不能从共享 session 获得父任务权限,当前满足;Workspace Isolation:保留普通领取的物理路径检查,当前满足;Ordinary Agent CLI work:单任务的普通领取与原 Turn 恢复通过。追加反例依据同 revision 的 docs/status-data-contract.md,Explicit action selection 仍不满足:qualified 候选在未进入 claim 前就被拒绝,而不是得到可执行的准备阶段。
关键代码讲解
projectExecutionPreparation从完整 Todo/lease 事实派生 ready、claim_required 或冲突;没有新增存储 writer。active/soft 路径保留,foreign holder 拒绝。apply_selected_todo_execution_preparation给 stale lease 限制交付,interaction 只保留 claim;F1 表明该限制与现有 selection admission 的阶段没有接好。helper 的“等待显式选择”测试不能证明真实绑定成功。native_context_event_eligible在外层 hook、context 投影、准备请求和 ready 回执前统一排除子事件;这是上轮 P1 的有效修复。execute_codex_execution_preparation只接受精确普通 claim 与物理 route,执行后检查相同 Todo/Turn;失败保留显式恢复,不把 claim 成功单独解释为 ready。handle_native_context_command在适格父事件中使用 capture 的原 authority route;从其他项目启动也不会重找父 Goal。KunlunCode adapter 同样在模型初始化前 claim/recheck,模型服务边界仍是测试替身。
对主干的风险 / Risks
| 本地检查 | 结果 |
|---|---|
| 当前五个 Python 模块 | PASS,236 项;base 三个既有模块 212 PASS |
| 同夹具真实 guard/native CLI | base 16 PASS、head 16 PASS;含 missing/released/expired、foreign、soft、80 个无关任务、子事件无副作用和父恢复 |
| 多任务显式绑定 | FAIL,base 2 PASS、head 2 FAIL,File/SQLite 相同错误 |
| 原上轮缺陷敏感性 | 旧 28472af6f4047689354ea45ce7e6112af3d03d3f 子事件两项 FAIL;当前子事件通过;当前 executor 3 PASS;额外物理 alias 拒绝及 canonical source unavailable 三项 PASS |
| TypeScript / typecheck | PASS,7 项与 control-plane typecheck |
| standard premerge | PASS,6 direct +19 selected,0 failure/advisory/manual hold;不能覆盖或豁免上述当前回归 |
保留检查历史:首次 suite 命令写错不存在的模块名,首次 premerge 误加不支持的 --execute,均在执行有效检查前纠正。新任务探索最初未完成绑定,以及一次缺少 Turn 的非法请求,属于 reviewer harness 的未通过尝试;最终产品 finding 使用文档规定的 begin-Turn、原 Turn 显式选择,并用相同脚本在 base/head 对照。旧 Lark timeout 的历史原因没有据此宣称已解决。CI 按 wait_for_ci=false 未查询、轮询或等待。
语义与 CI 对齐
新 schema 扩展执行准备投影,handoff/lease 值继续复用既有含义,子事件资格是共享结构化 helper。diff advisory 报告 0 supported carriers,同时保留它不分析动态语义的限制;standard 的 vocabulary 检查通过不等于 selection 合同已满足。F1 是当前可执行语义违反,应在现有选择/准备 owner 中修复,而非增加域特定例外或放宽交付权限。
native context 的 opt-in 只控制 transport;硬租约的前置准备是明确披露的通用行为变化。关闭 transport 的早返回、空输出及无 journal 写入仍由 base/head lifecycle 入口检查覆盖,安装或发现 hook 本身不激活它。
我的整体评价 / Verdict
只读 TypeScript 投影复用 canonical Todo/lease,Host 继续调用原子 managed claim;新增适配边界有实际调用者,当前缺陷应在已有任务选择与准备阶段的衔接处修复。 本 PR 应交付同一已授权任务的租约准备和同 Turn 重新检查,保留普通任务选择、子 Agent 隔离及原结算身份。 当前 long_horizon 与 user_experience 均有回归:已分配工作的单任务恢复改善,但合法多任务选择被迫进入没有可执行恢复动作的 receipt 错误。旧问题修复和绿色门禁不足以批准当前全 PR;修复 F1 后重跑同一双 provider 反例及原单任务/子事件路径即可,不要求全面重构。
没有 rendered UI 变化;已检查 CLI、Host、interaction 和生成 context 文本,visual review 不适用。 未验证安装 App、原生 SSH 分发、真实 KunlunCode 模型、PostgreSQL、原生 Windows、自然长时过期或模型长期采用。 已读 #8026 当前完整状态恢复方向及 Linux 六项固定本地 provider 的作者证据;这里没有创建替代 Goal/Todo 或修改 cadence,但没有独立执行两 PR 组合的 warm worker,也不把源码机械检查或作者数据当作自然模型采用、科学收益或安装资格。现有 review/merge holds 分开保留,未 dismissal、resolve 或 merge。
English verdict: REQUEST_CHANGES. At 3bb33ea13ce7b50d6d1112aedb7992101c483834, a qualified explicit selection of a Todo without a hard lease fails before its preparation action is reachable on real File and SQLite authorities; the identical baseline cases pass. The earlier child-hook and macOS fixture findings are resolved. Green local premerge and unknown CI do not waive this regression.
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
Signed-off-by: huangruiteng <huangrt01@163.com>
…on-presentation-20261104
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: actor_kind=model_agent; model=gpt-6.1-sol; provider=OpenAI; reasoning_effort=max; runtime_reported.
动机 / Motivation
恢复 SForge warm checkpoint 的操作者,以及从心跳继续已选 Todo 的 Agent。 普通心跳过去可能已选中工作却没有有效租约;新路径先投影 claim 要求,Host 取得普通租约并读回同一 Todo 后再交付。但 warm preparation 已释放自己的准备租约,现有 reader 在首次模型工作之前因此中断。 原生 Codex 能在同一 Turn 为同一工作完成普通 claim 与 ready 读回;warm-start 的既有准备入口仍需接入这一步。 本审查不启动模型、solver 或 benchmark 实验,不授予 merge 权限,也不把准备就绪当科学收益或模型采用。
改动思路 / Approach
派生租约就绪状态放在共用 TypeScript owner,Python 仅做 canonical IO,Host 使用普通 claim 并复核同一身份,边界合理;新增共享 gate 同时影响既有 warm reader,必须在该 caller 接入合法准备和失败恢复。 本 PR 应交付已选工作在 Codex、KunlunCode 和既有 warm-start caller 上的可执行准备闭环;当前后一个入口有已复现回归,不能仅凭两个 Host 的成功结束验收。
普通 guard 继续只读 canonical Todo/lease;共享 TypeScript owner 派生 readiness,Python 负责 IO,两个 Host 用现有 ordinary claim,再复核同一 Turn、Todo 和物理 route。pending selection 只允许绑定准备动作,不抬高 delivery 权限。与放松租约或新增 benchmark 专属 writer 相比,这个方向有明确用途;当前问题在既有 consumer 没有完成接入。
具体改动 / Changes
关键代码讲解
projectExecutionPreparation:从当前 canonical lease 推导 ready、claim_required、conflict 或 unavailable;没有手工同步第二份业务状态。soft mode 不新增准备义务。apply_selected_todo_execution_preparation:non-ready 会把正常交付关掉,并为可认领工作给出 ordinary claim。这保护新 Host,也改变所有消费共享 guard 的 caller。execute_codex_execution_preparation:按原捕获身份执行普通 claim,受原时间预算和物理工作区约束,再读取同一 Todo 的 ready;child 事件不能取得 parent 权限。currentActionSelectionAdmission:qualified pending selection 可先绑定到明确 preparation-only 动作;normal delivery 仍为 false,绑定不等于取得租约。
规格采用 docs/reference/protocols/peer-agent-runtime-v1.md,固定 revision 79b7818653bc4105ea27a8946de04a9ba997ff03,按既有 Work Ownership、Workspace Isolation 判断,两项均已由新 owner 和当前负向用例覆盖。另读了同 revision 的 handoff-mode 和 action-selection 合同;本 PR 新写的 status 段落不作为独立验收来源。完整18文件均已读,包括最新合入的 selection、child 修复和全部测试。
对主干的风险 / Risks
[P1] 把既有 warm preparation caller 接入普通 claim/recheck。 变化位置是上面 Python 投影的138–140行。现有 prepare_context 在 adoption 后主动释放临时租约,再于415行调用 _read_preparation;后者439–441行要求 agent_channel.delivery_allowed=true,却没有消费新的 claim_required。新 head 因而在第一次实际 work guard/模型调用前抛出 Warm continuation has no actionable current preparation or review。
同一冻结探针直接调用这个生产 helper,经真实 public CLI 和隔离 File/SQLite:base 的 released/ready 四例均通过;head 的 released 两例失败、ready 两例通过。读取前后 canonical 内容/修订不变;显式执行现有 ordinary claim,再用同一个原始整数 deadline 调用原 helper,两种 provider 均恢复同一 Todo 的 current readiness。这个对照排除了 deadline、provider 和 reader 本身不可用。最小修复是在既有 warm caller 内消费 projected claim 并做同 Todo/current ready 读回,保留原 deadline、revision bracket、ownership 和失败 fences;不能降低租约要求或把准备成功当执行授权。
本 head 五个定向模块 240 PASS,两个 TypeScript 模块 17 PASS、typecheck 和 standard premerge 均通过。标准门为6项直接检查、10项 catalog、8项 risk、1项 public boundary。独立 public/native 边界 23 PASS;base 对应探针连 warm 对照 24 PASS。这些绿色用例没有覆盖上述 consumer 回归。相邻 selection 诊断在 base/head 均为5 PASS、14 FAIL,失败 case 身份相同;保留 Stride、缺失字段和 reader argv 的完整失败,未称其由本 PR 引入或已修复。最初探针的浮点 deadline、缺少证据目录属于已纠正 harness 错误,不作为产品缺陷。
语义与 CI 对齐
没有查询、轮询或等待远端 CI。新 closed set 属于既有 typed preparation 投影,语义检查已过;当前阻塞来自真实 caller 行为。之前 child 越权与 preparation-only binding 的问题在当前新 head 已单独复核通过,未把旧结论套用新 head。合并提交的 DCO 缺少 trailer 符合既有 verified GitHub web-flow 双亲整合提交例外,未据此制造额外 blocker。
我的整体评价 / Verdict
共享 owner、普通 claim 和 Host route fences 的位置合适,范围有实际调用方;保留这个设计并补齐 warm consumer 即可,无需扩大成新 authority 协议。CLI/内部路径没有 rendered UI 变化,因此 visual review 不适用;真实 warm CLI 的额外失败/重入仍是用户体验和长程恢复回归。当前 REQUEST_CHANGES,需以同一 File/SQLite released/ready 反例和冲突/过期/异主负例重新验证修复。
未验证 installed App、真实 native session fork、模型采用、完整 benchmark 或科学收益;没有启动这些运行。formal review、独立 required validation、merge readiness 和维护者 merge authority 分别判断。
English verdict: REQUEST_CHANGES 388fdcc; the shared preparation gate regresses the existing warm-start readiness caller after lease release, reproduced on File and SQLite despite 240 targeted tests passing.
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: actor_kind=model_agent; model=gpt-6.1-sol; provider=OpenAI; reasoning_effort=max; runtime_reported.
动机 / Motivation
从心跳或完整 checkpoint 恢复原任务的 Agent,以及使用 Codex native hook 或 KunlunCode Host 的操作者。 旧 guard 可能把仍标记 claimed_by、但租约已释放的工作交给 Agent;现在先拒绝正常交付并给出一次普通 claim,领取后在同一 Todo/Turn 读回 ready,随后才按当前合同继续与结算。 File/SQLite 上释放、缺失和过期租约均经过普通 claim 恢复;foreign/unavailable authority 拒绝;恢复副本保留原两项 Todo、既有结算和验收,当前操作正文可读,并可完成一次隔离本地续作与原 Turn 单次结算。 本轮按新 head 5d174e710228a8198cfd804a9c4ebe560954161c 重新判断完整 PR,未继承旧 head 的结论。仅源码 checkout、隔离真实 File/SQLite 与测试替身边界;未验证 installed App、真实 native fork、真实 KunlunCode/model、PostgreSQL、Windows、自然长时过期或持续净收益。24个 native/provider 用例 SKIP,未记为通过。Compact ready 只替代租约状态,不能替代读取完整当前操作/结算合同。
改动思路 / Approach
共用 TypeScript owner 从 canonical Todo/lease 派生准备状态,Python 做 provider/Host IO;执行继续调用普通 managed claim,合法任务绑定与取得交付权限分阶段。完整恢复复用已合入主干的原 Goal/Agent 状态,不另造 preparation Todo。 当前 PR 交付源码入口的租约准备、Host claim/recheck、显式选择及完整恢复后的同一任务续作;不宣称 installed App、真实模型采用或完整 benchmark 科学收益。
不处理会继续把权限缺口推迟到长工作结束;只加文字提醒仍让调用者重建恢复。当前方案把状态推导和实际 effect 分开:guard 只读,Host 走已有原子 claim,随后要求原身份 ready。缺少权限或与其他 Agent 冲突时停止;有用的恢复必须继续到真实任务结果,不能把一个 ready 字段当最终成果。这里不增加第二个 lease writer、设置页或 benchmark 专属权限。
具体改动 / Changes
关键代码讲解
projectExecutionPreparation:统一处理当前 canonical 事实。缺失、释放或过期的硬租约给出一个普通 claim;ready、soft_claim、foreign 和 unavailable 不混为一种状态。apply_selected_todo_execution_preparation:Python 读取完整 provider 事实并接入现有 guard;未就绪时关闭正常交付,interaction 暂时只暴露领取,不提前给 settlement plan。currentActionSelectionAdmission:qualified 的原任务可以先绑定 preparation-only;requested、selected、preparation 必须相同,两处 delivery permission 仍为 false,绑定不等于取得租约。execute_codex_execution_preparation:只接受精确普通 self-claim、原 physical route 和适用 Host;claim 后重新 guard 相同 Todo/Turn。外层、request、record 共用 parent event 资格,child 不会收到或执行 parent 准备。initialContextReadPointers:首读补回已经存在的 CLI execution_preparation。它修复信息发现,不新增权限;完整当前操作合同仍须在依赖前读取。
完整20文件、+1621/-11均已阅读:12 runtime/CLI、7测试、1文档。基线采用 d29ec8bf2a105aac24629bcbf3dfb7c97aea51fe 的 docs/reference/handoff-mode.md,并按同 revision 的 peer-agent-runtime、status-data-contract 和 research-checkpoint 核对 Ordinary Agent CLI work、Work Ownership、Workspace Isolation、Explicit action selection、Complete isolated benchmark replacement;这些当前标准均由实际入口和反例覆盖,不用本 PR 新写的说明自证。
旧388的 warm finding 需按新拓扑处理:已合入的主干/#8026删除了 preparation Todo 和释放后 _read_preparation,当前保留原 Goal/Agent 与完整状态。此处没有声称旧 helper 在本 PR 中被修好;独立验证改为真实 sealed full-state restore 后的普通 guard/claim/续作。旧 child、macOS alias 和 pending-selection findings 也分别重跑,而非仅因换 head 宣告解决。
对主干的风险 / Risks
| 独立实际路径 | 当前观察 |
|---|---|
| missing / released / expired | claim-only → ordinary claim → 原 Todo/Turn ready |
| foreign / unavailable / 新任务借旧 lease | 拒绝或先要求其自身合法绑定;不取得错误权限 |
| 同 session/cwd 的 child、native off | 输出与 canonical/journal 均无 parent 副作用 |
| 完整恢复 active/released File/SQLite | 原两项 Todo、研究上下文及既有 settled effect 保留 |
| 恢复后本地续作 | 读当前操作合同 → 保留证据的确定性产物 → 原 Turn writeback/spend → 3项 committed 回读;任务保持 OPEN |
当前 native 八模块 355 PASS /24 SKIP,首读模块 43 PASS,独立 guard/Host/restore/off-on 27 PASS、不可变 base 对应控制 26 PASS,完整续作 2 PASS,TypeScript 17 PASS、typecheck及 standard premerge(6 direct、19 selected)通过。24个未执行 native/provider 分支没有记为通过。最后一行首读修复有敏感性对照:直接父提交 f433a88d080f8144612c12f0aaafed3479bd9271 在相同4种恢复场景均因缺少该 CLI 首读字段失败,当前 head 对应4例及43项首读测试通过。
相邻 selection 诊断在当前 base/head 都是 5 PASS /14 FAIL。逐项完整失败文本仅归一化 pytest 临时 run 编号和 fixture 内存地址后,14个签名全部一致,涉及 Stride 拒绝、旧字段预期和 reader argv 错误。原始失败保留,原因未宣称已修复,也没有仅凭总数相同称其全部无关。当前改动的 ownership、合法选择、首读与完整续作已由上述独立入口覆盖;这些诊断作为未解决上下文,不替代当前必要证据。续作探针先因 reviewer 把 dataclass 直接序列化而失败,随后被 workspace fence 拒绝;完整诊断确认测试进程仍指向恢复时被 rename 的旧目录。按返回恢复指引,将真正产出目录作为 --delivery-workspace-path 绑定后,两种 provider 均完成3项 committed 回读且只 spend 1 slot。失败记录保留,未放松 workspace 校验或当成产品 finding。
语义与 CI 对齐
新增 additive preparation schema/registered projection,复用既有 handoff/lease 和 selection owner。Shared hard-lease 前置准备是已披露的行为变化;native transport 才是 opt-in,实际 off/on 同源对照证明关闭时没有 Host effect。规则使用结构化身份/状态与现有 canonical authority,未用任务标题或 prose 推断授权。检查了既有任务页、完成反馈与设置入口;没有需要新增配置的用户步骤,也无渲染变化。未查询、轮询或等待 CI。
我的整体评价 / Verdict
当前未发现阻塞问题,APPROVE。新 head 在原 shared owner 中交付可实际继续的恢复切片:long_horizon 与 CLI/Host 使用体验均有界改善,原任务、反证和结算没有被 surrogate 替代,恢复后能产生本地结果并只结算一次。共用 TypeScript owner 从 canonical Todo/lease 派生准备状态,Python 做 provider/Host IO;执行继续调用普通 managed claim,合法任务绑定与取得交付权限分阶段。完整恢复复用已合入主干的原 Goal/Agent 状态,不另造 preparation Todo。 当前 PR 交付源码入口的租约准备、Host claim/recheck、显式选择及完整恢复后的同一任务续作;不宣称 installed App、真实模型采用或完整 benchmark 科学收益。
Visual review 不适用:检查的改变是 CLI、native/KunlunCode 和现有任务/反馈边界,没有 rendered UI 改动。仅源码 checkout、隔离真实 File/SQLite 与测试替身边界;未验证 installed App、真实 native fork、真实 KunlunCode/model、PostgreSQL、Windows、自然长时过期或持续净收益。24个 native/provider 用例 SKIP,未记为通过。Compact ready 只替代租约状态,不能替代读取完整当前操作/结算合同。 尤其不能把 compact ready 当作整份新操作合同;本次完整续作验证明确先取得当前合同再写回。旧 review 和讨论保留,approval、readiness 与维护者 merge 权限分开,未执行 dismiss、resolve 或 merge。
English verdict: APPROVE 5d174e7; ordinary lease preparation, scoped Host execution and qualified binding preserve the original task/Turn, and restored File/SQLite work completes a bounded continuation and single settlement. Optional native paths and the matched legacy diagnostic failures remain disclosed.
Current full-state recovery qualification
This revision incorporates the shipped full-state warm replacement from
main. The former preparation-only Todo and its release/read helper have been removed upstream. The receiver restores its original Goal, Agent, Todos and lease state. If the captured lease was released, normal work stays gated until an ordinary claim succeeds and a guard for the same Todo and Turn reads back ready.The new regression seals a released source lease and restores it independently with File and SQLite. Both reject unclaimed work, admit the original Todo after claim and retain the original two Todos. The existing active-lease, current-user-gate and binding-CAS tests remain in the suite. The native session test used a real local host and a synthetic inference endpoint. The combined recovery, lease and warm-start tests yielded 105 passes and 9 optional provider skips. The TypeScript admission and preparation tests yielded 17 passes. Native consumer tests yielded 212 passes. Standard premerge passed all 19 selected checks after installing the declared development dependencies. The final first-read change exposes the existing CLI execution preparation once on the recommended page. An integration test that recovered the original Todo on File and SQLite found this information missing from the first read. Both restored executable variants now pass. The standard premerge was rerun on this exact head: 19 selected checks passed, zero failures. The combined first-read regression passed on File and SQLite. Independent re-review is pending.
Goal And Delivered Outcome
A selected Todo could remain
claimed_bythe current Agent after its hard lease was released,expired, or missing.
quota should-runpreviously admitted delivery from the claim alone, sothe Agent often discovered the stale lease only at final writeback and had to reconstruct
recovery itself.
This change adds a typed execution-preparation projection backed by canonical Todo/lease
authority. A capable Host performs one ordinary managed claim before model launch and reruns
the guard; other Hosts receive exactly that claim as their only CLI action. The claim retains
the existing atomic ownership, write-scope, physical-workspace and lease-generation checks.
Foreign leases, conflicting authority and unreadable authority fail closed, while explicit
action selection preserves its existing identity. Receipt-bound recovery rechecks the same
Todo and Turn after the claim, so the Host can prove
claim_required → readywithout replacingeither identity.
Current repair · 2026-11-04
Tested head:
c10b100c049e8298622e5bc96e6756631dd3d8b5.The repair extends
3bb33ea13ce7b50d6d1112aedb7992101c483834; the PR merge base remains79b7818653bc4105ea27a8946de04a9ba997ff03. Author: model_agent, OpenAI Codex CLI.Qualified selection before lease preparation
With two eligible candidates, the real
quota should-run --begin-turnfollowed by the originalTurn's explicit
--todo-idwas rejected asnot_admittedbefore its ordinary claim wasreachable. The same regression failed on File and SQLite, while the single-task path passed.
The existing TypeScript selection owner now accepts a preparation-only binding when the
selection is qualified, requested/selected/preparation Todo identities agree, and the typed
preparation is
claim_required. Root and Agent delivery permissions must both remain false.The Python adapter forwards only the four needed projection fields; it adds no admission rule.
The resulting contract contains only the ordinary claim, no settlement plan. Binding does not
acquire a lease. The existing claim and same-Todo/same-Turn ready recheck remain required.
The real CLI regression extends the existing single-task journey with multiple candidates on
both providers, including zero lease acquisition before the claim. Typed counterexamples cover
missing/malformed preparation, mismatched Todo, rejected/deferred qualification, unavailable or
conflicting authority, and missing/wrong channel permission. Five existing files changed in
this repair. The adjacent-boundary review found no need for another writer, protocol, setting
or framework. The branch was updated with a normal fast-forward push.
Earlier repairs retained
native_context_event_eligible()is shared by the outer context hook, context projection,preparation-request reader and ready-receipt writer. A child event sharing its parent's
Session/cwd receives no parent preparation and performs no parent claim; a later eligible
parent event still reaches ready on File and SQLite.
was not relaxed. Previous main integration retained the specific fixture lint annotations.
Validation
test_quota_execution_preparation,test_codex_execution_preparation, fulltest_codex_context_lifecycle,test_quota_action_selection_conflict, andtest_kunluncode_goal_mode). This retains childno-effect/no-parent-content checks and missing/released/expired/foreign lease cases.
(single-task and multiple-candidate paths, File and SQLite).
reproduce at the same tests and lines on the immutable pre-repair head
3bb33ea13ce7b50d6d1112aedb7992101c483834(5 passed / 14 failed intest_selection_replan_reentry.py). They include the existing stride writeback rejection,missing settlement/gate fields and native reader argv parsing failures. They remain unresolved;
this is not an all-green test-suite claim or an independent approval of this head. The same
14 test cases also fail on the PR merge base
79b7818653bc4105ea27a8946de04a9ba997ff03(5 passed / 14 failed); this comparison does not claim their causes are repaired.
advisories or manual holds. This is local validation, not GitHub CI or merge authority.
Remaining gaps
No installed App, live native Codex/SSH distribution, real KunlunCode model, PostgreSQL,
native Windows, natural long-lived lease expiry or long-term outcome benefit is claimed.
The validation uses isolated real File/SQLite authority paths and public test doubles at the
provider boundary. No review was dismissed, no thread resolved and no merge performed.