Skip to content

fix(context): defer supporting pointer inventory from initial reads - #8007

Merged
huangruiteng merged 1 commit into
mainfrom
codex/context-index-navigation-20261103
Nov 4, 2026
Merged

huangruiteng merged 1 commit into
mainfrom
codex/context-index-navigation-20261103

Conversation

@huangruiteng

Copy link
Copy Markdown
Collaborator

Goal And Delivered Outcome

Large supporting-address inventories can consume most of quota context-read --initial-read before they help the caller choose any evidence. Keep the current source identity, unconfirmed coverage, read-before-dependent-work obligation and original instructions in that view, and leave the complete pointer list reachable through the same immutable capture.

The native reader regression uses 900 synthetic supporting addresses: the baseline cannot finish the required initial view in the expected page; this change can, while preserving Goal, Task, acceptance, stop and original settlement values and recovering every address explicitly. Intended base: main.

Author Declaration

  • Written by: model_agent — OpenAI GPT / Codex.
  • Implemented against: docs/reference/protocols/quota-cli-hot-path-compaction-v0.md and the existing source-bound progressive reader in loopx/control_plane/quota/progressive_context.ts, baseline 477df45d9036414a4a7f5a558ef2ef1e38e08c75.
Criterion Disposition Implementation / evidence
Complete capture precedes a selected CLI view implemented Capture and explicit selectors are unchanged; the native test verifies capture bytes after both reads.
Obligations and source recovery remain usable implemented Source, coverage, dependent-work flag and complete original instructions remain selected; dropping the dependent-work flag makes the new native test fail.
Unknown semantics remain whole implemented Older, malformed, missing-instruction and extended index layouts keep the full index; TypeScript negative cases verify fallback and no input mutation.
Total-cost claims include deferred reads implemented Paired native-reader measurement below includes complete deferred inventory, stdout and calls.

Self-check: read the four-file diff, ran the affected reader modules, TypeScript tests/typecheck, negative/parity checks and standard premerge. No model session, paid execution or live state mutation was used for validation.

Scope And Continuation

This is one reversible change in the existing TypeScript initial-selection owner, with its native consumer regression and bilingual protocol note. It introduces no capability, settings, schema vocabulary or decision authority. Unknown layouts remain conservative. The complete list is read with the original reader reference and --select /context_details/unread_context_index/pointers.

This proposal qualifies the reader behavior and byte/call tradeoff. Deployment, natural reader adoption, token billing, latency and long-horizon outcome effects are not established by these checks.

Validation

  • Tested revision: dafd69599028cd8f77b459da7d361cb5299edcac.
  • Run state: finished.
  • Input classes: synthetic, authorized_private_read_only. Only aggregate measurements are disclosed; no source bodies or machine context are published.
Check kind Result Evidence / limitation
real_entrypoint / regression_parity passed Actual native quota context-read: same capture, original Goal/Task/stop/settlement values, full cold inventory recovery, capture unchanged. Baseline regression fails; restored head passes.
regression_parity passed Mutation deleting the dependent-work flag fails the independent consumer assertion. A changed copy of the captured source is rejected with typed digest-mismatch recovery and no admission/spend.
integration passed Eight affected Python modules: 211 passed, 80 skipped. Skips require the explicitly configured native checkpoint binary; no model-session qualification is claimed.
unit / static passed Targeted TypeScript run: 37 passed; separate complete context_delivery.test.ts: 34 passed; typecheck and Ruff passed. An initial selector named a nonexistent module and was skipped; the actual module was then run explicitly.
static / integration passed Standard loopx canary premerge --from-git-diff --git-diff-base origin/main: 5 direct and 14 selected checks passed, including source/public boundary, semantic vocabulary and existing ratchets.
manual passed Four-file public-boundary scan, whitespace, DCO and bilingual diff check. First fixture setup omitted its capture directory; after fixing the fixture, the actual baseline regression still failed.

A paired source-bound reader sample gives the following UTF-8 sizes. The primary denominator is the same complete capture: 726,462 B; intermediate projection (391,593 B) and required-context file (305,069 B) are not substituted for it.

Measure Before After
Initial selected BODY file 155,507 B 84,730 B
Complete capture → selected BODY reduction 78.5939% 88.3366%
Reader calls at the same 64 KB output setting 3 2
Actual CLI stdout 162,877 B 90,215 B

The paired initial BODY reduction is 45.5137%. All common leaf values are identical; only 444 navigation-address leaves move out, and two original instruction/reader fields become selected. Explicitly reading the complete deferred inventory adds 72,420 B of BODY, 74,870 B stdout and 2 calls. If every case needs that list, combined BODY becomes 157,150 B and 4 calls, slightly more than before. At an assumed 50% full-list-read frequency, expected BODY is 120,940 B and calls are 3; the BODY break-even frequency is 97.7313%.

These frequencies are assumptions, not an estimate from historically inline delivery. JSON escaping, reader metadata and argument paths differ from BODY bytes; host framing, model input/cache behavior, comprehension, invoices and total outcome cost are unmeasured. Earlier helper output used the required-context file as its “full” denominator; the complete-capture table above corrects that labeling.

Frontend / Visual Evidence

UI impact: none. This changes a captured CLI reader's starting selection within an existing workflow; no frontend, Lark, desktop or documentation chrome changes. Screenshots and viewport evidence are not applicable.

Type / Area / Boundary

Bug fix; focused behavior-preserving owner reuse; protocol and test update. Area: control-plane context delivery. Shared-authority fixture impact: not applicable; no authority-store, provider or routing changes.

  • No private source bodies, raw trajectories, identifiers, credentials, internal links or machine paths are included.
  • No paired RFC changes; bilingual check passed.
  • DCO signed commit; normal PR for independent review. Passing local validation does not grant approval, merge readiness or merge authority.

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

@loopx-agent loopx-agent 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.

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

动机 / Motivation

大量补读地址挤占首读页时,quota context-read 的调用方难以先读完当前控制事实。

同一900条地址的合成CLI对照中,原先首读100220字节、两次调用;当前首读6977字节、一次调用。 Goal、Task、停止条件和原结算身份保持,完整900条地址沿原capture显式取回,原capture字节不变。

本PR不证明模型理解、全程token节省或benchmark分数提升,也不改变权限、预算、capture频率或差分开关。 如果随后需要读完全部地址,两边总输出都约104KB、两次调用;真实模型采用及科学净收益仍待后续运行。

未发现阻塞性问题。这里认可的是可独立回滚的起始导航改进,后续真实采用与完整成本仍由既有 benchmark 运行验证。

改动思路 / Approach

复用同一TS选择器,只推迟已可恢复的地址数组;完整capture和未知格式fallback继续是同一个owner。相比裁掉原始信息或另建摘要,本实现保留原始完整事实。当前四字段结构才进入精简;新增字段、错误类型或缺少原指引时仍完整内联,因此不会猜测未来义务。

本PR交付起始导航精简和完整恢复,不交付全程token或科学收益。初读减少本身不是总费用下降:在本次完整库存都要读的相同任务中,base输出104051字节、当前103909字节,两边均两次调用;没有把base已读库存重复读取来夸大节省。无需增加人工确认、复制或重新输入已知目标。

具体改动 / Changes

规格依据为 docs/reference/protocols/quota-cli-hot-path-compaction-v0.md,spec_revision=477df45d9036414a4a7f5a558ef2ef1e38e08c75,按修改前的合同判断:

  • HPC-owner:仍由 initialContextReadPointers 选择字段,capturedDecisionSelection 调用它;没有第二个决策或存储owner。
  • HPC-controls:原Goal、Task、停止、source、coverage和read-before-work与结算身份保持。
  • HPC-restoration:显式读回全部900条地址、完整捕获不变,未知义务完整保留;首读不是已消费证明。

关键路径:progressive_context.ts:210 的 initialContextReadPointers 在330行后选择原source和义务;turn_envelope.ts:1413 的 capturedDecisionSelection 只决定导航;quota_capture.py:184 的 read_context_capture 继续负责完整hash与分页digest。没有改写判断、预算或原捕获。

独立对照使用相同合成输入,在immutable base与精确head运行真实CLI子进程和TS transport,无模型调用。初读100220→6977字节;任意显式完整读取相同,未来index增加义务时两版本都回退完整库存。另在隔离副本仅从选择清单移除read-before-work字段,真实CLI的独立义务断言失败;恢复原代码后正例通过。最初driver未沿digest-bound next_command续页、也未展开完整父分支,留下两次无效探测,修正后才计入上表。

对主干的风险 / Risks

最大反向风险是一个未来义务被误认为地址噪声。结构必须恰有四字段、布尔和数组类型符合当前owner,且原指引存在,否则整个index仍内联;原source对象整体保留。需要每条地址的场景没有显著总体byte收益,不应按首读百分比宣传全程节省。

该PR仅100增/4删,生产改动在既有选择器,没有新模块、CLI、持久字段或新共享枚举。指令的actor、触发、先后顺序、来源、范围、停止和原结算含义保持;覆盖未确认也仍明确。无字符串猜测权限或benchmark专用核心义务。

精确head的43项reader测试、4项TS测试全部通过,无跳过。组合验证在最新main加本PR及已审相关修复上:37项TS、336项Python通过,15项宿主可选测试跳过;Linux真实native source和后继接收端在Context on/off两模式通过。quick premerge行为检查无失败,另有4个未触及模块的既有维护性预算hold,保留manual_review_required,没有调大限额或记为全绿。未查询或等待远端CI;组合验证与本PR精确头的CLI对照分开记载。

我的整体评价 / Verdict

这是 justified_increment:已有首读owner获得可用改进,既有完整读取不丢失,最小边界不需要额外配置、权限或并行状态。复用同一TS选择器,只推迟已可恢复的地址数组;完整capture和未知格式fallback继续是同一个owner。本PR交付起始导航精简和完整恢复,不交付全程token或科学收益。

Only the CLI selected reader changes; no rendered frontend or Lark surface is modified. Rendered UI is unchanged; actual model comprehension is unverified. 实际模型是否按需补读、长程净效果以及已安装宿主采用仍待验证。这个残余风险不等于已获得科学收益,也不授予main合并权限。

English verdict: APPROVE dafd695; initial navigation is smaller while the original obligations, complete capture and explicit recovery remain verified. No total-token or benchmark-effectiveness claim is approved.

@huangruiteng
huangruiteng merged commit cb38b9c into main Nov 4, 2026
23 of 29 checks passed
@huangruiteng
huangruiteng deleted the codex/context-index-navigation-20261103 branch November 4, 2026 14:03
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