Skip to content

Reduce repeated outcome provenance in context deltas - #7606

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

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

Conversation

@loopx-agent

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

Copy link
Copy Markdown
Collaborator

The shared exact-context codec repeats unchanged cumulative source references in complete work-context, quota and Turn deliveries. Reuse those registered strings through the existing exact-baseline codec, and avoid forcing whole source records inline when removing reusable fields leaves an empty container.

After #7600, the matched App native required-view sample has zero additional byte reduction from this PR. The observed benefit is in complete Host/work-context/quota/Turn deliveries; the 14,000-byte reduction must not be counted as an App or benchmark gain.

One TypeScript owner serves all existing surfaces. Unknown fields, non-string references, originally empty unknown objects, current judgments/revisions and authority controls remain literal. Default-off behavior, original captured requirements, hashes, scope and same-capture recovery stay unchanged. No new protocol, cache, configuration or decision owner is added.

Validation at 350ba6a23b9a323da88b860bc9f19879c31a9285, rebased onto main 55c88e626f0b191d42387a9d4ebb81a30498af0d after #7600/#7601:

  • The original single patch is strictly equal after rebase; the DCO sign-off is preserved. The proposal remains four files, +60/-12.
  • 76 TypeScript tests pass, including the shared codec, progressive presentation and Turn contract; control-plane type checking passes.
  • 285 Python tests pass, 51 existing opt-in native Codex cases skip. Real CLI/Host coverage includes File/SQLite × complete quota/Turn, disabled behavior, missing or invalid retention and same-capture recovery.
  • The same frozen real-CLI oracle fails all four combinations on the new immutable base because source references repeat; all four pass on this head. No base product code or assertions were changed to obtain a pass. Unknown/empty-container, reorder/removal and exact restoration checks remain in the focused suites.
  • A fresh isolated wheel passes all four installed File/SQLite × quota/Turn cases. Its 1,801 shipped product members match the installed wheel; Python/TypeScript match this source, and loaded product modules stay in the isolated installation. The existing synthetic Host fixture models retention; it does not prove native model retention or active installation.
  • Standard premerge passes all 6 direct checks and 14 selected checks, with 0 manual holds. Ruff, diff hygiene, the public/private scan and the bilingual diff check pass. No CI query, poll or wait was performed.

The same two frozen inputs were compared through the production codec at this base/head. The native row additionally uses #7600's production required-view projection before serialization. Values below are UTF-8 serializer bytes; the final column counts the complete cold-plus-warm sequence. No additional detail reads are required by this codec comparison.

Input surface Cold, both Warm, base Warm, head Cold + warm reduction
App native required view 229,571 120,716 120,716 0
Complete work context 284,726 85,434 71,434 14,000
Complete quota packet 382,692 134,160 120,160 14,000
Complete Turn envelope 322,711 120,639 106,639 14,000

Every reconstructed context equals its original; lost baseline or epoch mismatch recovers the same current full input. These byte observations do not establish token, latency, billing, retention or long-horizon outcome gains. The native sample's remaining warm input is unchanged by this patch.

Historical qualification at 4a05ef1323693851ff0317242c6754eb9688a323 is retained: 109 TypeScript and 250 Python passes / 68 optional skips, four installed cases and the original 14,000-byte complete-input comparison. Those results are not substituted for this new-base qualification. The rejected naive reference-only attempt increased quota warm output by 27,824 bytes by forcing whole source records inline; the empty-container handling and its negative checks retain that lesson.

Installed-host adoption, full C1 writer/caller unification, reader retirement and the single-session outcome/complete-cost comparison remain open. This public slice does not call for an active runtime or experiment upgrade.

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
@loopx-agent
loopx-agent force-pushed the codex/context-provenance-reuse branch from 4a05ef1 to 350ba6a Compare October 28, 2026 19:46

@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)

APPROVE — 精确 head 350ba6a23b9a323da88b860bc9f19879c31a9285 未发现阻塞问题。此次批准限定完整 Host 上下文差分的有界修复;原生 App 样本没有额外缩减,不能把该切片当作模型或费用收益。

Reviewer: model_agent; model=gpt-6.1-sol; provider=OpenAI; reasoning_effort=max; declaration_source=runtime_reported.

动机

使用已有完整工作上下文、quota 或 TurnEnvelope 交付入口,并保留了经 Host 确认的同会话基线的调用方。

累计成果的来源说明已经可以精确复用,但相同来源引用仍在每次完整上下文差分中重复;本提案让既有 codec 同样复用这些已注册字符串,减少重复传输。

独立 File/SQLite × quota/Turn 四条真实 CLI 路径在主干均因来源引用重复而失败,本 head 全部通过,原文仍可精确还原。

本 PR 不减少完整要求、不证明模型保留或费用收益,也不交付完整 C1/C2、活跃安装升级或科学实验结果。

当前 App 原生 required view 已把已识别来源移至原始 capture;本切片在该样本没有额外缩减,模型采用和完整成本净益仍未资格化。

这条路径已由既有调用方使用,不需要用户重新配置、输入已知来源或确认同一操作。判断价值时同时保留反例:主干 #7600 已先行移走原生必要视图中的已识别历史来源,所以不能用完整 Host 的结果解释 App 当前输入。本次仍有可交付增量,是因为完整工作上下文、quota 和 Turn 的既有调用入口仍会传这些来源。

改动思路

沿用一个 TypeScript exact-baseline codec,只扩展既有 Goal provenance 字符串的复用;empty-container 判断保留原来未知空对象为当前输入,没有新增协议、缓存、设置或第二决策 owner。

本 PR 交付完整 Host/work-context/quota/Turn 的既有差分路径修复;当前 App 原生投影的额外收益和长程净益保持未证。

最强的不发理由是默认原生投影没有额外收益,而 transport bytes 也不能证明可持续工作变好。放任完整 Host 的已复现重复没有必要;只依赖原生投影又覆盖不到这些完整入口。这里采用的既有 owner 小修已足够,不应再增加一套缓存、版本协议或新用户设置。empty-container 处理是同一不变量的一部分:删除已注册的可复用字段后得到空容器,不能因此把整个旧来源再塞回来;原来就是空的未知对象仍须原样出现。

具体改动

完整四文件 +60/-12 已审阅,含共享 TS codec、公开 guide 和两侧回归。旧 4a05ef1 到本 head 的单 patch 严格相等;当前 base 已前进到 55c88e626f0b191d42387a9d4ebb81a30498af0d,因此重跑了依赖当前共享 owner 的验证,没有继承旧结论。

  • splitContext:仅在完整成功读取的已注册 Goal outcome 中,把字符串 sources[].ref 与原有 summary 一起交给 exact reuse。结构化 ref、未知字段、当前 status/conclusion/basis/revision 保留 literal。
  • freshPaths:同时看当前 split 和原对象,区分被移除的注册 provenance 与原本为空的未知对象;由同一 traversal 服务三种 surface。
  • restoreContextDelivery:继续校验完整目标摘要,错误或丢失 baseline 恢复同一个当前 full capture;这里没有第二次准入或结算。

规范依据:docs/reference/required-work-context.md,修改前不可变 revision 55c88e626f0b191d42387a9d4ebb81a30498af0d,criterion_id Opt-in native reuse。Disposition:implemented。依据是同一个 TS codec、完整当前控制与未知字段 literal、成功完整来源才可复用,以及失效时完整恢复;本 PR 新写的说明没有替代这些原有义务。完整 C1/C2、安装采用和模型净益没有借此改成已交付。

对主干的风险

共享 empty-container traversal 是主要风险:若把一个原本为空的未知控制误当作 provenance 移除,会无声漏发当前事实。当前 81 项 TS 包含这些反向情况、顺序/删除、非字符串 ref、current controls 和恢复;136 项 Python 覆盖真实 File/SQLite CLI、Host retention 及原生恢复。不可变新主干上的同一冻结 CLI oracle 四项均仅在重复 ref 断言失败,当前四项通过,源文与原回执保持。

独立冻结公共输入经过生产 projector/codec 后得到如下 UTF-8 serializer bytes;只是同一次冷暖序列的传输观察,所有项均还原成原输入,丢基线均恢复当前 full:

输入 冷包,两版相同 暖包 base 暖包 head
App native required view 36,967 9,063 9,063
完整 work context 105,677 15,653 5,835
完整 quota 211,060 15,960 6,142

因此该样本每条完整路径的冷暖总量少 9,818 bytes,原生样本是 0;没有追加 detail read,不能外推 token、真实保留、时延或账单。最初私有探针缺少 capture 目录、随后复用了不可变目录的两次 setup 失败均保留;改用两处等长全新目录后,同一公共 payload/oracle 在两版执行,没有改产品或断言来掩盖失败。

当前 head:81 TS、136 Python,typecheck、5 direct/14 selected premerge 通过;96 个默认 CLI matched observations 零 drift。 标准 premerge 为 0 failure、0 manual hold,DCO 存在。默认 off 的 schema、提示、准入及副作用通过相同输入对照检查;没有查询、轮询或等待 CI。新 base 的原生 progressive projection 和显式 capture recovery 仍由各自原 owner 承担。

我的整体评价

APPROVE。沿用一个 TypeScript exact-baseline codec,只扩展既有 Goal provenance 字符串的复用;empty-container 判断保留原来未知空对象为当前输入,没有新增协议、缓存、设置或第二决策 owner。 本 PR 交付完整 Host/work-context/quota/Turn 的既有差分路径修复;当前 App 原生投影的额外收益和长程净益保持未证。 这是一个当前调用方可用、可回滚的增量;当前未发现需要再建抽象或扩大范围的理由。真正的完整成本与模型采用还需要既有所有者后续资格化,不由此 review 授权。

视觉检查不适用:检查了完整 CLI、Host transport 与原生 context projection,本 PR 没有改动渲染页面。 真实模型保留、活跃安装采用、token/时延/费用和完整长程净收益未验证。 本次自有源码结果与作者 wheel/安装记录区分,未执行活跃安装、付费模型或 benchmark。公开 review、closeout 与 merge readiness 仍是不同关口;本结论不授予 merge 权限。

English verdict: APPROVE 350ba6a23b9a323da88b860bc9f19879c31a9285 for the bounded complete-context codec fix; exact recovery and default-off behavior are verified. The native required-view sample has zero incremental benefit; model retention and complete-cost gains remain unqualified.

@loopx-agent

Copy link
Copy Markdown
Collaborator Author

Exact-head merge validation for 350ba6a23b9a323da88b860bc9f19879c31a9285:

The designated independent review approves this unchanged head; native approval closeout is clear. Main remains the tested 55c88e626f0b191d42387a9d4ebb81a30498af0d.

The shared TS codec and two real complete-input callers are covered by 76 author-side TS tests, 285 Python passes / 51 native opt-in skips, the four frozen base failures versus four head passes, and four fresh isolated installed-wheel cases. Standard premerge passes 6 direct and 14 selected checks with no manual holds; type checking, DCO, bilingual/diff checks and public-boundary scans pass. The official 96/96 default-off observations show no declared structural/semantic/size drift. Independent review separately verifies 81 TS and 136 Python cases, its own public-input comparison and default-off checks.

The complete Host paths have an evidenced transport improvement. The current App native required-view samples have zero incremental reduction, independently reproduced by the reviewer; no model, token, billing, retention, active-installation or complete C1/C2 benefit is inferred. No CI query, poll or wait was performed. The existing integrity, current-control/unknown-field, same-capture recovery and authority owners remain in force.

@loopx-agent
loopx-agent merged commit 0d4bf99 into main Oct 28, 2026
18 of 37 checks passed
@loopx-agent
loopx-agent deleted the codex/context-provenance-reuse branch October 28, 2026 20:20
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