Skip to content

Reduce scalar transport for explicit context selections - #7923

Merged
loopx-agent merged 1 commit into
mainfrom
codex/c1-selection-transport
Nov 3, 2026
Merged

loopx-agent merged 1 commit into
mainfrom
codex/c1-selection-transport

Conversation

@loopx-agent

@loopx-agent loopx-agent commented Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator

本轮重放与验证 · 2026-11-03

提交:3d88f83e7e66e2aefdce4ffcaeb975501f8e4a55;基于 main 57050e2fdfdf8ba5b593ac0b7bb6428deb802b04。

  • 解决 quota_capture.py 冲突:保留 main 新增的 nearest-container rejection recovery,同时只对显式非导航选择使用压缩 planner payload。
  • 初始读取、index/discovery、最终选中值、selection digest、分页和错误语义仍走原有完整来源。
  • 当前源码验证:六个 context reader/selection 模块 160 passed;Ruff、Python compile、RFC 双语和 diff 检查通过。
  • 标准 canary 通过:18 项选择、0 failure、0 manual hold;已知 non-diff maintainability failure 保持 advisory,模块 ceiling 直接检查通过。

本轮未重新测量延迟、内存或模型成本;PR 的性能声明仍严格限定为 planner request 的 parameter-JSON 字节减少。


Explicit context selections send long scalar bodies to the TypeScript planner even though address validation needs only their container structure. The existing file adapter now omits long strings from that planning input and returns selected values from the digest-checked original. The same TypeScript owner still validates every pointer; initial reads and discovery retain their full input, and every page still verifies the original capture.

On one fixed 353,598-byte synthetic capture, explicit and opaque selection requests each fall from 353,930 to 1,563 parameter-JSON bytes per call (99.56%). At both 12 KB and 64 KB output limits, every page of final stdout, selection digest, reader/RPC call count and RPC result remains identical. Invalid-pointer and changed-source errors also match. This measures internal parameter transport; latency, allocations, model cost and task outcomes remain unqualified.

Validation:

  • Current head: five complete reader modules, 102 passed; includes numeric identity, signed zero, escaped paths, 650-level input and full-reader isolation. The new regression first failed on the original transport while six controls passed.
  • Three additional integration modules: 116 passed, 46 native opt-in cases not enabled, on identical affected sources before rebasing unrelated upstream changes.
  • Standard premerge: six direct checks passed; all 18 selected checks passed across the original run and a single semantic-check rerun after installing the missing TypeScript development dependency. Ruff, diff hygiene and the module-growth check passed.

The initial dependency failure is retained. The managed premerge gate still lacks a current exact-scope quality receipt, so overall merge readiness is unqualified. This is a completed author proposal for review.

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer: model_agent | model=gpt-6.1-sol | provider=OpenAI | runtime_reported | reasoning_effort=max

Approval conclusion (author-owned PR; GitHub blocks formal self-approval)

未发现当前完整提案的阻塞缺陷。

动机 / Motivation

通过 quota context-read 按字段读取大型已捕获决策的 Agent 与维护者。 旧路径为校验少量 JSON pointer 也向 TypeScript 重发所有长文本;新路径只送容器结构校验地址,再从完整且哈希已验证的原捕获返回原值。 相同捕获的 40 组真实 CLI 对照中全部分页输出、错误和退出码逐字一致,首个选读请求参数从154781降到496字节。 不改变应读要求、模型消费证明或持久状态,不认证延迟、内存、模型费用与长期任务收益。

改动思路 / Approach

复用现有 TypeScript 地址验证 owner,Python 只生成容器和键相同的规划输入。长文本不参与地址是否存在的判断,因此无需重发;真正回传时仍读取完整原值。这个局部 IO 适配不另写 pointer 语法、错误优先级或摘要协议,也没有引入长期缓存来绕过每页完整校验。边界是内部选读传输,后续延迟或模型成本收益需要另外测量。

具体改动 / Changes

完整审查 d188b26e840ef723f9b3e1b6587f64ed901217b9 相对实际共同基线 fd05b56cf9105dcc47700bbfcc719221fbe51490 的两文件、+124/-1。spec_ref=docs/reference/required-work-context.md,spec_revision=fd05b56cf9105dcc47700bbfcc719221fbe51490;修改前 Selected capture details / 按需读取捕获详情 的原值、整批地址错误、排序去重及每页摘要要求在当前 head 均 implemented。

关键代码讲解

  • _context_selection_transport 迭代遍历 dict/list,保留 keys、数组长度与结构,仅将超过两字符的字符串换成 null;没有把该副本持久化为捕获正文。
  • read_context_capture 只对明确 selectors 使用此输入;初读与索引发现仍需真实 scalar,完整 reader 也不走该选择 RPC。原文件全字节 SHA 每页重验,选择结果随后从原 payload 重建。
  • 原 context_selection.ts 继续验证 RFC6901 转义、根指针及数组索引,单个错误仍拒绝整批,没有把规划搬成第二套 Python 规则。

对主干的风险 / Risks

独立运行五个完整 owning Python 模块 76 PASS /46 SKIP、TypeScript selector 9 PASS、Ruff 与标准 premerge 6 direct /18 selected PASS。46 个跳过项需要显式 native Codex binary,未冒充已验证;这次另用真实公开 CLI、真实文件和真实 TypeScript 选择 RPC 核验核心风险。

同一154650字节捕获 不可变 base 当前 head
首个显式选择请求参数 154781字节 496字节
两种页大小、显式/opaque、转义/root/大整数及错误 40组完整输出 stdout/stderr/退出码逐字相同
初读、发现、完整 reader 原路径 scalar不裁剪;完整reader无选择RPC

比较没有归一化输出;原 fixture SHA、选择摘要和每页 next command 保持一致。另在私有内存中仅把输出重构源从原 payload 换成结构副本,沿相同公开入口的独立“必须返回原值”断言按预期失败;作者源码未改。这能区分节省传输与错误裁剪正文,补足了仅检查 helper 字段的局限。没有查询、轮询或等待 CI。

我的整体评价 / Verdict

APPROVE。 long_horizon 与 user_experience 的公开语义保持;验证了内部字节减少,没有将其提升为长期任务效果或模型采用。当前实现只有一个活动 caller 和局部 helper,复用/有界简化合理,无需新架构或迁移。两文件没有渲染布局或页面数据变化,真实 CLI 分页已对照;已安装宿主、模型消费、长期净收益未验证。按同账号 COMMENTED 承载批准结论,合并仍由独立权限、验证与 ready 门判断。

English verdict: APPROVE — exact head d188b26e840ef723f9b3e1b6587f64ed901217b9; independent public-CLI/TypeScript comparisons preserve complete outputs and rejection semantics while reducing explicit-selection transport bytes. Installed-host adoption and end-to-end cost benefits remain unverified.

@mergify

mergify Bot commented Nov 3, 2026

Copy link
Copy Markdown

This pull request has merge conflicts with main and cannot be merged
until they are resolved. Please rebase or merge the base branch, @loopx-agent.

Choose the remote for the base repository, not an out-of-date fork.
For a fork clone, first inspect git remote -v; upstream must point
to https://github.com/loopx-project/loopx.git. If it is absent, add it
with git remote add upstream https://github.com/loopx-project/loopx.git.
Then run:

git fetch upstream
git rebase upstream/main
# Resolve each conflict, git add the resolved files, then git rebase --continue.
git push --force-with-lease origin HEAD

For a same-repository clone whose origin points to
https://github.com/loopx-project/loopx.git, use origin instead of
upstream for fetch/rebase. If you prefer merging the base, use
git merge <base-remote>/main and push normally.

Keep the DCO Signed-off-by trailer on every commit when you rebase.
https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify Bot added the needs-rebase Mergify: the pull request has merge conflicts with its base branch label Nov 3, 2026
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
@loopx-agent
loopx-agent force-pushed the codex/c1-selection-transport branch from d188b26 to 3d88f83 Compare November 3, 2026 04:44
@mergify mergify Bot removed the needs-rebase Mergify: the pull request has merge conflicts with its base branch label Nov 3, 2026

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approval conclusion (author-owned PR; GitHub blocks formal self-approval)

Reviewer: loopx-agent; exact head: 3d88f83e7e66e2aefdce4ffcaeb975501f8e4a55

动机 / Motivation

显式 context selection 只需要 TypeScript 验证地址结构,却会把未选中的长字符串和说明文本一起送入 planner。大 capture 因而产生不必要的 request 体积,可能挤占传输和输出预算。当前变更只压缩显式、非导航选择请求中的长标量,最终返回值仍来自完整、摘要校验过的原始 capture;初始读取和 discovery 保持完整输入。

改动思路 / Approach

Python 文件适配器构造保留对象/数组层级和短标量的 planning payload,把长字符串替换为 JSON null。TypeScript 仍拥有每个 pointer 的解析与拒绝,Python 再从原始 payload 按 TS 返回的 path 取真实值。当前 head 已重放到最新 main,并保留 main 新增的 nearest-container rejection recovery;两者只在 _turn_envelope_result 的输入处组合,没有改变任何错误恢复或分页语义。

具体改动 / Changes

关键代码讲解

  • _context_selection_transport 只替换长度大于 2 的字符串;对象键、数组长度、数字、布尔、null 和短标量不变,避免 null 替换导致 payload 反而增大。
  • read_context_capture 仅在显式非 --list 选择时使用压缩 planner 输入;初始读取、字段发现、最终选中值、selection digest 和每页原始 capture 校验保持原路径。
  • _turn_envelope_result("context_select", ...) 仍是地址验证 owner;压缩只改变 planner request 的未使用标量,不给 Python 增加地址判定权。

验证

  • 六个 context reader/selection 模块:160/160 通过。
  • 新回归覆盖长 prose、Unicode、数字身份、signed zero、转义 pointer、650 层输入和 full-reader isolation。
  • rebase 冲突验证同时覆盖 main 的 invalid-pointer nearest-container recovery,证明压缩 planner input 没有绕过 TS rejection。
  • Ruff、Python compile、双语 RFC 和 diff 检查通过。
  • 标准 canary 通过:18 项选择、0 failure、0 manual hold;已知 non-diff maintainability failure 保持 advisory,模块 ceiling 直接检查通过。

对主干的风险 / Risks

没有发现新的阻断性功能问题。主要风险是压缩改变地址结构、把未选中的标量误当作最终值,或影响初始导航;当前 transport 只处理显式非导航选择,最终值始终从原始 payload 读取,digest、分页、reader/RPC 次数和错误语义由测试锁定。PR 只声明 parameter-JSON 字节减少,不把内部传输优化外推为延迟、内存、模型成本或任务收益。GitHub CI 仍需在 exact head 上完成。

我的整体评价 / Verdict

APPROVE。当前精确 head 在不转移地址判定所有权、不改变最终值和错误语义的前提下,减少了显式 context selection 的 planner transport;rebase 冲突也按 main 的恢复语义正确合并。

English verdict: APPROVE — exact head 3d88f83e7e66e2aefdce4ffcaeb975501f8e4a55 reduces unused scalar transport while preserving pointer validation, original-value selection, pagination, digests, and recovery behavior. The claim remains limited to internal parameter bytes, not end-to-end performance.

@huangruiteng huangruiteng left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Independent approval of exact head 3d88f83. The scoped transport tests and standard premerge pass; the self-review conclusion is published separately.

@loopx-agent
loopx-agent merged commit c043388 into main Nov 3, 2026
3 of 5 checks passed
@loopx-agent
loopx-agent deleted the codex/c1-selection-transport branch November 3, 2026 04:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants