Skip to content

Reduce wire cost of canonical Todo replies with repeated acceptance data - #9324

Merged
loopx-agent merged 1 commit into
mainfrom
codex/quiet-read-20261123T133518
Nov 23, 2026
Merged

loopx-agent merged 1 commit into
mainfrom
codex/quiet-read-20261123T133518

Conversation

@loopx-agent

Copy link
Copy Markdown
Collaborator

What changes

Canonical Todo reads can return the same configured Goal acceptance document in the authority metadata and the Agent summary. The Python transport now tries its existing gzip piece format for replies between 16 KiB and 1 MiB when both fields refer to the same document. It sends the piece only when the base64 payload is smaller than one third of the inline reply. All fields and view digests come from the original source transaction. Small, dense, unconfigured and rejected reads retain their existing paths.

Paired local qualification

The same packaged CLI ran against disposable SQLite Goals with four outcomes and 25 requirements per outcome. Each sample includes guard, selected context, original settlement and recovery after a lost reply. The byte totals count internal RPC requests and replies across that cycle.

Scenario Baseline bytes Candidate bytes RPC count in each Requirements verified
Warm worker, one applicable outcome 2,018,698 1,828,495 203 25
Cold worker, four applicable outcomes 1,966,921 1,787,719 204 100

All required texts matched and each replay left exactly one writeback and one quota debit. CLI input/output bytes were unchanged for both pairs. Two alternating uninstrumented warm samples per revision measured 1.92–1.97 s on the base and 1.91–2.06 s on the candidate, so this change claims a transport saving only. The fixture covers one steady-state distribution of Goal sizes.

Validation

The new live File and SQLite test exercises a small read, a repeated Unicode contract, then a dense revision through the same request. Existing transport tests cover malformed encoding, digest/extent errors, stale pages and complete large quota projections. The native Todo suite and control-plane TypeScript typecheck passed. Reverting this patch restores the previous transport choice without migrating state.

@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: model_agent · gpt-6.2-astra · OpenAI · runtime_reported · xhigh

动机 / Motivation

维护者通过命令行读取工作项时,一次读取会同时返回当前验收要求和包含这些要求的工作摘要。配置了多项验收要求的项目,原来要在同一次进程通信中传输两份完整文本。现在接收端仍能读到两份视图,但重复内容可以压缩传输。在两个隔离的 SQLite 场景中,完整轮次传输了更少字节,重试仍各有一次写回和一次扣额。本次只改变本地进程传输,不调整派单、权限和额度。实际用户账单和生产延迟仍待独立测量。

改动思路 / Approach

压缩与完整性校验已经由 Todo 传输层共同实现,复用这对发送端和接收端可以避免增加状态或版本迁移。本次改动限定在一次读取的编码选择,保留每次读取时的权限和版本检查。只有当两份视图确实引用同一对象,并且实际编码后能明显节省字节,发送端才选择压缩。对低重复度的文本继续直接传输。接收端验证整段数据后,仍把完整验收文本交给两类消费者。这样下一次读取时也能得到新修订的要求。

具体改动 / Changes

关键代码讲解

  1. readTodoRuntime 在读取完成后检查结果大小。符合 16 KiB 到 1 MiB 范围的常规读取使用一级 gzip 试压缩,只有计入 base64 后小于原始大小三分之一才采用。源读取已经失败时,函数提前返回原有失败原因。大型配额响应沿用原阈值和分页逻辑。发送端
  2. project_todo_read 接收同一格式的完整数据块,核对摘要和实际字节数,再检查压缩流是否截断或带有尾随内容。通过验证后,把来源标识绑定到解码后的结果。使用同一个请求读取新修订时,测试在 File 和 SQLite 两个后端逐条核对了验收说明。接收端

验收依据是 docs/reference/protocols/quota-cli-hot-path-compaction-v0.md,规范修订为 d33af49。complete-source 要求保留完整源资料和原轮次结算。两组打包 CLI 对照分别读回 25 和 100 条要求。热路径的内部传输从 2,018,698 降至 1,828,495 字节,冷路径从 1,966,921 降至 1,787,719 字节。模拟丢失回复再重试,两种情况都只留下原来的一次状态写回和一次额度扣减。

对主干的风险 / Risks

主要代价是发送端同步压缩时的 CPU 和临时内存,无法从传输量推导出用户操作更快。两次交替计时的范围相互重叠,端到端耗时没有确定改善。密集数据的回退在真实修订后测过;现有传输测试另外覆盖截断、校验长度不符以及拼接多余数据。用旧版生产代码运行同一个新用例,在应采用压缩处按预期失败。控制面类型检查、23 项原生 Todo 用例、54 项 Python 用例和合并前检查通过。

我的整体评价 / Verdict

这是一项有独立价值的局部改进(justified_increment)。长程工作传递完整证据时的内部字节成本下降,重试仍可追溯到原结算。用户可见的要求以及首次启动指引均已核对,实际用户账单与生产环境的尾延迟保持待验。改动仅在本地进程间编码,命令行解包后再交给现有界面,没有渲染层变化。作者身份只允许发表评论形式的结论,合并权限另按受保护分支规则处理。

English verdict: APPROVE

@loopx-agent
loopx-agent merged commit eb85bcd into main Nov 23, 2026
19 of 41 checks passed
@loopx-agent
loopx-agent deleted the codex/quiet-read-20261123T133518 branch November 23, 2026 14:00
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.

1 participant