Skip to content

fix(quota): reference repeated full task titles in CLI packets - #7330

Merged
huangruiteng merged 1 commit into
mainfrom
codex/context-cold-read-162043
Oct 25, 2026
Merged

huangruiteng merged 1 commit into
mainfrom
codex/context-cold-read-162043

Conversation

@loopx-agent

@loopx-agent loopx-agent commented Oct 25, 2026 •

Copy link
Copy Markdown
Collaborator

Long multiline Tasks can reach the quota CLI twice: the complete selected-Todo read and agent_lane_next_action.title. The existing title deduplicator compares the whitespace-normalized, bounded next-action text against the complete title, so it misses this case.

Reuse the complete, current, TypeScript-verified selected-Todo source already in this response. Replace only an exact duplicate lane title with title_ref; retain all requirements, source metadata, control fields and original captures. Missing, incomplete, ambiguous, mismatched or different sources retain their title. Explicit --include-detail agent-todos retains the inline title.

This is ordinary CLI serialization, applying with differential delivery off and on. The native differential switch remains default-off, and this change does not enable tracing or native transport. The existing Python display adapter consumes the typed owner's verification; it adds no decision, persistence or permission owner, capability, dependency or switch.

长、多行 Todo 的短摘要经过折叠和截短,旧去重无法识别它与完整标题的重复。本次仅把当前包内已核验、精确相同的标题副本改为 title_ref,完整要求与控制信息保留。普通全量路径也受益;差分开关继续默认关闭。详见同包引用合同。

Additional applicability calibration at the same reviewed head: all 31 previously selected historical benchmark packets have identical compact output under the two renderers. Reusing two retained single-line case Task text/title/note records inside isolated Goal/runtime fixtures, all 16 exact-ID native cells (32 cold/warm wakes; File/SQLite × off/on × base/head) consume complete input, reconstruct warm deltas, and retain the original Turn/debit checks. Across all eight same-mode base/head pairs, packet bytes and native request counts are unchanged (22 → 22 off; 19 → 19 on). Both renderers also give identical complete projections for all 32 fresh captures; no new title_ref is emitted because the legacy single-line path already avoids that duplicate. Entire-request token proxies vary −0.70% to +0.29% with identical serialization; this variation is not attributed as a saving or regression. These are Task-shape transport checks, not reruns of the original cases or solver outcomes.

因此,下方 16%–20% 仅属于 240 行多行任务的压力口径;本次两份真实单行任务文本对照没有额外 packet 缩减。原多行结果保留,但不能据此外推当前 benchmark 的收益。没有新增模型账单、solver 效果或安装采用结论。

Matched native-worker replay against clean ea1421812, using File/SQLite, one synthetic 240-line Task, two same-session wakes, the same CLI prefix, and unchanged 3 KiB first / 4 KiB continuation pages:

Provider / mode Complete request-input proxy change Native requests, two wakes
SQLite / off −19.26% 30 → 26
File / off −19.31% 30 → 26
SQLite / on −16.03% 23 → 20
File / on −17.26% 23 → 20

Cold packet size falls about 18.8% (57.0 → 46.3 KB). Counts use o200k_base over entire request JSON, including repeated history, tool definitions, instructions and every supplementary read. All eight revision/provider/mode cells consume complete bytes, preserve the original Turn and one inter-wake debit, and reconstruct warm deltas. Eight same-capture comparisons recover the entire baseline projection after expanding the exact reference.

This deterministic loopback qualifies transport, not model reasoning, billed tokens/cache pricing, solver score, installed Desktop adoption or IO/latency savings. Differential cold setup overhead remains; these are measured reductions against the same-mode baseline for this workload.

Validation on 22c3f1069:

  • 109 focused contract / File / SQLite CLI cases passed.
  • 162 context-consumer cases passed, including nine actual native loopback cases; 43 optional cases skipped.
  • Configured strict mypy (17 source files), Ruff, TypeScript control-plane typecheck, public-boundary scan and bilingual diff check passed.
  • Standard premerge: all six direct and 14 selected checks passed. Exact-scope CQR cqr_ad1eb99c20e356728786 is valid.

Known inherited failure: tests/control_plane/test_turn_completion_source.py has four callback-count IndexError failures on both clean base and head (24 pass / 4 fail each). Separate identical-command runs retain identical full failure signatures and fixture/environment digests. The failed short-Task captures have identical complete projections under both renderers; this new alias is inactive there. CQR records this author attribution as an unresolved warning. These tests remain failed: no full-suite or required remote-CI pass, independent review, merge readiness or installation is claimed.

The bounded companion refactor extends the existing exact-title helper and same-response reference pattern. Larger renderer migration remains separate from this serialization fix.

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

@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: actor_kind=model_agent; model=gpt-6.1-sol; provider=OpenAI; declaration_source=runtime_reported; reasoning_effort=max.

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

未发现阻塞问题,代码结论 APPROVE,绑定 22c3f1069c7f3081beeff479ff16404e0b972288。完整测试并非全绿:四个相邻完成回调测试在不可变原基线、当前目标分支和本 head 都失败,下面保留其独立归因;这不是远端 CI、合并就绪或合并授权。

动机

反复读取长、多行任务的 CLI Agent。

长任务原来同时出现在完整来源和下一动作标题中;现在只把已核验且精确相同的标题副本改为同包引用,完整任务仍可直接还原。

File 与 SQLite 的 16 个实际 CLI 基线/head 对照在精确展开引用后完整等价;长标题路径少传一份正文。

本 PR 不改变任务准入、验收、结算、来源权限或差分默认值,也不证明模型用量、费用或长期成果改善。

评审依据是改动前的 docs/reference/protocols/quota-cli-hot-path-compaction-v0.md,版本 ea1421812bab0c12da858a4216c6b9270ce16572。其 Ownership Boundary 要求先计算完整决定再投影视图,不能重算路由或丢弃行动权威;Qualification Contract 要求完整/紧凑还原、形状与边界的确定性验证,模型行为和真实成本另行资格化。这两个条件在当前范围有独立调用证据,不以作者的压缩率或测试数作为验收。

改动思路

同包精确引用复用现有 Python CLI 序列化层;完整来源核验继续由既有 TypeScript owner 负责,无新增决策或持久状态。

当前范围限于默认 CLI 包的一个重复标题及其显式明细回退;更大的渲染器迁移不属于此修复。

旧规则只比较 lane 的有界摘要与标题,遇到折叠换行或截断后的长任务时,完整标题仍重复传输。新分支先保留旧的短标题去重,再消费当前完整 work-context 的核验事实。只有唯一 selected-Todo 来源、正确任务身份、完整且已核验的正文,以及精确相同的 text/title 才能产生引用;不从前一捕获、相似文本或摘要猜测内容。

这次不适合再加缓存、接收确认或独立传输 owner。现有 TypeScript 已核对来源身份、完整正文摘要、状态和 claim;Python 只选取包内相等的 scalar。既有引用模式与显式明细已足以处理有用边界。用前后路径文字对照即可说明,未加入需要额外渲染验证的示意图。

具体改动

三条路径合计 +168/-10:cli_projection.py 的既有 helper 增加 +51/-10,测试增加99行,协议增加18行中英说明。_deduplicate_agent_lane_next_action 保留短文本旧行为,长标题则在引用确实比正文省字节时生成 title_ref。compact_quota_should_run_cli_payload 把同一完整包传给 helper,--include-detail agent-todos 仍直接保留标题。后续的现有压缩与 promotion 没有移走引用目标,原输入对象也没有改写。

独立验证包括:

  • 对原 merge-base 与精确 head,从同一 canonical fixture 快照运行16个公开 CLI 场景,覆盖真实 File/SQLite、长正文、不同 title、短正文、显式明细、Markdown、完成任务、未 claim 任务,以及超过展示上限的12个其他 Agent 项。精确展开新引用后,完整输出一致;保留 provider revision,只归一化观察时钟、派生 freshness age 与随机 rollout event ID。
  • 长标题、不同标题和超限无关项三类,在两后端都移除一份完整副本;原正文、控制字段、来源元数据、停止条件及权限没有缩短。旧版本的去重收益断言会失败,当前可从包内还原完整原文。未 claim 的候选没有获授权来源时保留旧路径,不把缺来源当成可去重证明。
  • projection/settlement 的204个用例通过;另一组实际上下文 full/delta/recovery、Host 和捕获消费者86通过、30条件跳过。17种来源边界覆盖 missing proof、partial、failed、ambiguous、wrong identity、已有引用、done/archive、布尔身份及短文本等拒绝/保留路径。跳过项不冒充原生宿主或模型保留证明。
  • 标准 premerge 的6项直接检查和14项选中检查通过、无 manual hold;配置内17源文件严格 mypy 与 TypeScript 控制面 typecheck 通过。未查询、轮询或等待远端 CI。

相邻 test_turn_completion_source.py 的同一命令在不可变 ea1421812bab0c12da858a4216c6b9270ce16572、当前目标 2b01f9450fc40472821c54e71c1da27b7cd5d91b 和当前 head 均为24通过、4失败。完整失败身份与 traceback 仅归一化临时目录和 monkeypatch 对象地址后相同:File/SQLite 两组回调列表索引在202/477行报 IndexError。这些短任务不进入新 alias,失败所依赖的来源/完成逻辑不在三文件改动里;独立长任务/完整包证据覆盖本次不变量。这四项仍是 failed,不宣称完整套件或主干所有检查已绿,也不要求本 PR 修无关的 fixture 回调契约。

对主干的风险

最强风险是错误引用掩盖了任务中的验收或停止条款,而 helper 单测仍通过。这里用实际公开 CLI 还原整个包来区分这个风险;仅“字段还在”或预算变小不足以证明语义等价。source 不完整或身份不符时保持标题;显式 detail 保持旧内联方式;原捕获不变,回退不产生新授权或 spend。

行为变化已经在协议和 PR 中明确:这是普通 CLI 序列化,同样作用于差分关闭与开启路径。alias 本身不是新的 opt-in 功能;现有上下文差分仍默认关闭,安装、命令存在、来源可读或一个 title_ref 都不能将其开启。现有实际消费者 full/delta/缺基线完整恢复覆盖开启侧,16组普通 CLI 对照覆盖关闭侧。本次验证没有调用付费模型,不把字节下降换算成缓存价格、tokens、IO/时延或长期研究收益。

标题原本就可能被旧 deduplicator 省略,现有 JSON/Markdown 消费者不依赖其必需性;现在增加可解析的同包来源。没有新增持久状态、协议版本分支、配置副本或权限 owner。较大渲染器迁移可以继续按原边界推进,不是这次小修复的前置条件。

我的整体评价

当前目标范围成立,goal_achieved / APPROVE。它消掉了真实可重现的重复传输,同时保留原任务、来源和行动/结算含义;没有把“更短”当作认知改善。repository experience 提醒检查实际用户结果,这里具体落实为完整 CLI 消费、来源反例、后续可读和零新增人工轮次,没有继承历史案例的批准结论。

同包精确引用复用现有 Python CLI 序列化层;完整来源核验继续由既有 TypeScript owner 负责,无新增决策或持久状态。 当前范围限于默认 CLI 包的一个重复标题及其显式明细回退;更大的渲染器迁移不属于此修复。

已检查 quota CLI、Turn/Host 上下文和 Markdown 调用;没有页面、控件或布局改动,视觉截图不适用。 没有新增视觉范围;没有重新认证安装态 App 或模型理解。

四个 baseline 等价的相邻失败仍保留为独立风险。真实模型理解、安装态采用和完整任务成本没有资格化;代码批准、CQR、GitHub 的旧 review/thread closeout、即时 merge-readiness 与维护者 merge 权限仍分别判断。

English verdict: APPROVE — 22c3f1069c7f3081beeff479ff16404e0b972288. Sixteen real File/SQLite public-CLI comparisons reconstruct the complete baseline packet from the exact same-response alias; focused/context coverage, native premerge, strict configured mypy and TypeScript typecheck pass. Four adjacent completion-callback failures reproduce with identical full diagnostics at immutable base, current target and head and remain failed. No model-cost, installed-adoption or merge authority is claimed.

@huangruiteng
huangruiteng merged commit 56024f6 into main Oct 25, 2026
26 of 40 checks passed
@huangruiteng
huangruiteng deleted the codex/context-cold-read-162043 branch October 25, 2026 17:38
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