Skip to content

Plan Codex continuation from the current native binding - #9723

Open
loopx-agent wants to merge 1 commit into
mainfrom
codex/codex-turn-plan-native-binding-20261201
Open

loopx-agent wants to merge 1 commit into
mainfrom
codex/codex-turn-plan-native-binding-20261201

Conversation

@loopx-agent

Copy link
Copy Markdown
Collaborator

Goal And Delivered Outcome

A controller preparing a second Codex Turn asks the detailed plan whether the existing native session will resume. With a retained agent binding, the old preview reported start_new and gave a different Turn key from the ordinary run-once that actually resumed. A staged prefetch addressed to the preview key was rebuilt under the execution key.

Detailed plans for ready Codex CLI Turns now use the same scoped binding resolver as execution. Inspection checks the current Goal lifetime without taking the state writer lock. Execution rechecks the lifetime, binding and profile at launch. The preview retains the existing output shape and omits the opaque session ID.

Author Declaration

  • Written by model_agent using OpenAI GPT-6 (Codex).

Implemented against

Criterion Owning path Verification
Detailed Codex planning reports the existing agent session action and matching Turn key Existing scoped binding resolver in the Turn CLI Two native Turns on File and SQLite with a completed initial Todo and a real resumed successor
Preview preserves authorization and session state First-party Goal-lifetime decision and current session document Read-only inspection takes no writer lock, stale Goal lifetime is rejected, and previews have zero host calls, writes and debits
Explicit fresh preview and exact replay preserve their contracts Existing context policy and Turn journal Fresh still plans a new session. Compact preview retains its existing result shape. Exact replay adds zero effects.

Validation

  • Candidate e77e9f1876a2f3b8dd47f3cabc0ff2b5da52970b based on 086afeef45f35034eb4147062bc2e25df41a767f. Native Codex CLI 0.171.0-alpha.13 ran against an isolated deterministic loopback endpoint.
  • The pre-fix regression failed on both File and SQLite. The installed candidate reports resume, keeps the native history and matches the executed Turn key on both backends.
  • 343 focused tests passed. Ruff, diff checks, exact-scope CQR and standard local premerge passed the blocking checks. One inherited maintainability advisory remains.
  • The isolated composition with #9711, #9714 and #9717 verified reuse of the staged record under the matching Turn key. Automatic session selection still needs a final admission decision that protects the existing binding when a source changes between preview and dispatch.

@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.

Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)

动机 / Motivation

调用者用详细 turn plan 判断下一轮原生 Codex 是否续用会话,并用返回的 Turn key 关联后续投递。基线在第一个 Todo 结算且保留 Agent 绑定后,详细预览报 start_new,给出的 key 与第二个 Todo 的真实 run-once 不同。候选在已就绪且带交易明细的 Codex CLI 预览中使用同一个 scoped binding resolver。已有 Agent 绑定时返回 resume 与执行相同的 Turn key。触发范围由现有详细预览开关、Codex CLI 与正常交付准入决定。原生会话标识留在本机绑定,启动仍由执行路径负责。预览读取当前快照。计划和执行之间绑定变化时,仍按执行时的准入裁决。

改动思路 / Approach

入口先检查已有准入,再将完整决策交给 Codex session reader。reader 返回受 scope 约束的 lineage,Turn builder 用它选择会话与构造 key。source-profile 路径复用原 typed Goal selector,只有只读查询跳过 writer guard。 调用既有 selector 并仅返回 lineage 即可统一行为。复用当前 Goal authority 和 session document,省去额外 planning 状态和字段。 只读分支禁止初始化,执行 selector、profile 检查、launch admission 和 journal 重放保持原 owner。 触发范围由现有详细预览开关、Codex CLI 与正常交付准入决定。原生会话标识留在本机绑定,启动仍由执行路径负责。

具体改动 / Changes

审阅提交 e77e9f1,diff 基线 2d47ab9,6 个文件,+65/-12。计划与执行会话身份由 Turn CLI 的 gate 和共用 resolver 决定。resolver 从完整决策提取受 scope 约束的 lineage,Turn builder 据此计算事务身份。会话生命周期与精确重放沿用 Goal admission 和原 journal,并有 CLI 与执行选择器两处回归测试。远端目标基线与行为对照提交之间只有同一 RFC 的两份中英文档。冻结行为对照为 086afee。 入口 · Goal 实例选择 · 原协议

对主干的风险 / Risks

预览若以执行模式解析会话,会扩大 writer guard 使用范围。若跳过实例校验,旧计划或新实例可能沿用错绑定。当前只读标志仅改变 selector 的锁模式,类型化 Goal 实例约束与执行复核留在原 owner。

安装 wheel、原生 Codex CLI 0.171.0-alpha.13 和本地确定性 Responses endpoint 在 File 和 SQLite 上分别结算首个 Todo,再比较第二个 Todo。两个基线都错报 start_new 且 key 不同,候选都显示 resume,两个 key 逐字相同。后续实际请求携带首轮原生历史。详细和精简预览均省略 opaque ID,宿主请求、绑定、journal、校验和扣额无变化。 两个后端的显式 fresh 仍启动独立原生会话,计划和执行 key 相同。以已结算轮原 key 重放,宿主请求、状态材料和扣额零增量。隔离夹具观测 Goal guard,当前只读 selector 取到有效绑定时不取该锁,过期计划和错实例旧绑定分别拒绝,执行 selector 仍在原 writer guard 下拒绝过期 Goal。基线与候选的公共 CLI 都在注册表读取处拒绝 lifecycle-only profile。 324 项定向和邻接测试通过。标准 premerge 的 6 项直接及 14 项选中检查无阻断,保留一项既有维护性 advisory。与 #9694 的冻结 head 合并树无冲突,DSH 宿主选路和自动 EpochReset 选择条件未被改动。

我的整体评价 / Verdict

APPROVE。 未发现需要阻止该 head 的回归。两个后端的计划、执行及原生历史证据一致,并保留原授权与重放边界。 变更限于 CLI 与协议文档,无前端首屏变化。 原生验证使用本地确定性 provider。source_session_v1 通过隔离的 Goal 与会话选择边界复验,公共 Turn CLI 仍不接受该生命周期专用 profile。DSH 检查合并树与路由组合,未运行 DSH provider。

English verdict: APPROVE at e77e9f1. The installed File and SQLite paths match the native resume action and Turn key. Read-only binding inspection and stale lifetime rejection are independently verified.

This branch has not been deployed

No deployments
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.

1 participant