Skip to content

Stage saved replans in stateless progressive recovery - #8298

Open
loopx-agent wants to merge 5 commits into
mainfrom
codex/stateless-replan-capture-20261107
Open

loopx-agent wants to merge 5 commits into
mainfrom
codex/stateless-replan-capture-20261107

Conversation

@loopx-agent

@loopx-agent loopx-agent commented Nov 7, 2026 •

Copy link
Copy Markdown
Collaborator

Return the saved first page with progressive delivery alone

Head 775394bd8d9f164ff9a2283044a4c9d3ab158732 includes main@94b91e48aa4a2cdafe9d4d31d918fe84d0112b41. A verified saved quota capture now supports context-project --initial-read --context-delivery on --delta-delivery off. It uses the existing bounded page and continuation format. The initial selection itself supplies the first page, so precomputing a root index before that selection is unnecessary. The recovery command and on-demand field discovery still point to the same saved view.

只启用 progressive 时,保存恢复可直接交付首屏,沿原分页命令继续。首屏生成前省去一次根索引请求。错源、显式关闭以及不识别的首屏格式按现有校验处理,不识别格式仍可从同一捕获做通用发现。

For the same synthetic SQLite capture, navigation through review and writeback-contract read changes from 4 to 3 CLI calls and 5 to 4 internal RPCs. Measured RPC transport changes from 326,204 to 271,741 B. The initial selection stays 8,046 B. CLI stdout changes from 32,846 to 33,060 B with navigation included. The 8 KiB fixture still paginates and saves one CLI call to finish the initial selection. The independent source and required-view files keep the same aggregate size. This measures fixed CLI and local transport, with model tokens and completed task cost still open.

The earlier integrated head passed 51 source tests, 94 TypeScript tests and 5 isolated-wheel tests. Its standard wrapper timed out on the CLI output-budget smoke, which passed separately on that same head in 123.6 seconds. The current diagnostic-only follow-up keeps the early rejection for unsupported initial-read commands and preserves its diagnostic wording. Its three focused cases passed, including File and SQLite saved recovery. The complete same-base output-budget smoke passed on the current head in 55.5 seconds. The inherited checkpoint preflight observations below remain in the review record.

Goal and delivered outcome

Saved quota replans reach the staged review and writeback readers through quota context-project with progressive delivery enabled and Delta off. This follows the existing replan presentation in #8284. The stateless path now presents the exact decision already verified by the capture reader. The current selection transport is applied to the view after the source hash is bound.

已保存的 quota 重规划在仅开启 progressive 时,也能从 quota context-project 首读直接进入分阶段审阅。审阅与写回契约指向原捕获和原轮身份。当前选择命令的传输参数只进入呈现。

Author declaration

Validation

Tested commit c5f151b6329d0c4d6a727369b6eb022ba7249fbf. Inputs are synthetic.

Check Evidence
CLI regression File and SQLite run the guard, read the review and writeback contract, relocate the exact saved decision, and read it again. A wrong source hash is rejected. The original bytes and the authority snapshot are checked before and after readback.
Source suite 149 passed. Four checkpoint preflight cases fail at the same older capture-argument assertion on this commit and clean main.
Installed wheel Six cases passed in an isolated environment, including the stateless path and native/on-off parity.
TypeScript and standard premerge 49 focused TypeScript tests and control-plane typecheck passed. Local standard premerge passed six direct and 18 selected checks.

With progressive on and Delta off, the matched saved-capture sequence counts navigation, first read, the same review, and writeback when offered. The File run changes from 42,708 to 33,115 CLI stdout bytes. SQLite changes from 42,794 to 33,179. Ordinary full presentation recovery takes one page in these samples, down from two. The unbound crowded Vision review changes from 23,050 to 23,822 bytes because the first read now carries an actionable review route. Its optional full presentation recovery changes from 87,394 to 72,972 stdout bytes. The two presentation files together are roughly 15 KB smaller on the ordinary samples.

同一捕获、同一审阅和写回契约的对照中,普通样本 CLI 总输出少约 22.5%,拥挤 Vision 到审阅结束多约 3.3%。这些数据覆盖固定 CLI 读取和本地捕获文件大小。模型 token、真实任务结果及总运行成本需独立评估。

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
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

读取已保存配额决定的操作者可能已经失去原来的宿主会话。此时仍需先判断下一步,再阅读原审阅要求。 一次 replan 的原捕获移到新路径,调用者只启用 progressive。原入口会拒绝附带首读,新入口从核验过的捕获返回有界首读,再按指针读原审阅和写回。 真实 File 和 SQLite 都读回同一规划指导、必需结论与原结算身份。读取后,捕获和 Todo authority 保持原值。 交付覆盖已保存决定的无状态读取,包括首读和审阅与写回契约。恢复源继续由原捕获摘要校验。 真实宿主上的模型采纳、含后续补读的整程成本,以及作者更新后的组合验证仍待观察。

改动思路 / Approach

context-project 先核验摘要和 Goal、Agent、Turn,再复用原生分段审阅的计划生成当前视图。附带首读直接走原 selector,省去预先规划根索引。 复用当前 typed replan、digest reader 和结算契约。将读取指针绑定到刚核验的原始文件,继续沿用同一 source hash。 主干已合入 #8303,冲突位于 turn_envelope.ts 的无状态投影分支。隔离组合复用原生分支的优先级,先采用有效 replan 投影,否则继续走普通准备态的 scope 计划。

具体改动 / Changes

基线为 94b91e48aa4a2cdafe9d4d31d918fe84d0112b41。同一份已保存的工作决定应可在原身份下完整读回。渐进首读允许按需取得详情,执行前仍需读取适用约束和完整操作契约。 基线规范

  • 可读的无状态首屏。 关闭 Delta,File/SQLite 在 8,192 字节上限下完成两页。
  • 原审阅与写回。 File 和 SQLite 都在 8,192 字节上限下交付两页。复查原审阅指导、写回字段与原 Turn 结算身份一致,捕获字节及 authority snapshot 一致。
  • 失败与隔离。 移位后使用错误捕获摘要或错误 replan source hash 均被拒绝。显式关闭 progressive 后,附带初读也被拒绝。
  • 宿主采用与整程成本。 真实宿主上的模型采纳、含后续补读的整程成本,以及作者更新后的组合验证仍待观察。

关键代码讲解

project_saved_context_capture 绑定原 Goal、Agent 和 Turn。_saved_context_read_page 保留原 cursor。evaluateTurnEnvelope 复用现有 replan 计划并把指针交给原 reader。 保存入口 阶段选择

对主干的风险 / Risks

当前分支与最新主干 dee5496632 有一处冲突。隔离组合让 replan 投影优先、普通准备态继续用 #8303 的 scope 计划,两个入口均已在 File 和 SQLite 上复验。作者更新分支后需检查新提交。 现有主干分支

聚焦 Python 131 项通过、11 项跳过。6 个旧 checkpoint 失败在两处基线复现。TypeScript 68 项通过。 Quick premerge 的 6 项直接检查和 3 项选中检查通过。 历史失败涉及既有 full/delta 模式和 capture 参数断言。无状态恢复另有独立正反例。 远端 CI 未取样。

计量使用 CLI 实际页的原始字节。整程收益需要同时计入审阅、补读和模型实际使用。

我的整体评价 / Verdict

赞同 775394bd8d9f164ff9a2283044a4c9d3ab158732 的无状态恢复改动。当前精确提交可独立验证,并有两条计划共存的隔离组合证据。 真实宿主上的模型采纳、含后续补读的整程成本,以及作者更新后的组合验证仍待观察。

English verdict: APPROVE. The current stateless recovery preserves the original review and writeback across both stores; the conflict still requires a new head.

This branch has not been deployed

No deployments
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.

1 participant