Repository navigation
Read write scopes on demand before a progressive Turn is ready - #8303
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>
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
同时管理多个工作项的操作者和 Codex 宿主,会先为普通 Turn 选定任务,再取得该任务的租约。 以 220 条路径规则为例,原先选择和领取时都读取整份列表。现在可以先读决定,遇到依赖路径范围的选择再查原捕获。 配对实测两次准备首读各少约 4 KB。就绪阶段仍读到同一份完整范围,审批和停止条件继续出现在准备首读。 交付范围是普通 Turn 在选择工作或取得租约前的首读。就绪决定仍携带完整写入范围,实际写入权限和租约由原有规则决定。 后续仍需用真实宿主观察模型是否按需补读,并计入补读和失败重试后的完整成本。
改动思路 / Approach
准入判断已区分选择、领取和就绪。投影层复用这个结果,把足够长的范围列表移到原捕获的按需读取,停止条件和审批要求继续内联。无状态 CLI 与原生 full/delta 使用同一个选择规则。 机制复用现有的 progressive plan、JSON Pointer 和 digest-bound reader。指针由当前捕获推导,原始 guard、claim 和 settlement 继续由各自 owner 管理。 大列表以 UTF-8 序列化阈值触发,准备态必须由正常、禁止执行和记账的 typed contract 证明。已就绪、短列表和显式关闭保留原投影。
具体改动 / Changes
基线为 94b91e48aa4a2cdafe9d4d31d918fe84d0112b41。已接受的 CLI 渐进导航约定分别验证首读、可核对的完整补读和 effect 不变,并区分输出字节与总成本。 基线规范
- 按需准备首读。 220 条范围的 File 首读由 11,678 / 12,369 / 23,021 字节变为 7,663 / 8,354 / 23,021,分别对应选择、领取、就绪。SQLite 前两阶段也各减少 4,015 字节。
- 当前来源校验。 改用错误的 SHA-256 时真实 reader 返回失败。显式关闭时原捕获含完整范围。短列表选择、领取和就绪首读逐字节计数与主干一致。
- 准入与限制。 真实 File/SQLite 首读保持停止、审批和回执;就绪都恢复 220 条。
- 完整成本。 后续仍需用真实宿主观察模型是否按需补读,并计入补读和失败重试后的完整成本。
关键代码讲解
progressivePreparationScope 判定准备态与列表阈值,requiredNativeContext 生成首读及指针,contextPresentationPlan 在两条入口复用。已存在的 replan 投影仍优先。 准备态判定 首读生成 共用入口
对主干的风险 / Risks
如果每次准备都依赖范围,就会增加一次补读,首读节省与总成本需分别计量。原生 full 和 delta 里都沿当前摘要回读,遇到错误摘要要重新取得有效的当前引用。短列表和就绪保持内联。 实际 CLI 回归
准备与读回 170 项、原生/authority 136 项、相关 TypeScript 96 项通过。 Quick premerge 的 5 项直接检查和 4 项选中检查通过。 在最新主干 8225c89cea 的无写入组合再跑 37 项相关用例,并重复 File/SQLite 原生 full → delta → delta 的范围与原停止条件验证。 远端 CI 未取样。
现有 write-scope coverage、未领取或他人租约、显式关闭和摘要篡改均有负例。四个提交均有 DCO sign-off,已检查与当前主干的组合。
我的整体评价 / Verdict
赞同 24c7d68b37cc024b29b807fd47c8c46a2876e79a 的限定传输改动。实际准备态首读缩小,按需路径可读,原权限与就绪读回保留。 后续仍需用真实宿主观察模型是否按需补读,并计入补读和失败重试后的完整成本。
English verdict: APPROVE. The scoped progressive read is ready on this head. The matched File and SQLite CLI paths preserve the digest-bound source, stop and approval clauses, and the complete ready scope.
Before explicit Todo selection or an ordinary claim, the progressive Turn view now points to a long write-scope list in the captured decision. If the choice depends on that list, the agent can read the exact pointer from the original source. The claim still checks the scope, and the ready decision carries the complete current list, stop conditions, approval rules and original receipt.
选择 Todo 或普通认领前,渐进视图为长写入范围清单给出原捕获地址。选择确实依赖范围时可按需回读,认领继续校验,可执行决策包含完整范围、停止条件、审批规则和原回执。
The same synthetic three-stage fixture reduced selected body bytes from 49,293 to 41,575, with identical ready output and the same reader call count when no scope lookup was needed. A scope lookup adds one call. File and SQLite exercise real selection, claim, ready, the exact source lookup, and explicit progressive-off recovery. The frozen baseline fails the new preparation-stage assertion. A disposable native session also exercises full/delta/delta through all three stages.
Validation on
24c7d68b37cc024b29b807fd47c8c46a2876e79aagainst94b91e48aa4a2cdafe9d4d31d918fe84d0112b41. 9 focused source cases, 81 TypeScript cases, and 5 isolated-wheel cases passed. Standard premerge passed 5 direct and 15 selected checks with an explicit local per-check wait. The two native preflight full/delta expectations also fail on the unchanged main baseline.