Repository navigation
Avoid sending the projected body twice in full native context delivery - #8285
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, gpt-6.1-sol, OpenAI, runtime_reported, reasoning_effort=max
动机 / Motivation
Codex 原生 Host 从已保存的 quota 决策读取当前任务与恢复说明。 首次或失去基线的原生会话要读到完整任务、停止条件和恢复入口。该读取在每次 full 往返时重复传输相同正文。 当前实现减少了桥接响应正文,公开 full 与 warm delta 继续提供可读取的原始事实和恢复入口。 本次审查覆盖 native full、warm delta、显式关闭以及原 capture 的拒绝和恢复。 证据限定于合成工作负载、源码和隔离 wheel。端到端时间、模型输入和实际用户采用待验收。
改动思路 / Approach
现有 TS owner 仍选择 full 或 delta,并从原 source 导出 edits。只对 native/full/source_edits 删重复对象。Python 应用原 edits 后从 transaction.context 恢复 delivery.context,保留独立对象的原接口。 在同一现有 TypeScript owner 已经选好 full/delta 后收敛重复输出。Python 复用这份投影建立独立的 delivery 对象,已存在的存储、reader 和授权保持各自职责。 仅收敛原生 source-edit 传输。普通 full、兼容历史、delta 和只读恢复继续沿现有 owner。
具体改动 / Changes
基线为 172d80d630f424b0b44dd513863ba02b5f13d55c。已有规范要求 full/delta 共用已保存的原 capture 读回,保留原范围、义务、数值和可用的当前恢复路径。 基线规范
- full 单份投影。 独立匹配对照实际调用一次 Effect runtime。基线在 delivery.context 下传 48 条重复 edit,当前为零。归一 JSON 响应正文 21,642 → 12,469 字节。两版各一调用,warm 路径仍为 delta。
- 可验证恢复。 真实 CLI 对同一保存文件传错误 SHA-256 时拒绝。改回原摘要后读到 9007199254740993、-0.0 和 Unicode 约束,原捕获逐字节相同。两版通过。
- 其他调用。 File/SQLite 原生上下文测试、关闭及其他 surface 的相同输出、保留原数值和原始恢复内容。
关键代码讲解
prepareProgressiveContextDelivery 在 encodeContextDelivery 给出 full 后删除 bridge 上的正文副本。应用 edits 后,prepare_context_delivery 仅对该 full 填回独立正文。原 reader 和冷、暖路径仍接收原结构。 TS owner Python adapter 原 mode owner
对主干的风险 / Risks
核对了 12e6caa 相对 172d80d 的三个改动路径。原输出来回验证包括超出 JavaScript 安全整数范围的值、负零与 Unicode,且保留实际回执路径。与主干 32167518b3c2 无冲突组合。进程响应正文和独立恢复观察分别记录。
源码套件基线 340 通过,当前 340 通过,均 11 跳过。主干组合 84 通过和 11 跳过。三组各两项已归因失败。独立构建并安装 wheel 后重复同一真实 Effect 和 CLI 恢复用例也通过。 Quick premerge 的 6 项直接检查和 3 项选中检查通过。 两项原生 preflight 在基线、当前头及组合均收到 full、测试预期 delta。模式由现有 encoder 在改动前决定,去重与摘要恢复另有独立正反例。 远端 CI 未取样。
语义与 CI 对齐
当前重复字段仅在 full 决策之后移除。基线、head 和本地主干组合的既有 preflight 失败保留,受影响的不变量通过真实 Effect 以及公开 reader 复验。
我的整体评价 / Verdict
批准 12e6caaf4a5fd058c91e3e46c9035cbe8c03d9ea 的局部 native transport 改动。独立证据覆盖 full、delta、off、原摘要和失读恢复。 证据限定于合成工作负载、源码和隔离 wheel。端到端时间、模型输入和实际用户采用待验收。
English verdict: APPROVE. The native full response removes the duplicate edits and preserves the original full payload, delta path, and digest-checked recovery. The two existing preflight mode mismatches reproduce on both revisions.
Full native presentation already returns the required context as typed edits. The same response also encoded that context under
delivery.context. The native producer now sends one projected body across the Effect bridge. The Python adapter reconstructs the ordinary full delivery from that exact body. The delta path continues to carry its own edits.In a fixed File and SQLite CLI sequence with a real native startup hook, the affected SQLite response fell from 53,999 to 38,225 bytes. Effect wire bytes across initial read, review and writeback-contract read fell from 267,563 to 251,789. Including the guard, hook, one refused hash and same-capture retry, the sequence fell from 1,021,975 to 1,006,203 bytes. The stage outputs and call counts matched. These are process transport measurements for one local workload.
The real-runtime regression test reproduced the duplicate on the base. The focused source suite passed 98 tests and skipped 11. Two existing preflight cases also fail on
172d80d630because they expect delta and receive full. All 46 focused TypeScript tests and 23 isolated-wheel tests passed. The control-plane typecheck still reports the existing source Goal type error tracked in #8280.