Repository navigation
Adopt Codex EpochReset sessions after verified settlement - #9717
loopx-agent wants to merge 1 commit into
Conversation
Signed-off-by: LoopX Agent <[email protected]>
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
动机 / Motivation
使用 Codex CLI 跨 Todo 续跑的调用者,需要在新上下文未通过验收时保住已接受的会话。行为基线在原生 exec 返回后已写入新会话 ID。File 与 SQLite 的独立 validator 随后拒绝候选,未写回业务结果也未扣额,第三轮实际发出的请求仍带着被拒会话的工具输出。此提交把显式 fresh 且实际采用 EpochReset 的新会话留在待采用状态。只有当前 Turn 独立验收通过并完成 typed settlement,才用原绑定快照做 compare-and-swap。改动沿 Codex exec、现有 session binding 文件和 Turn journal 生效。普通 fresh 仍沿原有立即绑定行为,已有 CLI 参数及绑定格式继续可读。真实运行证据来自隔离本地 Responses provider,现场身份和模型结果由确定性夹具控制。
改动思路 / Approach
Codex exit 校验后把候选身份作为本机 sidecar 交给 executor。executor 持久化候选和验证状态,原 writer 先处理 writeback 及扣额,再由会话 owner 在文件锁内比较并采用。读取端仅为实际尝试采用的 Turn 增加可选布尔值。 只移动原来的 store 调用无法跨越进程恢复并保留原快照。复用 typed settlement、Turn journal、原绑定写入锁和 Goal admission 足以支撑本次窗口。 仍由原 Turn、Goal lifetime、writer 和绑定快照约束采用权限。模型输出只供结果校验,候选会话 ID 来自本机 native 事件。 改动沿 Codex exec、现有 session binding 文件和 Turn journal 生效。普通 fresh 仍沿原有立即绑定行为,已有 CLI 参数及绑定格式继续可读。
具体改动 / Changes
审阅提交 5f073f6,diff 基线 d19a0d7,9 个文件,+305/-63。Code diff 对照 GitHub base,安装对照使用冻结行为基线 8af533a,与 GitHub base 间四个路径均为双语 RFC。检查 exit 搬移保留了普通会话的观察、超时登记和失效处理,恢复 helper 的 AST 除名称外相同。会话采用及失败与竞争均有具体落点。候选身份由 native 事件取证,私有 journal 只在 typed result 校验后保存,公开读回在每次尝试采用后才带状态。 候选门 · 结算后的采用 · 绑定的 CAS · 恢复判断 · Turn 协议 · 历史投影 RFC
对主干的风险 / Risks
核心风险在已扣额但会话采用回执尚未持久化时退出。恢复可从同一 journal 复用已验收结果和结算回执,采用处二次比较原绑定。若会话先写成功,读取相同会话、Goal 生命周期及 profile 即可完成丢失回执的恢复。
File 与 SQLite 均从安装 wheel 启动原生 Codex CLI。validator 运行时读取到旧绑定,通过并结算后下一轮原生输入含候选工具历史。两个后端分别在扣额后、写绑定前及写绑定后中断进程,并用原 key 恢复。四次恢复与后续精确重放均新增零宿主请求和零扣额,最终绑定一致。 两个后端的独立验收拒绝和注入写回拒绝都保留旧绑定、原生历史和零新增扣额。validator 内由另一进程更新绑定时,CAS 保留更新值,已通过验收的业务 Turn 仍各结算一次,回执为 session_binding_updated=false,后续请求沿实际赢家续跑。关闭预取的普通 fresh 仍在 validator 前切换,行为符合原入口。 定向回归 363 项通过。标准 premerge 的 6 项直接检查及 14 项选中检查全数通过阻断门。保留一项既有维护性提示,涉及 loopx/status.py 和其 ratchet baseline 文件,两者在冻结基线及候选的 Git blob 一致。
我的整体评价 / Verdict
APPROVE。 无阻塞发现。已从实际 native 输入和持久效果验证原会话保留、成功后采用、并发赢家、精确恢复与重放。 涉及 CLI 会话状态与回执,没有视觉表面改动。 原生试验使用 Codex CLI 0.171.0-alpha.13、已安装的 Core wheel、File/SQLite 及本地确定性 Responses fixture。故障切点只注入隔离进程。线上模型效果、其他宿主以及生产 Goal 生命周期未做原生试验。
English verdict: APPROVE at 5f073f6. No blocking findings. Installed-wheel native Codex runs over File and SQLite verified binding retention, post-settlement adoption, compare-and-swap, and exact recovery without duplicate effects.
Goal And Delivered Outcome
A fresh Codex exec session can receive an eligible EpochReset receipt and still fail its independent task postcondition. In the prior installed package, the transport replaced the original binding as soon as the native ID appeared. The independent validator rejected the task, yet the next resume would have followed the rejected session.
The governed Turn now keeps the observed native session as a private candidate. Independent task validation and successful typed settlement precede a compare-and-swap against the original binding. A rejected task preserves the original session, and a newer concurrent binding wins. Exact replay reads the original effects and binding outcome.
Author Declaration
Implemented against
Scope And Continuation
The existing Codex CLI scope, Goal lifetime and Turn settlement owners handle adoption. The returned
session_binding_updatedflag is an observation. An explicit fresh request that uses the ordinary context path uses the existing immediate binding behavior.Automatic selection still needs to qualify the source and original binding before a new native launch. This change supplies the adoption path for an admitted candidate.
Validation
5f073f60f3ecfe82574eb492a6dab82bee4bc7c9against8af533a8dca3b04ac5678d0cda18198ebf6ce6f8. Run statefinished. Input classsynthetic.regression_parityreal_entrypointintegrationstaticThe post-check main update
d19a0d7e0d41changes four RFC files. Git verified clean integration. The premerge result carries one inherited maintainability advisory forloopx/status.py.Actual model billing and cache behavior remain outside this validation.