Skip to content

fix(context): reuse retained candidate authoring in quota deltas - #7607

Merged
loopx-agent merged 1 commit into
mainfrom
codex/reuse-candidate-context
Oct 28, 2026
Merged

loopx-agent merged 1 commit into
mainfrom
codex/reuse-candidate-context

Conversation

@loopx-agent

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

Copy link
Copy Markdown
Collaborator

Quota deltas currently resend the complete capability candidate records, including unchanged task bodies, even after the caller retained the full input. Reuse only registered Todo text, title and note strings through the existing exact codec. Every candidate remains in the cold input; membership/order, identity, revision, claim, capability eligibility, handoff and unknown fields remain current literals. Unknown schemas, duplicate identities and structured text values stay literal. Loss of continuity still recovers the same full capture.

This is a bounded warm-input improvement, not the proposed decision-stage candidate projection. It changes neither selection/read obligations nor admission, settlement, authority, default-off output, scoring or experiment configuration. The existing TypeScript presentation owner and native opt-in journey remain the only implementation/configuration; no new protocol or Python decision owner is introduced.

Validation:

  • Exact head 58c98a7f233a01e1ea7bd8d80ba0a73c2f8ce97f is based on 0d4bf99 (including Reduce repeated outcome provenance in context deltas #7606). Type checking, 31 shared codec tests, 79 real CLI/native cases and standard premerge (5 direct + 14 selected, no holds) pass at this rebased head. No source semantic conflict occurred.
  • The new regression fails on unchanged 55c88e6 because the whole candidate gate forces full delivery. The original proposal also passed 33 shared codec/progressive tests and control-plane type checking.
  • 290 Python cases pass across the CLI, native recovery/lifecycle and Host transport suites, including File/SQLite × App/generic CLI and original-source/receipt preservation. Four initial test failures were an incorrect fixture assertion: the producer carries the complete objective in title and its existing excerpt in text. The corrected four cases pass; no product behavior or fixture budget was changed to satisfy them.
  • Changed late constraints, ownership, missing/unknown controls, lane movement, reorder/removal, empty lanes, lost retention and compaction are covered. The native progressive test reaches a warm delivery and restores complete candidate content after compaction.
  • The original pre-rebase proposal's fresh wheel passes the installed native saved-capture cold/warm/compaction path with 4,000-byte complete output pages, exact restoration and no guard or spend. The initial wheel build was correctly rejected for stale Chat assets; rebuilding the existing bundle resolved it. Active installations remain unchanged.
  • Ruff, whitespace, semantic-vocabulary advisory and bilingual diff checks pass. Standard premerge passes all 6 direct checks and 14 selected checks, with no manual holds. No CI query, poll or wait is requested.

In a frozen native required-view replay, the same unbound → bound sequence changes warm serializer bytes from 128,146 to 119,790; cold stays 233,630, so cold + warm decreases 2.31%. An unchanged bound replay changes 98,180 to 89,824 warm bytes, with unchanged 235,739 cold bytes. Both reconstruct the exact current input, and loss of the baseline restores that same full capture. These are offline serializer measurements, not model tokens, billing, latency, installed adoption or accepted task outcomes. The large cold input and remaining current-control input still need decision-stage/progressive work; this patch does not qualify the overall efficiency goal.

Scope-fit: extend the existing codec's registered authoring boundary and reuse existing real CLI/native tests. Defer candidate scoping to the existing C1/C2 contract rather than deleting alternatives or introducing another selector. Public changes contain synthetic fixtures and generalized metrics only; raw operating captures stay private. No active runtime upgrade is part of this proposal.

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
@loopx-agent
loopx-agent force-pushed the codex/reuse-candidate-context branch from a145dd9 to 58c98a7 Compare October 28, 2026 20:28

@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; reasoning_effort=max; declaration_source=runtime_reported.

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

APPROVE — 58c98a7f233a01e1ea7bd8d80ba0a73c2f8ce97f 未发现阻塞问题。结论限定已有 exact codec 的暖包增量,验证不授予 merge 或安装权限。

动机

已经完整保留同一会话上下文、继续从 quota 候选中选择任务的 Agent。

旧暖包仍把全部 capability candidate 正文再发一次,即使此前的完整输入已包含这些正文;长任务因此在每次传输中重复。

只有已登记 Todo 的 text/title/note 字符串可精确复用,候选成员、顺序及全部当前控制仍逐轮携带;冷包和丢基线恢复继续完整。

本次不证明模型费用或长程收益,也不交付整体 C1/C2、活跃安装升级或科学实验。

冷包仍然较大,真实模型保留、完整费用与持续成果收益尚未资格化;未来按决策阶段读取候选的契约仍未实现。

改动思路

沿用同一个 TypeScript exact-baseline codec,只扩展注册 authoring 字符串的复用边界;没有新缓存、协议、配置或 Python 决策 owner。

本 PR 交付可用基线下的暖包增量,保留全部原有候选与必读义务;C1/C2、活跃安装采用及模型收益由既有工作继续资格化。

最强的不发理由是冷输入仍然大,纯 serializer 结果也不能证明模型实际保留了基线。独立真实 CLI 已证实完整候选正文重复;移除候选或只给索引会改变当前必读合同,另建缓存又会重复现有 owner。这里保持冷启动与当前控制完整,只减少已经精确保留的三个字符串,是可独立验证和回滚的增量。现有 scope、epoch、continuity 与 full recovery 继续承担边界,没有把包存在、安装成功或能解析视为保留或授权证明。

具体改动

完整五文件 +118/-1 已审阅。规范依据为修改前 docs/reference/required-work-context.md,spec_revision 0d4bf99a4aa6080f2774f3c4477fb4adc1b5ac46;criterion_id Opt-in native reuse。Disposition 为 implemented:注册要求精确复用,当前与未知控制保留 literal,不确定时恢复同一完整 capture;当前完整候选义务没有被未来 decision-stage 方案替代。新增中英文说明没有回写或放宽这个原合同。

关键代码讲解

  • freshPaths.candidates:先要求已知 gate、两条数组 lane 和跨 lane 唯一的非空身份。合法 Todo 行只让 text/title/note 字符串走现有 exact reuse;schema、身份、claim、revision、eligibility、handoff 与未知控制全部 forced literal。未知行或结构化文字值保持整行,重复身份或不完整 gate 保持整组当前值。
  • prepareContextDelivery:复用前仍验证完整基线摘要、Goal/Agent/session/epoch 与 retention,比较实际编码大小并检查完整重建。没有新增模糊匹配、版本分支或第二个缓存。
  • restoreContextDelivery:仍按当前 capture 重算预期 edits,遗漏当前控制或损坏引用不能通过;恢复得到同一当前 full,不能触发另一次 guard 或 spend。

对主干的风险

主要反例是把“可复用正文”错误扩大为“可复用旧 claim 或 unknown stop”。独立十组生产 codec 输入覆盖晚到约束、claim/unknown stop、跨 lane 移动与重排、新候选、空 lane、重复身份、结构化 title、未知 gate/row、缺 lane、错 Agent/epoch 和丢基线;当前控制逐项 literal,恢复均与当前输入等值,输入未修改。冷启动继续包含全部候选。

同一冻结真实 CLI 用例在不可变 base 的 File/SQLite × App/generic 四项均因暖包重复完整 title 失败,本 head 四项通过。300 项 Python、33 项 TS、typecheck、5 direct/14 selected premerge 全过,无当前失败、跳过或 manual hold。native 冷暖、compaction、same-capture 恢复、Host transport、原 source/packet 与零 spend 均覆盖;初次验证命令引用不存在的测试文件、没有执行测试,已改为真实文件全跑,原调用错误保留。

以下是独立公共合成 fixture,全部还原相同当前内容,不是作者 2.31% 工作样本,也不表示真实 token 或费用:

同一序列输出 bytes base head
冷包 71,221 71,221
未变化的暖请求 71,218(完整 fallback) 4,354
暖请求带晚到约束与当前控制变化 71,249 7,755
跨 lane 重复身份 71,218 71,218

语义与 CI 对齐

96 组默认 CLI matched observations 零 drift、无预算失败。默认 off 不进入 codec;现有启用、缺 retention、缺 native proof、错误 scope 与失效 epoch 的配对路径通过,未改变自动加载的 hook 指令或 producer 默认字段。正文的要求、权限、证据、顺序与停止义务不缩短,只在完整可用基线内精确继承。未查询、轮询或等待 CI。

初次 wheel 正确拒绝陈旧 Chat bundle;依既有 asset build 重建后,新 wheel 的 codec 源码与本 head 逐字相同。隔离安装四条 File/SQLite × App/generic CLI 路径通过,parent/subprocess import 均核对 site-packages。隔离 harness 先后缺 tests namespace、遗漏只读子调用 cwd 的错误均保留,只修 fixture 导入与独立运行目录,未改产品或断言;没有升级活跃运行时。

我的整体评价

APPROVE,属于 justified_increment。完整候选、当前 controls、原捕获与后续恢复保持,既有用户请求没有额外设置或确认轮次。复用现有 typed contract 和同一个 codec 与问题规模相称;未发现当前需要另一抽象的理由。大冷包、模型保留与完整成本仍是既有工作的真实剩余边界。

视觉检查不适用:审阅了实际 CLI JSON、原生 transport 及对应调用方,本 PR 没有改动渲染页面。真实模型理解/保留、token、时延、费用、活跃安装采用及完整长程净益未验证。

English verdict: APPROVE 58c98a7f233a01e1ea7bd8d80ba0a73c2f8ce97f for exact retained candidate authoring reuse; current controls, complete cold input, default-off parity and same-capture recovery are verified. Model retention and complete-cost gains remain unqualified.

@loopx-agent
loopx-agent merged commit 447c35e into main Oct 28, 2026
19 of 37 checks passed
@loopx-agent
loopx-agent deleted the codex/reuse-candidate-context branch October 28, 2026 21:12
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