Skip to content

fix(context): replay frozen selection order across pinned reader pages - #7972

Closed
huangruiteng wants to merge 1 commit into
mainfrom
codex/reader-pinned-order-20261103
Closed

huangruiteng wants to merge 1 commit into
mainfrom
codex/reader-pinned-order-20261103

Conversation

@huangruiteng

Copy link
Copy Markdown
Collaborator

关联 #7932、#7965。#7932 固定已解析地址后,#7965 的首读可以按 typed owner 优先顺序生成正文;续页却通过普通显式 selector 再次按字母序排序,因而报 selected view digest changed。

修复已有 reader IO:typed selector 继续校验同一组地址,私有引用按已经冻结的序列化顺序重放,再验证完整选读摘要。没有新增配置、协议字段或第二个选择策略 owner;新发起的显式选读保持规范排序,原捕获与完整摘要不变,历史配方引用仍拒绝混读并沿同一捕获恢复。现有英文/中文读取契约同步补充该边界。

验证基线 d1bd9735468d549d55e2965b1b4d9030c50e1854,当前提交 357893f8739fe223b97285a3bf427f9bdbf15af4:

  • 8 个 reader 模块:280 项通过;包含真实 CLI、8 KiB/64 KiB 多页续读、显式读取规范顺序、完整原捕获不变、坏摘要拒绝和无 registry/runtime 写入。
  • 同时包含 Pin initial context readers to resolved selections #7932 b9aab0e、fix(context): preserve initial priority and pinned replay order #7965 669dd75 及当前主线的受控组合:只撤回本修复的 7 行产品代码时,两种分页的原生私有引用均复现摘要错误;恢复后组合读取回归 76 项通过。原有 machine-view 分页测试单独通过不能覆盖这条私有引用续页路径,现已新增对应回归。
  • 相关 TypeScript selector/progressive 19 项通过;Ruff、仓库配置的 mypy(17 文件)、diff-scoped semantic advisory、全树 semantic smoke、双语检查及公开边界检查通过。
  • quick premerge gate passed:6 项直接检查、4 项选中检查,0 blocking failure / 0 manual hold。保留一个既有 advisory:未修改的 render_canonical_todo_sections 维护预算检查原始 return code 1;没有放宽预算或改写失败。额外直接扫描 legacy reader 文件时,原基线与补丁的导入范围错误均为 5,578,规范化错误差量为 0;不声称全库 mypy 通过。

该资格覆盖读取兼容性和错误恢复。模型遵从、token 完整成本及科研效果由后续运行验证。独立 review 和 main 合并仍分别遵循现有 gate。

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

mergify Bot commented Nov 3, 2026

Copy link
Copy Markdown

This pull request has merge conflicts with main and cannot be merged
until they are resolved. Please rebase or merge the base branch, @huangruiteng.

Choose the remote for the base repository, not an out-of-date fork.
For a fork clone, first inspect git remote -v; upstream must point
to https://github.com/loopx-project/loopx.git. If it is absent, add it
with git remote add upstream https://github.com/loopx-project/loopx.git.
Then run:

git fetch upstream
git rebase upstream/main
# Resolve each conflict, git add the resolved files, then git rebase --continue.
git push --force-with-lease origin HEAD

For a same-repository clone whose origin points to
https://github.com/loopx-project/loopx.git, use origin instead of
upstream for fetch/rebase. If you prefer merging the base, use
git merge <base-remote>/main and push normally.

Keep the DCO Signed-off-by trailer on every commit when you rebase.
https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify Bot added the needs-rebase Mergify: the pull request has merge conflicts with its base branch label Nov 3, 2026

Copy link
Copy Markdown
Collaborator Author

候选收敛更新:#7932 已合入 main,#7965 更新到 a1e9144592a8de79dcdf1f8672b2393a78e31399 后,通过 typed preserve_selection_order 修复了相同消费者路径,并保留旧显式引用的有界兼容重试。后续应选择一套实现,不把本 PR 的 Python 重排再叠加进去。

我在隔离工作树组合最新 main 1b37e2e6e0ea77b9bd405cf9a5ef5fcd8557e92e 与该 #7965 head,保留双方已有测试,并移入本 PR 四个实际 CLI 分页回归:两个 reader 模块 79 passed。同一输入仅将三份产品文件回退到上述 main 时,8 KiB / 64 KiB 的固定非规范顺序引用两例均复现 selected view digest changed;两个普通首读控制通过。候选产品源码已逐字恢复。组合冲突限于读取文档和同一测试文件,已在本地保留双方语义解决。

这些是组件组合证据,未替代 #7965 当前 head 的完整独立 review、合并就绪检查或实际模型收益验收。本 PR 暂保留为反例与回归来源;#7965 收敛后可关闭本重复候选。

@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 | model=gpt-6.1-sol | provider=OpenAI | runtime_reported | reasoning_effort=max

REQUEST_CHANGES,精确 head 357893f8739fe223b97285a3bf427f9bdbf15af4;一项 P2:新排序破坏了仍有效的旧式固定引用。

动机 / Motivation

原始上下文已经冻结后,后续选页应重放原正文,让 Agent 继续原回合。An agent continuing the original immutable selected context capture with a private reader reference. 本次确实修复了 recorded-order 视图;但旧式引用仍是本次必须支持的消费者。失败会中断继续读取,不能靠重新 admission、重建捕获或把完整读取当已保留来恢复。

需要沿原始私有引用继续读取上下文的 Agent。同一旧式 canonical-body 引用在基线连续48/6页成功,当前头第一页即拒绝;新 recorded-order 布局则由失败变为成功。记录顺序得到修复,旧式规范正文仍出现兼容回归。本次不改变 admission、结算、所有权、预算或安装运行时,也不认证模型保留和长程收益。补齐旧式 canonical-body 引用的只读兼容,保留两个完整 SHA 校验。

改动思路 / Approach

quota context-read → physical reference and full capture SHA checks → existing TS context_select address validation → Python original-value serialization → selected digest check → bounded UTF-8 pages. TypeScript 继续负责 RFC6901 地址与整批错误顺序,Python 负责原始数值字节及引用的序列化;这个七行 IO 修复位置是局部的。最小修复是保留两种已经存在的摘要绑定布局:记录顺序不能匹配时,仅尝试原 canonical planner 顺序,并且仍必须精确匹配完整 selected SHA。无需新 schema 或重写历史引用。

同一消费者已有 #7965 当前 a1e9144592a8de79dcdf1f8672b2393a78e31399 的 typed order / bounded canonical fallback,已读其实际差异;应由原负责人协调这两个重叠修复,避免两套排序决定一起落地。没有把对方作者的验证数量当成本次独立证明。

补齐旧式 canonical-body 引用的只读兼容,保留两个完整 SHA 校验。当前边界是让两种既有持久化正文均可恢复;科学效果与 Host 采用仍由原负责人验收。

具体改动 / Changes

完整 PR 为4文件 +124/-0,其中产品7行、文档10行、测试107行。规范 docs/reference/required-work-context.md,spec_revision=d1bd9735468d549d55e2965b1b4d9030c50e1854,在实现前读取;还对比了最新 main 的 #7932 固定引用条款。

  • Legacy captures retain their original read contract:not_met。 旧式合法 descriptor 的 select 列表可以保留调用顺序,而摘要覆盖原先规范排序后的正文;当前代码无条件把它改成记录顺序。

  • The original SHA-bound full recovery remains available:implemented。 完整源与 selected digest 仍分别校验,选择页没有被当作完整保留回执。

  • Explicit selectors and index entries keep their original addresses:implemented。 新鲜显式请求保持规范顺序,地址验证继续由现有 TypeScript owner 执行。

  • read_context_capture:Reads immutable descriptor/capture, invokes typed selection, checks selected SHA. 输入/分支:Pinned explicit versus initial/fresh raw read.;调用方:CLI quota context-read;输出交给 _capture_page bounded response。

  • pinned-selection order replay:New mapping deduplicates stored selectors and sorts TS output; breaks legacy canonical-body digest. 输入/分支:Noncanonical caller-order metadata with a canonical stored digest.;调用方:read_context_capture pinned_selection;输出交给 Same SHA verifier now rejects a previously accepted view。

  • capturedContextSelection:Unchanged owner validates canonical exact-address batch and rejects missing/invalid pointers. 输入/分支:Explicit/initial/index with duplicates and Unicode.;调用方:_turn_envelope_result context_select;输出交给 Verified paths, not JS-number-coerced values。

  • write_context_read_reference:Existing v1 codec stores select and full SHA without requiring selector-list order to equal rendered order. 输入/分支:Physical private descriptor, existing collision/readback checks.;调用方:model_context_reference and selected reader;输出交给 Independent immutable full-capture and selected-view identities。

对主干的风险 / Risks

P2 — quota_capture.py:276–282:保留旧式固定引用的规范正文顺序。 我用同一实际 CLI、相同352194字节选中正文和私有 v1 descriptor 做 base/head 对照:select=["/z","/a","/z"],initial_read=false,两个完整 SHA 均正确,旧摘要覆盖 [/a,/z]。基线在8192字节预算下连续48页、64000预算下6页完整成功;当前头第一页即退出1,报 selected view digest changed 且无 content。反方向的 recorded-order [/z,/a] 则由基线拒绝、当前头成功。两个方向均检查 Unicode、9007199254740993、引用/源文件未改、无 registry/runtime 创建。七行改动修好了后一种,却不能让前一种合法历史正文失效。

修复时补充两种布局的真实 CLI 回归;兼容重试只读、至多一次、以保存的完整 SHA 精确收敛,不得忽略摘要或重新生成历史记录。

独立基线8模块187项、当前191项通过;它们仍没有捕获上述兼容反例。标准 premerge 6项direct、19项selected,0blocking failure;一项 maintainability ratchet advisory 保留。不可变基线和两个当前头用相同命令都退出1,报告同一个未改动的 render_canonical_todo_sections,magnitude_regressions=0,不将其记为通过,也不要求此 PR 修无关债务。

未查询、轮询或等待 CI;CI 未知不构成阻塞。远端冲突提示属于另一个合并准备度问题,不是这个代码发现的依据。作者旧组合验证并非当前 #7965 的联合集成资格;没有接触冻结研究、实际模型或安装运行时。

我的整体评价 / Verdict

long_horizon:regression,合法旧引用的继续读取路径受损;user_experience:regression,实际 CLI 新增错误退出。最小修复是补齐当前 owner 的 digest-bound canonical compatibility,并协调已有消费者修复。代码量小且目标合理,但191项通过不覆盖这个历史消费者,当前不能 APPROVE。更大的迁移或科学验收不属于此局部修复前置条件。

English verdict: REQUEST_CHANGES — preserve legacy canonical-body reference replay while retaining the new recorded-order path.

@loopx-agent

Copy link
Copy Markdown
Collaborator

已由合入 main 的 #7965 收敛,关闭本重复候选,避免再叠加 Python 排序实现。

已在合入后的 main a5d52465ec394ed7ea66dbca1909d37a8857fa7a 独立运行两个 reader 模块与完整 test_context_delivery_cli.py,163 passed。覆盖 recorded-order 与 legacy canonical-body 引用、完整摘要校验、失败批次、首读与 File/SQLite 真实 CLI 路径。

原 head 357893f8739fe223b97285a3bf427f9bdbf15af4 的 P2 兼容性 finding 保留:该候选没有被修订为通过,后续采用 #7965 的 typed 顺序与有界 canonical fallback。关闭重复提案不等于撤销历史发现,也不证明安装或模型收益;这些仍按原后续验收进行。

@loopx-agent loopx-agent closed this Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-rebase Mergify: the pull request has merge conflicts with its base branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants