Repository navigation
refactor(turn): unify managed operation IO and fence session initialization - #7515
Conversation
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: 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.
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。没有用新增提示词解决竞态。main。Author Declaration
docs/architecture/rfcs/controller-executor-unified-contract-v0.md及docs/architecture/rfcs/ledger/controller-executor-unified-contract-v0/2026-10-27-refactor-handoff.md,base15471f8e832d7fb5893539fa053170ea233de5a7。managed_operation_host.py→ 原 collaboration/admission ownerselect_managed_operation_session/ snapshot commit → 原 session 文件Scope And Continuation
Validation
8039dc652d360fbd16e0f1ceebc455202ed708e3;immutable basefff09ead9b17190d9cc8385f0c4da70669a4f272,rebase 未改变产品/fixture blobs。2fbf4359构建 SDK 0.2.1a3 + explicit npm runtime 0.2.1-alpha.3 验证重启恢复。e9ef554ea)6 direct + 19 selected,零失败、无人工 hold。初次 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
b46e07443a9f5e24ccd2120c86748a958c5fe124combines author head8039dc652d360fbd16e0f1ceebc455202ed708e3with targetb69021498ef7483b1d2b190bc3f4c7bb6675c882.delegation-search-browser-smoke.mjs:39cannot 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.team-evidence-return-smoke.mjs:146expects an explanation to be visible by default. The same unmodified test fails on both versions because the paragraph is inside the existing on-demandContextHelp. The required text remains in the component.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
turn run-once两个显式 operation 入口与 confirmed callback、原审批卡片/结果格式保持;没有新增设置、能力编辑器或前端流程。Type Of Change
Shared-authority RFC fixture impact
N/A:没有修改 authority store、provider 路由或 promotion;canonical File/SQLite 的真实调用消费原 typed owner。PostgreSQL 未在本切片重验,不宣称其新资格。
Boundary Checklist