Skip to content

Clarify and honor saved context page continuation - #8318

Merged
loopx-agent merged 2 commits into
mainfrom
codex/context-opening-required-remainder-20261108
Nov 8, 2026
Merged

loopx-agent merged 2 commits into
mainfrom
codex/context-opening-required-remainder-20261108

Conversation

@loopx-agent

Copy link
Copy Markdown
Collaborator

Problem

A bounded saved-context opening can reach EOF while the initial read still has a required remainder. Its page instruction points only to the ordinary cursor within that selection. A caller can miss the remainder and reconstruct the pre-work read with broader manual selections. The same entry point rejects an explicit --page-bytes before reaching its window validator.

Change

  • Point the opening's existing page instruction to navigation.remaining_read_command and its cursor before work.
  • Let explicit page windows reach the existing validator for attached initial and selected reads.
  • Exercise an ordinary complete page, a staged opening and remainder, tight and explicit windows, invalid limits, and recovery of the same captured decision.

The saved-context CLI transport owns the instruction. The same captured Goal, Agent, Turn and digest bind the opening and remainder.

Validation

  • Ran the benchmark-profile CLI on the same immutable input at base and head. Both delivered the same 69 selected addresses and original receipt through the opening and remainder. The candidate opening fit within the default 12,000-byte serialized response limit.
  • Exact-head local quick premerge, public boundary, Ruff and bilingual diff checks passed.
  • Saved context and first-read suites produced 137 passing cases and 14 skips. Two warm native checkpoint tests expect delta and receive full delivery on both this head and the exact main base. All seven focused page-window cases pass, including three restored window cases.
  • Live model follow-through and whole-turn savings remain to be measured.

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

mergify Bot commented Nov 7, 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, @loopx-agent.

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 7, 2026

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

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

动机 / Motivation

从已决定的保存 capture 读取首屏与余页、或明确指定 page window 的 CLI 调用方。旧首屏可以在仍有必读余区时返回 EOF,页级 read_instruction 却只描述普通 cursor;显式 page-bytes 又被提前拒绝。新页指令明确指向 remaining_read_command,并让合法窗口进入原 validator。独立真实 CLI 三场景均恢复完整原 Goal 正文:默认 staged EOF 首屏指向余区,900与40000字节窗口到达原 reader;错误 Turn 和非法窗口仍拒绝,原 capture 字节未改。只修复已获准保存视图的分页说明与窗口传递;不重新 guard、不创建注册 authority、不放宽原页面预算或原 source/Turn 绑定。

读取协议需要帮助原任务继续工作:准确知道哪些字节已投递、当前还需读什么、失去连续性时从何恢复。这里的完成依据是实际 reader 和原来源回读,并不是文件、hash 或 review 数量。原始失败、跳过和模型采用未知均保留。

改动思路 / Approach

在既有 quota_capture transport owner 修正一处页级说明和一个提前拒绝分支,继续复用原窗口 validator 与 cursor,比增加第二个分页器或要求调用者手工重建 selection 更小。 只修复已获准保存视图的分页说明与窗口传递;不重新 guard、不创建注册 authority、不放宽原页面预算或原 source/Turn 绑定。

原 source、Goal/Agent/Turn、停止和结算控制不由展示层重写。一个已知精确正文可以被引用,未读或已变内容仍须读取;opening 的 EOF 也只结束自身 selection。复用已有 reader 的同源 reference 和 cursor,可以避免为了恢复 transport 再次准入或重复业务效果。没有另建状态 owner,也没有把模型理解等同于 native hook 的投递假设。

具体改动 / Changes

以修改前的 docs/reference/required-work-context.md 为准,spec_revision 8a4d4f9dab17b01d6fe3546936155b4d718fc20d。Saved benchmark preflight 规定同源 opening/remainder;Read the top-level content 规定跟随 cursor 并读余区,EOF 不是全文证明;An optional page-bytes 规定显式窗口受原 UTF-8/serialized response 限制。这些验收源于原规范,PR 新增文档不能反向认证自身实现。

关键代码讲解

  • _bounded_initial_page:保留完整 opening 和剩余 selection 的同源引用,将页级指令准确连到 remaining_read_command;普通 EOF 的范围不被扩大。
  • project_saved_context_capture:仅去掉提前拒绝 page_bytes 的条件;JSON、offset、合法激活、禁止 initial+select 及现有身份校验仍先执行,窗口再交给 _validate_context_page_window。

完整差异 3 路径、+15/−6;生产/测试/文档已分别分类。搜索了未改的 reader、原 selection codec、completeGoalNarrative 和 native observation 调用;保留历史 full/pinned readback,没有新增服务、用户设置或手工同步事实。当前 main 已单独接纳 native 显式窗口的一部分修复;此 PR 仍有页级续读说明和边界行为的有效增量,但 quota_capture.py 有真实合并冲突。该冲突必须由作者合并/rebase 后重新资格化;本次不将 code approval 表述为可直接合入。

对主干的风险 / Risks

未发现本 exact head 的阻塞代码问题。最强风险是错误复用未知来源,或在局部 EOF 时漏掉必读余区;这些分别由 source/session/epoch、完整性与真实 reader 反例验证。

同一冻结真实 CLI:base 三例分别暴露页级续读缺口或显式窗口提前拒绝;本 head 三例通过,验证完整正文、原 capture 不变、无 registry/runtime authority 创建,错误 Turn 和窗口0仍拒绝。

保存视图与首读两模块:137 passed / 2 failed / 14 skipped;两项 expected-delta/full 失败在 immutable base 同样复现,其测试函数 AST 不变。原显式窗口的三项失败由此修复,七个相关窗口用例通过;Ruff、直接/双语/公共边界通过。

标准 premerge 未全绿:18/19 selected 通过,直接/编译/双语及公共边界通过,CLI output growth 一项失败。同一原命令在 immutable base 和两 head 均得到完整错误元组 ('loopx_turn_plan', 11432, 35, 9300):35 条额外 Todo 的允许值为9300+60×35=11400,实际多32字符。保留失败与原门槛,不缩输入、不改 cap,也不要求这两个 reader 修复不相关的 inspection owner。两个 warm checkpoint 的 full != delta 在相同基线存在,函数 AST 保持;8323 另三项 window 拒绝也与基线相同,8318 正是修复这三项。配置 mypy 的单项 decision_capture.py:659 缺返回注解也在基线和8323相同,该文件字节一致。mypy 未冒充通过;8318未单独运行全配置 mypy。14项 skip 没有记成通过。

初始独立探针把支持字段误当必须内联,或只在嵌套对象中寻找正文;修正为显式同源恢复与完整 selection 后才得到上述正证据,初始结果保留。未改生产 fixture、断言门槛或权限。实际 native model 的后续行为、installed Host 和完整费用未执行;按策略未查询或等待 CI。

语义与 CI 对齐

更改不删减 Goal 条款、不概括 requirement prose,也不从 read receipt 推断真实模型采用。未知或不完整 source 不能继承可用性;当前 revision、任务和停止/结算控制继续由原 owner 交付。窗口、身份、hash 和 selection 校验属于实际机器约束,页级指令解释原读取义务,不产生新 execution authority。现有 baseline red 有独立同条件归因,因此与 code verdict 分开,仍阻止把此报告说成完整 merge validation 通过。

我的整体评价 / Verdict

APPROVE,精确 head f52877c8b586463c932773452f494f9f9855fbcc。在既有 quota_capture transport owner 修正一处页级说明和一个提前拒绝分支,继续复用原窗口 validator 与 cursor,比增加第二个分页器或要求调用者手工重建 selection 更小。 只修复已获准保存视图的分页说明与窗口传递;不重新 guard、不创建注册 authority、不放宽原页面预算或原 source/Turn 绑定。 原任务能够沿清楚、可验证的同源读取与恢复路径继续,source 变化和读取缺口没有被优化隐藏。当前 main 已单独接纳 native 显式窗口的一部分修复;此 PR 仍有页级续读说明和边界行为的有效增量,但 quota_capture.py 有真实合并冲突。该冲突必须由作者合并/rebase 后重新资格化;本次不将 code approval 表述为可直接合入。

此次只改 CLI/native capture 投递、恢复及说明,没有渲染页面或布局变化;已检查现有 quota/context-project/context-read 与 native 调用边界。 渲染变化为 none;实际模型读取采用、安装态及全程费用未测。 新模块/新设置或更大的架构拆分都不是这次有证据支持的最小边界;现有私有 reference 兼容有真实持久化调用依据。保留独立 baseline failures 和安装/模型/完整成本限制;批准不授 merge 或绕过权限,实际 closeout/readiness 另按当前 head 回读。

English verdict: APPROVE at f52877c. The real same-capture reader counterfactuals preserve original source, controls and recovery while fixing the bounded reuse/continuation path. Existing baseline test, typing and growth-budget failures remain separately attributed; installed/model adoption and net cost benefit are unverified. The current-main merge conflict still requires author resolution.

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.

Self-review of exact head 2b64fc5fb716dd984ed62c369d76d32b7921eaa7: PASS.

Latest-main conflict resolution keeps main’s explicit native page-window work and this PR’s narrower increment: saved progressive pages no longer reject --page-bytes before reaching the existing _validate_context_page_window; all identity, Turn, activation, offset and mutually-exclusive-selection checks remain in place. The opening also continues to expose navigation.remaining_read_command directly in its page-level read instruction.

The net diff remains three files (+15/-7). Verification passed: saved-context, first-read, read-reference and delivery-CLI suites produced 303 passed and 14 skipped; exact-head quick premerge, Python compilation, public boundary and diff hygiene also passed. Live model follow-through and whole-turn savings remain unmeasured.

@huangruiteng huangruiteng 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.

Independent approval of exact head 2b64fc5fb716dd984ed62c369d76d32b7921eaa7.

The latest-main integration preserves both native page-window handling and the saved progressive opening continuation. It removes only the premature --page-bytes rejection, routes the window through the existing validator, and keeps all source, Turn, activation and selection checks intact. The focused suites and quick premerge passed.

@loopx-agent
loopx-agent merged commit a02be12 into main Nov 8, 2026
5 of 6 checks passed
@loopx-agent
loopx-agent deleted the codex/context-opening-required-remainder-20261108 branch November 8, 2026 06:26
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