Repository navigation
Reuse resolved addresses when reading pinned context pages - #8399
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.
huangruiteng
left a comment
There was a problem hiding this comment.
Reviewer: model_agent, GPT-5, OpenAI, self_reported
Independent approval
动机 / Motivation
原生会话读同一份固定选读时,旧读取器在读页和观察核验阶段会反复解析同一组地址。受影响的是读取 pinned native context selection 的 Agent 和本地 Host;操作者通过同一 recovery/read command 获取内容。File/SQLite 的四页捕获在旧读取器与当前 head 上返回相同 3,418 字节正文和三个字段;selector RPC 从 8 次降到 1 次。当前页面、native observation 和恢复内容保持相同;转义键、数组 index、字符串 key 和非 JS 安全整数均保持精确。旧 reference 与字段发现仍通过原 selector,损坏路径或 digest fail closed。本次只测源代码 CLI、Node IPC 和 native hook 的真实本地路径;已安装环境的延迟和模型成本另验。本 PR 不改 selector 的语义、不改变读取权限或 capture identity,也不声称已经测量安装版延迟和真实模型成果。
改动思路 / Approach
地址仍由现有 TypeScript selector 首次解析。地址仍由唯一 selector 首次解析,私有引用只保存派生结果;读取和观察仍按原 capture、typed path 与摘要校验。新 pinned value selection 可把 resolved paths 作为 context_capture_read_reference_v1 的可选私有元数据保存;Python 在已核验的 capture 上按 str/int 类型化路径取值,再校验渲染后的 selection digest。旧引用、initial read 和字段发现没有 paths,仍走原 selector。原 capture 与页 body 继续是内容权威,路径只是派生 locator。改动限于带值选读的私有引用与读回,不新增 selector、capture 或 authority。本次覆盖 pinned value page、native observer、旧引用兼容、损坏地址/digest 拒绝和最新 main 集成;安装版延迟另验。
具体改动 / Changes
评审提交 1f1ba64e9b4d85c30a82aa54067ae2293dd8bafb,PR 基线 c44eb156d947198b9b5e36e1f9444afbbf9b205b,6 个文件,+151/−22。已核对 same-capture-view、typed-address-replay 和 legacy-and-recovery。installed-cost 保留为单独验收。选读与恢复约定
关键代码讲解
write_context_read_reference只在引用能落在现有传输预算内时保存 resolved paths;超限时保留旧 selector replay。引用写入_pinned_selection_plan与_context_selection_bytes先核对 pointer/path、int/string key 与实际容器类型,再从原 capture 取值;相同文本位于 sibling path 也不会误用。地址回放read_context_capture和verified_context_selection共享 saved paths;页面内容、native observation 与 recovery 仍校验 capture 和 rendered selection 两个 digest。CLI 读取 观察核验
对主干的风险 / Risks
最强反例是两个 sibling path 文本相同,或数组 index 被错误当成 object key;一旦缓存地址绕过类型与摘要校验,就会把错误位置当成正确内容。测试分别覆盖 different_path、wrong_key_type、changed view digest 和 changed capture digest;四种情况都拒绝且不返回 content。新引用跨页时禁止再次调用 selector,旧引用则断言仍调用一次;转义键、数字键、数组 index、9007199254740993 与非 ASCII 文本均精确回读。
exact head 的 focused Python 通过 8/8;最新 main 4b551d2d7c31 与本 PR 的 merge preview 无冲突,并同时覆盖 #8393/#8397 的 ready-opening、write-scope 与 Manager Inbox 路径通过 33/33;三组 control-plane TypeScript 测试通过 92/92,typecheck 与 diff 检查通过。远端历史失败/取消记录属于 behind head 的旧运行,本轮不依赖这些结果;真实模型和安装版延迟仍未测量。
我的整体评价 / Verdict
认可当前提交。选读和观察减少了重复地址解析,原 capture、capture digest、rendered selection digest、逐页内容与恢复都保持既有语义。selection_paths 是可选的派生私有 locator,不是新的内容或权限来源;旧 reference 和列表发现仍使用现有 selector。最新 main 集成也证明它可以和刚合入的 Progressive first-read 改动共存。
English verdict: APPROVE for 1f1ba64. At this head, the four-page reader and observer use seven fewer selector calls on File and SQLite while preserving exact content, old references, and recovery. The latest-main integration with adjacent progressive-context changes also passed.
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.