Repository navigation
Reuse resolved addresses when reading pinned context pages - #8399
loopx-agent wants to merge 1 commit into
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
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
动机 / Motivation
原生会话读同一份固定选读时,旧读取器在读页和观察核验阶段会反复解析同一组地址。对照 File 和 SQLite 上同一份四页捕获。两种后端的 selector RPC 均从 8 次降至 1 次,3,418 字节正文和 3 个已确认字段一致。复验走真实本地 CLI、Node IPC 和 native hook,数据为隔离样本。已安装环境的延迟和模型成本另验。
改动思路 / Approach
地址仍由现有 TypeScript selector 解析,Python 按已核验的捕获和类型化地址取值。改动限于带值选读的私有引用与读回,旧引用和字段发现仍走原选择器。新引用保留原始捕获和选读摘要,每页校验两者。观察器继续核对本轮作用域、实际页字节和完整覆盖。
具体改动 / Changes
评审提交 1f1ba64e9b4d85c30a82aa54067ae2293dd8bafb,PR 基线 c44eb156d947198b9b5e36e1f9444afbbf9b205b,6 个文件,+151/−22。当前主干自共同祖先以来的其他修改与该 diff 无重叠。已核对 same-capture-view、typed-address-replay 和 legacy-and-recovery。installed-cost 保留为单独验收。选读与恢复约定
关键代码讲解
write_context_read_reference只在引用能落在现有传输预算内时保存解析结果。读取时先核对地址与指针,再按数组下标或对象键取值。引用写入 地址回放read_context_capture分页和verified_context_selection观察共用相同回放。当前观察失效时,普通选读回退仍绑定同一捕获。CLI 读取 观察核验
对主干的风险 / Risks
两版各通过 7 个实际入口对照。转义键、数组下标和超出 JS 安全整数范围的值均精确读回。错误键类型、摘要和损坏页分别在读页或观察层被拒绝。旧读取器遇到扩展字段仍用原选择器。上下文压缩后恢复当前原文,关闭 native 时两轮结算保持一致。本地样本中两种后端的传输各少 8,407 字节,私有引用增加 189 字节。候选的 251 项相关测试和 25 项直接或自动预合并检查通过。
我的整体评价 / Verdict
认可当前提交。选读和观察减少了重复地址解析,原捕获、摘要校验、逐页内容与原地恢复都能按既有约定验证。实际收益范围是这次实测的本地选读传输。
English verdict: APPROVE. At 1f1ba64, the four-page reader and observer use seven fewer selector calls on File and SQLite while preserving exact content, old references, and recovery.
A pinned context selection now keeps the addresses already resolved by the selector. Paging and the native read observer use those addresses to render the same view from the original capture. They verify both digests. New selectors, field discovery and older references use the existing selection route.
Resolved addresses are optional metadata in the existing private reference. The replay checks each address, including the difference between array indexes and object keys. The selection descriptor grows by the address data. The original capture and page body still carry the same values, including large numbers and non-ASCII text.
Matched CLI replay
The File and SQLite cases use the real guard, bounded selected reads, native
PostToolUseobserver and required inbox read with an isolated synthetic agenda. Each pair delivers the same stdout byte count and verified section addresses.In the three-page main replay, the private reference adds 3,833 bytes of storage and about 23 KB of logical reference reads across paging and observation. Each workflow removes about 82 KB of framed traffic. The replays quantify transport, selected bytes and section observations. Latency and model or task outcomes require separate comparisons.
Validation
c44eb156d947198b9b5e36e1f9444afbbf9b205band head1f1ba64e9b4d85c30a82aa54067ae2293dd8bafb.Related to #8266.