Repository navigation
Recover interrupted Codex readiness from the original Turn - #9050
Conversation
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.2-sol · OpenAI (runtime_reported, max)
Request changes conclusion (author-owned PR; GitHub blocks formal self-review)
[P2] 恢复投递接受已经退役的原租约
在原认领仍活跃时完成收据、租约与就绪凭证的全部核对,随后在投递前释放原租约。六个 File/SQLite 与宿主配置的实际 CLI 对照都读回 normal_delivery_allowed=true 和 state=ready,同时 provider 已报告租约 inactive。请在恢复专用投递边界重新核验原租约键、版本和归属,拒绝退役或被替换的授权。 相关代码
动机 / Motivation
Codex App 的受管 Todo 已经认领时,Hook 可能在就绪回执送达之前中断。原入口能回读认领和租约。候选把同一轮的就绪命令、私有暂存 capture 和摘要绑定的投递命令串起来。同一工作轮可从原收据恢复。恢复投递需要在租约回收或换代时停止,以免模型按旧的正常工作指令执行。审查覆盖原身份、当前租约、暂存与历史读回,以及 App heartbeat、SSH 和 Delta-only 配置。
改动思路 / Approach
Hook 沿原 Goal、Agent、Todo 和 Turn 回传收据入口。普通准备与恢复复用已有 quota guard。暂存目录供新捕获使用,投递和读取沿现有摘要校验。此次改变原生 Hook 恢复的工作路径。租约真值由已有权威 provider 持有,历史 capture 继续由原 reader 服务。先用真实 File 和 SQLite 跑注册的回归。再把正常释放安排在就绪检查成功后、实际投递前,分别尝试正确与错误 Turn、正确与错误摘要。
具体改动 / Changes
精确 head 3461f733bbe2bfb27bb288c854216a8a1ed495ce,diff base 41ea75e89892ed88d0ae543e97e31aad0a181c47,5 个文件 +156/-31。逐项复核 same-turn-context、refusal-preserves-source、historical-compatibility、publish-under-current-lease。验收约定
关键代码讲解
- Hook 把当前运行模式传给同一个参数构造器。heartbeat、SSH 与 Delta-only 配置走实际生成的 argv。源码
- 就绪检查落到私有目录。普通活跃路径保持原认领,错误摘要和不同 Turn 都拒绝读回。源码
- 恢复模板通过通用 context-project 发布。六个时序对照在 provider 已确认退役后仍读回可执行的 ready。源码
- 已有 ready capture 和旧版本继续走原 reader。原回执、claim-source 字节和新增扣额均由测试核对。源码
对主干的风险 / Risks
真正的交接边界在就绪检查与模型收到可执行指令之间。先匹配原收据、活动租约和就绪凭证,随后用正常租约操作释放原租约。File 和 SQLite 在 App heartbeat、SSH 及 Delta-only 配置下仍读回 normal_delivery_allowed=true 和 state=ready。全程保留原 Turn、原 claim source 和原认领收据,新增扣额为零。
语义与 CI 对齐
摘要验证解决捕获完整性,租约 provider 检查工作授权。恢复专用投递需要核对一次当前原租约,普通历史查看保持原契约。独立运行 67 项准备测试。保存上下文与首读套件 247 项通过、60 项跳过。六项独立对照重现退役后仍投递,并验证错误摘要和错误 Turn 均拒绝。
我的整体评价 / Verdict
请求修改当前精确提交。请在恢复投递前绑定原认领租约的当前权威证明,并覆盖在 guard 就绪后、投递前退役的时序。对照同时确认同一有效原租约能够恢复,已保存的历史仍可读。
English verdict: REQUEST_CHANGES. Same-Turn recovery, wrong-input refusal and prior captures pass. The emitted recovery projection still delivers actionable readiness after the original lease is retired in all six provider and host configurations.
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.2-sol · OpenAI (runtime_reported, max)
Request changes conclusion (author-owned PR; GitHub blocks formal self-review)
[P2] 原生恢复可在租约释放后登记 ready
检查通过后、原生上下文发布前释放该租约。File 与 SQLite 的六个对照均成功写入会话日志,返回的视图仍可读到可执行 ready。需要让原生登记绑定发布时仍有效的原代次。 相关代码
动机 / Motivation
受管 Codex Todo 已领取时,用户可能在收到就绪上下文前遇到 Hook 中断。原入口能读回领取和租约。候选给出同轮就绪与投递命令,用户可沿同一份捕获接续。接续保留原领取、结果和结算身份。若租约在投递前退役,应当收到原回执读取入口,不能收到可执行的 ready。本次使用本地原生 CLI、真实存储和隔离 Hook。生产 App 恢复与实际模型行为待验。
改动思路 / Approach
复用原领取收据和租约 provider,准备沿同轮 guard,投递沿原生视图 owner。现在投递入口加了一次检查。该检查在原生发布和会话登记前完成,登记仍可跨过已经发生的租约释放。范围限于 Hook 中断后的同轮恢复、原捕获选读和原租约。原审批、扣额与历史读取都沿原流程。对照原有效租约、投递开始前退役、检查通过后发布前退役三组。第三组在真实 CLI 的发布开始前安排一次普通释放。源码的工作开关与权威租约由各自的 reader 独立读回。
具体改动 / Changes
精确 head d40a0358521bff4e499ed55efacb6b4e41d749b9,diff base 5cfd6ae7d571f2f97da40982db23f76540723c89,6 个文件 +295/-40。逐项复核 same-turn-recovery、historical-readback、current-lease-at-publication。验收约定
关键代码讲解
- 从原中断收据组装同轮 guard 和投递模板。源码
- 检查原领取中的租约与实时 owner 的键和版本。源码
- 私有捕获校验后读取权威租约。随后另行准备原生投递。源码
- 现有原生 publisher 写入上下文与会话,故中间时序影响最终可执行视图。源码
- 准备套件覆盖有效租约、退役、换代和历史回读。源码
对主干的风险 / Risks
上轮的释放或换代发生在投递命令启动之前。当前这组退役都被拒绝,原捕获和回执可读。新对照让同一轮的租约检查先通过,把普通释放安排在原生发布前。File 与 SQLite 在 App heartbeat、SSH 和 delta-only 六个组合中均返回成功,生成的读命令仍给出 normal_delivery_allowed=true 和 ready。实际租约已退役,原生会话日志发生变化,原领取与零新增扣额保留。这里验证的是过期的投递而非后续 Worker 修改。
准备套件 75 项通过,独立时序对照 6 项重现。与 #9052 的无写入合并试算在 quota_native_context.py 同一段冲突。组合时要保留私有捕获校验和诊断捕获拒绝。
语义与 CI 对齐
保留原领取与租约键版本为义务。能读取捕获是读取权限;本轮可执行投递要绑定发布时仍有效的原代次。把校验和 ready 会话登记收口到现有原生投递 owner。复测普通释放和代次更换,退役后仍能选读原结算回执。
我的整体评价 / Verdict
请求修改。原租约仍有效时可接续,原退役反例已修。新的时序对照表明可执行投递仍晚于释放生效。将发布的 ready 绑定当前原租约后,同样验证历史可读、合法接续和一次认领的行为。
English verdict: REQUEST_CHANGES. At d40a035, original early-retirement refusal passes. A lease retired after the recheck but before publication still yields ready and updates the native journal on File and SQLite.
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.2-sol · OpenAI (runtime_reported, max)
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
动机 / Motivation
Codex Hook 已提交受管 Todo 的领取,主持进程可能在收到 ready 之前中断。用户要沿原 Turn 返回工作。上一头在暂存前核对租约,随后写会话日志。普通释放可以在两步之间完成。这一轮的原领取、原捕获和结算身份可接续。退休先发生时只提供原回执。评审依据本地恢复和一次结算。生产 App 采纳和组合分支继续独立验证。
改动思路 / Approach
恢复继续使用原领取回执、原 guard、现有 native publisher 和原捕获 reader。发布端在视图暂存后获取已有本地写锁。原领取与当前 lease 通过时,才进入两次会话日志提交。范围包括同轮恢复、原生会话提交、失败的回执选读和现有结算。新增锁操作复用既有 Goal 级写入边界。分别在日志写之前完成释放,以及在实际保存时启动另一个正常 release。直接检查持锁标记、日志、原回执和实际扣额,并沿原命令复查正常结算。
具体改动 / Changes
精确 head b7a9ac35c2b31ba0a01fbe43a782bf98b3ce8952,diff base 5cfd6ae7d571f2f97da40982db23f76540723c89,7 个文件 +412/-60。逐项复核 current-lease-at-publication、historical-readback、same-turn-settlement。验收约定
关键代码讲解
guard_native_recovery_publication在已有本地写锁内复核原领取、当前租约和维护门。源码prepare_codex_context持锁完成恢复登记和原生投递准备日志。源码register_native_context_view在同一原生会话内绑定已登记 target 的分页载体。源码project_saved_context_capture在授权失效时沿同一捕获返回原回执选读。源码
对主干的风险 / Risks
File 和 SQLite 均验证两次会话日志保存持有同一个规范写锁。先释放时返回失败、原回执选读,未登记 ready。另一个进程在保存期间请求释放会等锁,随后正常释放。后续可选的分页 wire 登记核对同一 pending target,复测确认它没有替换先前提交的 recovery。正常恢复的两个独立场景各结算一次,重读保留原身份。精确源码准备和锁套件 116 项通过、10 项跳过。与 #9052 当前头 52220d8 的合并试算在 quota_native_context.py 有冲突。
语义与 CI 对齐
原操作、Goal/Todo、归属、键、版本及活动状态仍决定恢复。现有语义结算以原捕获的证据和 effect identity 推进一次。源捕获与拒绝后的历史读取保持可用。主干的独立发布风险由现有 reviewer 和集成边界继续观察。
我的整体评价 / Verdict
同意这个精确头。上轮记录的释放先于日志发布的问题已修,真实 File 和 SQLite 均通过同轮回执和单次结算。#9052 的组合冲突单独处理。
English verdict: APPROVE. At b7a9ac3, File and SQLite serialize the ready journal commit with ordinary release, retain prior readback on refusal, and each settle their valid original Turn once.
b7a9ac3 to
cba9abe
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 |
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>
cba9abe to
f3af11a
Compare
huangruiteng
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · GPT-5 · OpenAI · self_reported
Approval conclusion
动机 / Motivation
Hook 已经提交受管 Todo claim,但 Codex App 在 ready 响应到达之前中断时,Agent 只拿到 receipt 和 lease 事实,无法安全接续;更严重的是,检查后释放的租约仍可能在太晚的时点被登记成 executable ready。该提交把原 claim 的回读转成同 Turn readiness guard 和 digest-bound projection command,并在 native journal 发布时复核租约。
affected_caller_or_operator 是 Hook 已提交受管 Todo claim 但 ready 响应中断的 Codex Agent/operator;before_after_scenario 是旧 readback 只给 receipt/lease,当前给同 Turn readiness guard 与 digest-bound projection command。observable_outcome 是有效租约可恢复一次 ready并保留原 claim,租约退役或换代时只返回原 receipt;non_goals 是不新增 claim、自动重试、调度器、权限或第二套 lease 状态。
改动思路 / Approach
恢复复用现有 managed claim、quota guard、native publisher 和 lease owner。Hook 只回传同一 Goal、Agent、Todo、Turn 的命令;context-project 在 prepared recovery 时读取原 receipt 与当前 lease,并在现有本地 writer lock 内提交 journal。原 claim/lease owner 与 native publisher 已存在;在同一 publication 边界增加校验和现有锁,避免第二套状态。current_pr_boundary 是恢复中断的原 Turn readiness,并在现有 claim、lease、native journal 边界上证明发布时租约仍有效。与已合并的 #9052 组合时,private capture 校验同时接受 hook session 与 prepared claim,diagnostic ok=false 仍在 lease 校验之前明确拒绝。
具体改动 / Changes
精确 head f3af11aa32fd103d72c7c9e7e251630fd6bbdc19,diff base 1e3c88bac9,7 个文件 +412/-60。规范引用 docs/reference/required-work-context.md @ 1e3c88bac907f613cd4b0b1b4be27bc98e50b927;same-turn-readiness 和 current-lease-at-publication 均实现。
关键代码讲解
guard_native_recovery_publication在现有 writer lock 内核对原领取回执、活动 lease 的 owner/key/version 与维护边界。project_saved_context_capture在 prepared-claim 模式中读取 authority;租约退役或换代时返回原 receipt 选读,不发布 ready。prepare_codex_context在 guard 持有期间登记 recovery/target 与 native delivery,关闭检查后到 journal commit 之间的竞态。
对主干的风险 / Risks
最强风险是只在投递前检查一次,随后普通 release 在 journal 写入前完成。当前测试在 staging 和 publication 两处注入 release/replacement,File/SQLite 均验证无 executable ready、原 receipt 可读、单次 claim 且零额外扣额。与 #9052 的冲突已保留两边的安全边界:diagnostic capture 不可执行,prepared claim 仍要求 private capture 与当前租约。PASS:83 项 execution-preparation 测试通过;组合后的 quick premerge 通过。
语义与 CI 对齐
读取 capture 不等于具备当前工作授权;真正执行仍要求原 claim 与当前 lease 的键、版本、归属匹配。捕获和 receipt 在拒绝后仍可读,但不授予 freshness。
我的整体评价 / Verdict
批准当前精确提交。长期任务上,一次中断不会迫使 Agent 重建 claim 或猜 ready 状态;用户体验上,有效路径能返回到可继续的同 Turn,租约退役则明确给回执恢复。实现保留单一 claim/lease authority,并用现有锁解决真正的边界竞态。
English verdict: APPROVE at f3af11a. Interrupted readiness recovers from the original Turn, publication is serialized with lease release and replacement, #9052 diagnostic semantics remain intact, 83 focused tests and quick premerge pass.
Delivered behavior
A native Codex Hook can commit a managed Todo claim and then lose the readiness response. The readback now includes the existing guard for that exact Goal, Agent, Todo and Turn, plus the digest-bound command for presenting its result. The caller confirms the original active lease before running the guard and checks the returned ready lease proof before opening the capture.
The guard stages its capture under a fresh private path. A refusal leaves the live session's registered claim source intact. Recovery still opens an already recorded ready capture directly when one exists. App heartbeat and App SSH Goal use the same guard argument builder as automatic preparation. Delta-only delivery keeps its selected mode through preparation and recovery.
This complements #9008's automatic readiness timeout allocation. A trial merge with its exact head
0fdde2fd56bfapplied cleanly. The scope is the existing native Hook and CLI recovery journey.Validation
41ea75e89892fails the eight new recovery assertions because the Hook omits the readiness command. On head3461f733bbe2, File and SQLite recover the original settlement identity. Releasing the lease before recovery refuses delivery and leaves the original claim source, receipt and debit count intact. Historical and already-prepared sources follow their existing readers.The app-server checks used disposable synthetic workspaces and static inference. Production App adoption after restart and matched single-session outcomes and complete costs remain C1 acceptance work.
Author declaration
Implemented by
model_agentusing OpenAI Codex. The native adapter reuses the existing quota guard, claim, lease and checked projection. The shared guard arguments replace separate assembly of the readiness route.恢复投递的租约复核
本次精确提交
d40a0358521bff4e499ed55efacb6b4e41d749b9在中断恢复专用的投递入口核对原领取回执、当前租约、归属、键和版本。租约退役时返回原捕获的回执选读命令。Local tests verified current-lease delivery, retirement and replacement refusal, and original receipt readback.
发布时的原租约复验
精确提交
b7a9ac35c2b31ba0a01fbe43a782bf98b3ce8952在原生视图暂存完成后获取现有本地租约写锁,复核原领取与活动租约,并持锁写入会话日志。租约释放或换代先完成时,恢复入口返回原回执选读。Author validation covers local File and SQLite publication ordering, same-session receipt recovery, and single settlement.