Repository navigation
Reuse observed writeback guidance in native context - #8408
loopx-agent wants to merge 2 commits into
Conversation
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
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
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
动机 / Motivation
同一 ready Todo 的 native 读者会重复收到已完整读过的写回前置指引。我在 File 和 SQLite 上分别对照了两个真实准入并结算的 Turn,验证精确复用可以减少重复输出。已完整交付时,File 的 warm 首读从 21,073 降至 18,080 字节,SQLite 从 21,099 降至 18,106 字节。本次对照使用真实源代码 CLI 和 native hook,工作样本为本地合成。真实模型采用率与完整成本另验。
改动思路 / Approach
复用现有分段摘要。只有当前 ready Todo 的计划身份、原回执、注册路由及已观察原文匹配时,首读才引用已交付指引。当前命令、结算身份与其余选读仍正常交付。两处相隔较远的字段都可复用时,按原选择顺序传入分段改动。完整当前视图仍可从同一捕获读回。
具体改动 / Changes
评审提交 1bda44878fbd33acd702faf4e4b7276422ca7f99,PR 基线 71190b6b4ef4e146f3bf4a10d31ce61ac42fd021,5 个文件,+172/−34。TypeScript 选择器登记写回指引,Python 读取器应用选择变更并保留原回退,两版指南说明复用和恢复边界。已验证 observed-current-precondition、fresh-settlement-command-and-identity 和 partial-and-compaction-fallback。原首读和恢复约定
关键代码讲解
reusableWritebackPrecondition先核对 ready plan 和原回执,再把这一个 agent-owned 字段加入当前路由的摘要覆盖。字段准入observedFirstRead保留当前控制字段,输出有序的选择改动。observed_first_read_reference从原选择重放并保留同一捕获的普通视图。选择投影 读取回退
对主干的风险 / Risks
两版各跑 6 个实际 CLI 场景。第二轮的结算身份、写回和扣额命令与当前捕获一致,每轮各结算一次。只读到前 256 字节、发生压缩或显式关闭时,当前说明仍按原路径交付。同一捕获的显式选读可读回原文。另有 256 项相关测试、TypeScript 类型检查和 20 项直接或自动预合并检查通过。
我的整体评价 / Verdict
认可当前提交。改动缩短了已满足完整观察条件的首读,同时保留当前结算依据与恢复路径。剩余 installed-model-benefit 保持单独验收。
English verdict: APPROVE. At 1bda448, the warm reader emits 2,993 fewer bytes on each tested backend while keeping current settlement commands, one spend per original Turn, and literal recovery after partial delivery or compaction.
A continuing native Todo can receive the same writeback precondition on every Turn. The progressive first read now references that field when it was delivered in full and matches the current ready plan, registered route and task in the same context epoch. It still delivers the current settlement identity and commands. Changed text, a changed source or binding, an unknown plan, or lost continuity returns the full current text.
The native reader passes disjoint edits to its ordinary selection plan as separate ranges. Reusing two distant fields therefore avoids retransmitting the addresses between them. The existing single-range and full-selection paths are supported.
Matched one-session original-quota CLI replay with two ready hard-lease Turns and the same 12,000-byte output cap. Main ran from the built wheel and C1 from the locally integrated source.
Cold reader output size and full replay call counts matched. The selected Todo, complete settlement plan, failed-then-passed independent validator, wrong-binding refusal, same-capture recovery and once-per-Turn spend also matched.
Native first-read and lifecycle tests, context-selection and delivery tests, TypeScript typecheck, standard local premerge and wheel source verification passed. Live model adoption and token costs remain unmeasured.