Skip to content

fix(turn): preserve replan requirements at the shared Host - #6935

Merged
huangruiteng merged 1 commit into
mainfrom
codex/turn-replan-host-context-20261020
Oct 20, 2026
Merged

huangruiteng merged 1 commit into
mainfrom
codex/turn-replan-host-context-20261020

Conversation

@loopx-agent

Copy link
Copy Markdown
Collaborator

Goal And Delivered Outcome

An admitted Todo-bound replan reached the shared DSH/cloud Host as a generic action while its signed replan requirements and original evidence route were dropped. Forward the existing replan_action_packet, saved capture route and signature; retain full Goal reads and return a typed candidate under the existing executor's effect ownership.

Both real File/SQLite cases failed before the fix at the missing packet in actual DSH provider input. They now preserve guidance, semantic outcome choices, obligation identity and original evidence, and reject signed mutations before provider invocation. The runner records protocol input and invokes no model.

Author Declaration

Criterion Disposition Implementation / proof
Replan requirements reach the real consumer implemented Shared host_candidate.py; native selection→bound replan→DSH input
Detail reads retain the original observation and complete Goal obligations implemented Original capture/hash/identity and full Goal tail readback; existing source-loss/replay cases
IO adapter grants no new execution or settlement authority implemented Existing signed packet forwarded; executor retains state/quota/scheduler; runtime unchanged after transport

Scope And Continuation

Five paths: the existing adapter, focused integration test, protocol note and paired RFC checkpoint. Share the existing saved-evidence branch with historical capability references; no new decision owner, configuration, protocol vocabulary or helper framework. Ordinary inputs remain byte-identical in 14 captured normal/wait/memory/context/reference comparisons.

Restored semantics cost more: the synthetic replan Host prompt grows from approximately 5.3 KB to 12.7 KB and exposes the original roughly 80 KB saved decision read. This is a correctness repair, with no claim of whole-Turn savings. The existing convergence work retains installed adoption, subsequent model decisions, complete costs and final adapter retirement as open acceptance.

Validation

  • Tested head: 4cff6d3db568f46e92da09098d5a03b8c4ed79a6; run state: finished; inputs: public synthetic fixtures.
  • 227 source tests passed on identical changed file payloads before the unrelated Lark-only base advance; the strengthened native replan cases passed again.
  • A fresh non-editable wheel from the rebased head passed 19 CLI/backend/Host/recovery tests outside the source checkout. All 1,680 packaged Python/TypeScript payloads match the source; this is an isolated installation, not live adoption.
  • Full declared Ruff roots, configured mypy plus direct adapter typecheck, CLI output-budget smoke, paired-RFC checks, semantic advisory and public/private scans passed. No budget changes.
  • Exact-scope quality receipt and standard premerge: passed (cqr_641fa8504492df16bb63, one cost advisory); six direct plus eleven selected premerge checks passed with no failures, warnings or manual holds against the stated main snapshot.
  • Full pytest/TypeScript/Windows suites remain for CI; live models, cloud provider execution and installed App/Lark adoption were not run. No authority-store/PostgreSQL behavior changed. Independent PR review, remote CI and merge readiness remain separate.

Frontend / Visual Evidence

UI impact: none. Existing Turn CLI and shared Host adapter; no new caller-facing operation or configuration. Visual evidence: N/A.

Type Of Change / Area

Bug fix, focused test, protocol/RFC checkpoint; control-plane Host integration. Complete within this transport slice; broader convergence remains open.

Boundary Checklist

  • Public-safe diff, fixtures and description; no private operating state or raw evidence.
  • Scoped existing owner; no unrelated benchmark work.
  • English/Chinese RFC pair reviewed together.
  • DCO sign-off present.
  • No merge, release or live installation claimed.

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; declaration_source=runtime_reported; reasoning_effort=max

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

Exact head: 4cff6d3db568f46e92da09098d5a03b8c4ed79a6; immutable merge base: d95839c16b9e98dbd0c3aa4341b717056547e464.

动机

使用原生 Turn 的 DSH/cloud 宿主执行已准入重规划的 Agent。原决策已要求重新规划,但宿主此前只收到泛化动作,丢了可选语义结果及原证据入口;当前提交把完整重规划包、原捕获路由和签名送到实际 provider 输入。真实 File/SQLite 子进程验证包与原来源一致、完整 Goal 停止条件仍可读取,篡改在调用 provider 前被拒,普通请求保持原完整输入。本切片不新增决策、写回、额度或调度权限,不证明真实模型采用、正式安装、后续模型决策质量或整体长程收益。

实际任务是依据已存在的要求改选下一条合法路线,不是让调用方再复制一遍上下文或重新获得执行权限。旧入口遗漏重规划包,使宿主看不到应保留的义务、证据与语义结果选择;这不是“字段在上游存在”就能排除的损失。安装态宿主、模型实际选择后的后续工作、总成本及原 M7.4 三项收敛验收仍保持开放。

改动思路

在现有共享 Host 适配器补回已有签名字段并复用原证据分支,比重新构建规划器、重跑准入或增加补读回执更小且完整。当前范围是已准入重规划到实际宿主输入的传输,不替代既有证据读取、执行和后续成果验收。完整来源继续由原 Turn journal 的私有捕获提供,宿主先核对 Goal/Agent/Turn 与源哈希,再选择语义结果;缺失或失效时保留恢复边界,不能用新 guard 替换原观察。宿主返回 typed candidate,外层执行器继续拥有写回、额度和调度效果。

输入 旧共享适配器 当前精确提交
普通、inline 或历史引用上下文 原指令及已有证据分支 14 组完整 authority/prompt 逐项相等
已绑定重规划 只有泛化动作,缺少重规划包 实际 DSH 输入保留包、原捕获路由和签名
签名后改义务、指导或 frontier 仍须原签名校验 真实子进程拒绝,provider 输入文件未变化

表格描述此 head 的实际对照,不把协议 fixture 当作真实模型采用。补回字段是默认修复,不新增一个需要用户配置的能力入口。

具体改动

规范依据是变更前的 TurnEnvelope 原始捕获、完整要求与边界契约,spec_revision d95839c16b9e98dbd0c3aa4341b717056547e464,并结合原 M7.4 Heartbeat/Turn convergence 的分阶段边界。same_observation、full_requirements、effect_ownership 三项均 implemented;这些是原条款的评审映射名称。新增文档是披露,不是本次实现的独立 oracle。

关键代码讲解

  • extract_turn_authority 先执行原 action signature 检查,再原样传递已有 replan_action_packet。重规划和历史 context 引用共用原 detail/signature 分支;不读取文件、不重新准入或计算另一套义务。
  • render_prompt 仅在包存在时补充读取原 autonomous_replan_obligation.replan_context 的时序、身份/源哈希、缺证据恢复及外层效果所有权。既有完整 Goal 必读没有被替换成只看选中 Todo。
  • test_bound_replan_reaches_actual_host_with_original_evidence 从真实 File/SQLite 选择和绑定开始,检查实际 DSH provider 收到的输入,再独立读取原捕获及 Goal 尾部停止条件;不只比较两个缩减投影的签名。

全五路径 +146/-7 已审读:生产变化只有既有共享适配器 +22/-6,其余是同一原生入口回归、协议说明及中英 RFC checkpoint。两种语言均保留“传输资格、模型/安装/完整成本未验证”的边界;没有把 checkpoint 更新写成整体收敛完成。

对主干的风险

独立运行三项 Turn/capture 模块 127 passed,三个 DSH/UTF-8/Chat adapter 模块 123 passed。不可变 base 使用同一最终完整 context 模块,为 2 个预期失败、6 个原控制通过:两种 backend 的真实 provider 输入均在缺少 replan_action_packet 处失败,当前两例通过。没有把历史失败重新标成通过。

普通路径另用完全相同的 14 组签名请求比较 base/head 的完整 authority JSON 和完整模型 prompt,不做字段或输出归一化,全部相等。覆盖普通/wait、上下文 off/inline/历史引用、完整要求、选中任务、空范围、路径空白、未知来源、审批、记忆关闭和 Unicode;与两头都通过的六个真实 DSH 子进程控制互补。重规划包三个字段的签名后篡改均在 provider 前拒绝,捕获、Goal 和隔离 runtime 文件字节保持。

完整声明范围 Ruff、配置的 17 文件 mypy、标准 premerge 6 项直接检查 + 11 项选中检查通过。没有查询或等待远端 CI。coordination provider 和 Dashboard source tree 在 base/head 完全相同;本次没有 PostgreSQL provider 改动,也不声称其服务、已安装 App 或真实模型资格。现有 API/CLI/Lark 的决定与写入 owner 未新增,内部适配器不应另设配置页。

语义与 CI 对齐

复用已有重规划包、签名、detail 路由和候选结果词汇,未新建持久状态或协议值。宿主文本是必须读哪些事实、何时停止的指令;实际 action-signature 拒绝是已有机器约束。没有新增“模型已经读取”的回执,也不能由 prompt 出现推断模型服从。完整 packet 和必要原始补读的成本会增加,8 KiB 仍是诊断警告;本次没有通过删义务或提高预算解决输出。

我的整体评价

批准这个有边界的传输修复,delivery verdict 为 justified_increment。long_horizon 为 preserved:原要求、证据、停止和效果所有权保留;没有把一次 wait fixture、测试数量或输入到达称作长期决策收益。user_experience 为 preserved:没有新增配置、复制信息或确认轮次;原宿主失败/恢复入口继续使用。在现有共享 Host 适配器补回已有签名字段并复用原证据分支,比重新构建规划器、重跑准入或增加补读回执更小且完整。当前范围是已准入重规划到实际宿主输入的传输,不替代既有证据读取、执行和后续成果验收。安装态宿主、模型实际选择后的后续工作、总成本及原 M7.4 三项收敛验收仍保持开放。下一次更改 head 后仍须重新核验,COMMENTED 批准结论不等于平台批准、合并或安装权限。

English verdict: APPROVE — 4cff6d3. The real File/SQLite-to-DSH path now retains the existing signed replan packet and original evidence route; tampering is rejected before the provider. 250 selected Python checks passed, the immutable base fails both missing-packet cases while six controls pass, and 14 complete ordinary authority/prompt pairs are identical. Local static and 6-direct/11-selected premerge checks passed. This is bounded transport qualification, not model adoption, installed convergence or merge authority.

@huangruiteng
huangruiteng merged commit ec107bc into main Oct 20, 2026
31 of 42 checks passed
@huangruiteng
huangruiteng deleted the codex/turn-replan-host-context-20261020 branch October 20, 2026 12:02
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