Skip to content

refactor(turn): unify managed operation IO and fence session initialization - #7515

Merged
huangruiteng merged 1 commit into
mainfrom
codex/controller-managed-operation-20261028
Oct 28, 2026
Merged

huangruiteng merged 1 commit into
mainfrom
codex/controller-managed-operation-20261028

Conversation

@loopx-agent

@loopx-agent loopx-agent commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

Goal And Delivered Outcome

Codex/DSH 的受管 operation adapter 重复组合会话选择、profile 校验、confirmed wake、pending 和原生 start;DSH 还从 Codex 模块导入公共 handler。另一个真实反例是:Codex 初始化原生连接时,可能覆盖并发写入的 session binding。

本 PR 将两个真实调用方接入一份公共协议 IO,并由现有 codex_sessions.py 提供完整 select/verify/store。Codex 在原文件锁内比较选定文档;并发替换后保留胜出绑定,关闭本次连接,不发送 prompt/tool。没有用新增提示词解决竞态。

  • Anchor:controller/executor RFC §11/C3 与 2026-10-27 handoff 的 C3.1/C3.2;目标分支 main。
  • Before/after:初始化期间替换绑定的两个独立用例在 immutable base 均失败,在本实现通过;DSH 原有竞态保护保持。

Author Declaration

  • Written by: model_agent — OpenAI Codex,GPT-6 family。
  • Specification and revision: docs/architecture/rfcs/controller-executor-unified-contract-v0.md 及 docs/architecture/rfcs/ledger/controller-executor-unified-contract-v0/2026-10-27-refactor-handoff.md,base 15471f8e832d7fb5893539fa053170ea233de5a7。
Criterion Disposition Owner / caller Evidence
C3.1 shared protocol IO implemented 两个 operation adapter → managed_operation_host.py → 原 collaboration/admission owner native SDK、CLI、connection、operation action 用例
C3.1 native acceptance / once-only dispatch implemented Codex app-server / DSH owned connection 各自认证 native metadata;公共 IO 只转交事实 缺接受、receipt 失败、错误身份、pending 过滤、一次 consume/start 和原结果
C3.2 cohesive select/verify/store implemented 两 adapter → select_managed_operation_session / snapshot commit → 原 session 文件 new/resume/fresh、profile 变化、并发替换、checkpoint 来源保留/清除
C3 role/generation expansion deferred 原 C3 与 C1 稳定契约 本 PR 保持当前单会话 schema,未实现双角色

Scope And Continuation

  • 保留原 session 路径/wire、Goal instance admission、原始 source route、SDK pin/restore、工具隔离及资源归属。公共 tool schema/revision 和完整 operation 提示条款与 base 相同;默认关闭及普通 Codex/DSH 路径保持。
  • Python 负责已有 native/file IO;现有 TypeScript collaboration、approval、consume、outcome owner 继续裁决。没有新 Session store、BaseHost、配置或授权 owner。
  • Codex 保留相同会话的 checkpoint 来源;DSH 保留既有 replace-only writer 与初始化 fence。原失败恢复消费者不改 wire。
  • 同域简化:原 session decoder 供读取/原子提交共用;匹配负载的完整结果和 binding 相等。session 文件读取:无显式 admission 为 2→2;legacy Goal admission 为 3→2。时延未作因果提速结论,完整运行成本与长程收益未资格。
  • 两调用方、公共 IO 和 session 边界可以一并回退,无状态迁移。C1、双角色/代际与正式安装沿原工作继续;此 PR 不关闭完整 controller 计划。

Validation

  • Tested revision: 8039dc652d360fbd16e0f1ceebc455202ed708e3;immutable base fff09ead9b17190d9cc8385f0c4da70669a4f272,rebase 未改变产品/fixture blobs。
  • Run state: finished
  • Input classes: synthetic, public_fixture
Check kind Result Evidence / limitation
regression_parity passed 两个 Codex 初始化竞态在 base 失败/head 通过;同负载完整 native 返回与 session 文档相等。
real_entrypoint / real_backend passed DSH SDK + public CLI 35 cases,base/head 均通过;isolated File / SQLite 3.53.4,loopback scripted provider,非付费模型/真实交易。
real_entrypoint passed 默认 SDK/runtime 0.1.5rc1 的 retained connection、恢复限制与失败清理 7 cases 通过。另以官方 source 2fbf4359 构建 SDK 0.2.1a3 + explicit npm runtime 0.2.1-alpha.3 验证重启恢复。
integration / regression_parity passed 当前 committed head 的 Codex、session/recovery、operation actions、CLI 与 launch-authority 合并套件:496 passed,13 个 live/opt-in 相关用例未执行。
static passed 4 个产品模块 mypy、changed-path Ruff、semantic diff advisory、maintainability ratchet、双语 RFC staged/exact-head、whitespace。optional SDK 的两个无类型 import 是显式静态边界,runtime pin/实际 IO 仍验证。
integration passed 精确 scope CQR pass;标准 premerge(base e9ef554ea)6 direct + 19 selected,零失败、无人工 hold。
CI / independent review failed / pending 两项 browser jobs 已失败,下面保留实际 CI 与 immutable base/head 归因;独立评审仍待办理,本地资格不等于 merge readiness。
manual / limitation not_run live model、正式 App/宿主采用、真实人类审批/外部效果与完整长程成本;没有新增这些权限或将 synthetic confirmation 称作人类授权。

初次 native qualification 的 12 个失败保留:4 个新竞态测试在 SDK 清理后读取已清空的 _proc,8 个既有 CLI fixture 未提供现行兼容路径。相同 immutable base 也失败;修正为保存原 process handle、采用已有 endpoint owner 要求的 fixture root 后,base/head 35 cases 均通过。未放宽产品准入。

Current browser CI attribution

CI merge b46e07443a9f5e24ccd2120c86748a958c5fe124 combines author head 8039dc652d360fbd16e0f1ceebc455202ed708e3 with target b69021498ef7483b1d2b190bc3f4c7bb6675c882.

  • Browser shard 1: delegation-search-browser-smoke.mjs:39 cannot find the delegation entry within the original 30-second timeout. The same unmodified test fails on both immutable target and author head. Both actual page readbacks are identical: the steward source is unverified and its original conversation unavailable. This identifies the caller/fixture admission boundary to investigate; it does not prove the complete source-admission root cause.
  • Browser shard 2: team-evidence-return-smoke.mjs:146 expects an explanation to be visible by default. The same unmodified test fails on both versions because the paragraph is inside the existing on-demand ContextHelp. The required text remains in the component.
  • Matched local qualification: four executions, all preserving their failures; Python 3.14.8, Node 24.21.0, Darwin arm64, independently prepared source environments and normally rebuilt/validated packaged UI. The complete dashboard/scenario/helper trees are identical between target and head. This is local base/head attribution, not an exact Ubuntu CI rerun. An initial reused bundle was rejected by source freshness before testing and was rebuilt normally.

These failures are shared with the immutable target; the comparison does not establish a new C3 UI regression. Both journeys and downstream cases remain unqualified until the owning browser caller/fixture is corrected. No assertion, timeout or production admission rule was relaxed, and this diagnosis does not waive CI, independent review or merge gates.

Frontend / Visual Evidence

  • UI impact: none;内部 transport/file IO 收敛。既有 turn run-once 两个显式 operation 入口与 confirmed callback、原审批卡片/结果格式保持;没有新增设置、能力编辑器或前端流程。
  • First viewport / preview: N/A。

Type Of Change

  • Bug fix
  • Documentation update
  • Test update
  • Control plane / host runtime integration

Shared-authority RFC fixture impact

N/A:没有修改 authority store、provider 路由或 promotion;canonical File/SQLite 的真实调用消费原 typed owner。PostgreSQL 未在本切片重验,不宣称其新资格。

Boundary Checklist

  • 无私有 state、日志、credential、内部链接或本机路径。
  • 未重复 benchmark/model 实验。
  • 既有 RFC 英中 ledger 同步。
  • 无 UI 改动。
  • DCO Signed-off-by。

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

@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; model=gpt-6.1-sol; provider=OpenAI; reasoning_effort=max; runtime_reported

Approval conclusion (author-owned PR; GitHub blocks formal self-approval)

动机 / Motivation

受影响的是通过 Codex 或 DSH 执行已授权 operation 的受管 Turn。原先两 adapter 重复拼装会话与确认流程,Codex 初始化期间还会覆盖并发胜出的 binding;新实现共用协议 IO,并在原锁内比较选定文档,冲突时保留胜出会话且不发送 prompt 或 tool。两个 Codex 竞态反例从 base 失败变为 head 通过,普通 new/resume/fresh 的完整结果、提示和持久 binding 保持一致。本 PR 不实现双角色或 generation,不新增权限、Session store、设置流程或自动重试。C1、C3 的双角色/代际、正式宿主安装、真实人类审批及长程净收益仍由原 owner 接续;新 SDK 的持久重启矩阵未在此独立执行。

改动思路 / Approach

公共层只运输原请求、pending locator 与 start 事实;原 typed collaboration/admission owner 继续裁决,native metadata 和资源清理仍归各 adapter。本次把两个实际 operation caller 与 session select/verify/store 一并替换并可整体回退,无状态迁移。只搬函数会留下 caller 重组和 Codex 跨 Host 依赖,因此本次同时接入选择及存储 owner。快照代表选定文件的事实,不授予执行权;比较在原文件锁内进行,Goal admission 仍覆盖选择与接受。DSH 的 SDK pin、连接恢复限制和 socket 清理没有被通用化抹平。

具体改动 / Changes

关键代码讲解

  • operation_tool_handler:公共 tool schema/revision 与 base 同值,仍校验 native thread/turn、参数精确集合、来源路由及执行主体;prepare 不等于消费许可。
  • select_managed_operation_session:集中 new/resume/fresh、profile 与既有 Goal 选择,保留原持久路径和 wire。decoder 由普通读取及原子提交复用。
  • ManagedOperationSession.store:Codex 比较原始文档后才提交;相同会话保留 checkpoint 来源,fresh 会话不借用原来源。DSH 保留原 fence 和 replace-only writer。
  • record_operation_start:只接收 adapter 已认证的 native acceptance;记录失败仍阻止 operation tool 派发,启动进程本身不算接受。

按 docs/architecture/rfcs/ledger/controller-executor-unified-contract-v0/2026-10-27-refactor-handoff.md,spec revision b69021498ef7483b1d2b190bc3f4c7bb6675c882,C3.1 和 C3.2 的本次单会话 caller 替换已实现;C3 的角色/generation 扩展 deferred,依赖稳定 C1,由原 session/runtime owner 接续。英中 ledger 同步且清楚标作 proposal,未反向扩大已交付范围。

对主干的风险 / Risks

PASS:372 passed、37 skipped 的 Codex/session、operation action、CLI、delegation 与 launch suite;四产品模块 mypy、Ruff,以及 6 direct + 19 selected premerge 均通过,无 manual hold。两个并发初始化用例在 immutable base 均失败、head 均通过;checkpoint 保留/清除另过。new/resume/fresh 完整结果、prompt 和 binding 的 base/head 比较相等,仅归一化夹具根路径及其派生 profile digest;普通 CLI/session 的 base 22 项也通过。工具定义和全部 operation 指令条款另做源码等值检查。

真实默认 DSH SDK/runtime 0.1.5rc1、本地脚本 provider:7 passed、28 skipped。另以不改产品且保留全部断言的私有 fresh probe 验证 File/SQLite × inline/frozen 四场景,base/head 都通过;只移除了不适用于新会话的测试层 resume-runtime skip。原完整套件的 37 skips 是当时缺 SDK 的35项和 live-host2项;后续默认 SDK 补验单列,不改写旧记录。28 项仍因未提供新版本 resume runtime 而跳过,不宣称持久重启/所有 SDK 版本通过;没有实际人类审批、模型或外部业务效果。未查询 CI。

语义与 CI 对齐

复用既有 host、transport、session wire 与 action vocabulary;新增 Python snapshot 值是本地 IO helper,不是新的授权状态。锁内拒绝来自选定文档被替换的事实,不能靠标题或说明文本绕过;默认普通路径没有增加权限、审批或 quota 门。

我的整体评价 / Verdict

APPROVE,作为 C3.1/C3.2 的有用单会话增量。公共层只运输原请求、pending locator 与 start 事实;原 typed collaboration/admission owner 继续裁决,native metadata 和资源清理仍归各 adapter。本次把两个实际 operation caller 与 session select/verify/store 一并替换并可整体回退,无状态迁移。长程判断为 improved,仅指已验证的 binding 不再丢失与恢复语义保持;完整长程净收益没有实测。用户使用判断为 preserved:原显式操作入口、审批卡片、source route 和结果格式保持,没有新增设置或确认轮次。视觉审阅不适用,已检查完整14路径及既有 CLI/Chat 入口,未改变渲染;未验证范围为正式 App、安装态、真实人类确认与模型行为。

C1、C3 的双角色/代际、正式宿主安装、真实人类审批及长程净收益仍由原 owner 接续;新 SDK 的持久重启矩阵未在此独立执行。保留持久格式有真实 recovery reader 依据;不留旧内部 handler re-export,两个 caller 同版本部署即可一起回退。未发现须在本 PR 再建框架或迁移的理由;本结论不替代独立维护者的合并决定。

English verdict: APPROVE 8039dc652d360fbd16e0f1ceebc455202ed708e3: shared managed IO and the Codex initialization fence are verified; newer SDK restart, installed hosts and long-horizon benefits remain unverified.

@huangruiteng
huangruiteng merged commit 5a65338 into main Oct 28, 2026
35 of 47 checks passed
@huangruiteng
huangruiteng deleted the codex/controller-managed-operation-20261028 branch October 28, 2026 03:59
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.

2 participants