Skip to content

Bind replan capability context independently of reader addresses - #8292

Open
huangruiteng wants to merge 1 commit into
mainfrom
codex/bind-replan-context-without-reader-address-20261107
Open

huangruiteng wants to merge 1 commit into
mainfrom
codex/bind-replan-context-without-reader-address-20261107

Conversation

@huangruiteng

Copy link
Copy Markdown
Collaborator

问题与交付

真实重规划的 quota 读回会为同一份捕获生成不同的读回地址。地址含最终捕获摘要,在能力贡献进入捕获后发生变化,导致已应用的记忆贡献与最终计划重新校验时被误拒。

能力贡献的签名投影排除生成的读回地址,仍绑定重规划动作、计划和可执行的结算命令。捕获和读回端继续校验完整摘要。旧版未版本化、已按地址绑定的 quota 贡献可按原地址验证,移动地址后仍会被拒绝。版本化贡献走当前规范签名。

验证

  • 对照 main 32167518b3c2646fd9b6a3a6e0aaf74b258a7b70,验证提交 d92ab973b77dcb5fc486561cba02a720103d40ce。
  • File 和 SQLite 的真实 CLI 重规划都覆盖记忆贡献、捕获摘要读回、地址变化后的复验与结算命令篡改拒绝。相同两项在隔离安装 wheel 上通过。
  • TypeScript 20 项和本地标准预合并全部通过,包含 5 项直接检查和 13 项选定检查。

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

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

No blocking finding at d92ab973b77dcb5fc486561cba02a720103d40ce. 本次代码结论为 APPROVE;与 main 的测试文件冲突仍是独立合入门槛。

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

动机 / Motivation

已为指定 Agent 启用记忆、随后进入真实重规划的操作者会遇到这个问题。 同一轮已经召回建议,保存决定后读回地址随捕获摘要变化;旧实现随后丢弃该贡献,当前 head 保留它,同时拒绝动作或结算命令被替换。 这里的贡献是已经召回的可选建议、宿主指导和可选结果字段。原先读回显示已应用,真正交给宿主的内容却可能为空,后续工作会失去已取得的信息,并产生重复排查或重试。

本次独立 File、SQLite 和隔离安装包验证确认:地址变化后的建议与可选结果字段保留,完整捕获被改写以及十类实质篡改仍被拒绝。 本 PR 只修复既有重规划的贡献复验;没有新操作、开关、权限或自动启用,也不认证真实模型采用或完整成本收益。

改动思路 / Approach

沿用 quota/heartbeat 的注册入口、TypeScript governing action 文档和原有完整捕获读取器。贡献摘要只绑定决定与结算的实质内容,生成的地址由原 reader owner 继续负责;不改变全局 quota 签名,也没有另造 Python 判断规则。完整捕获摘要仍包含全部来源,因而贡献可迁址并不意味着篡改后的捕获可读。

复用已有 TypeScript governing owner,仅从能力贡献的派生签名中去掉生成地址;完整捕获校验与执行结算权限仍由原 owner 管理,精确旧摘要兼容有真实持久消费者。 当前边界是既有 quota/host 贡献的注册与恢复复验,不新增运行策略、配置、持久状态或产品操作。 对旧的未版本化观察,只在当前摘要不匹配时计算一次原地址摘要;必须精确相等,不能以兼容为名直接接受旧值。没有旧消费者时删除该分支更简单,但这里存在真实可序列化 quota 贡献,当前保留有依据。

具体改动 / Changes

完整差异为三文件 +82/-4,生产改动仅 capability_context.ts 的 +15/-4,其余是实质回归测试。没有增加配置、持久字段或公开 CLI。

关键代码讲解

  • contextSource L22 先去掉生成的 replan_read_path,quota 分支仍调用已有 action signature owner;Goal、Agent、决定和结算继续进入摘要。宿主 envelope 分支保持原文档。
  • projectTurnContextContribution L77 先重新校验当前 readback 与完整贡献;只有未带 contract_binding 且存在旧 reader 的 quota 观察才可尝试原摘要。改变旧地址、权限或建议都会拒绝;即使 marker 为 null,也不会进入旧兼容分支。
  • test_captured_replan_preserves_scoped_memory_without_trusting_reader_location L171 通过真实 CLI、捕获和 typed projection 覆盖 File/SQLite;外部记忆 IO 使用合成记录,未伪造核心复验结果。

规范依据为 docs/reference/protocols/turn-envelope-v0.md,固定于 32167518b3c2646fd9b6a3a6e0aaf74b258a7b70(原文)。条款映射:Captured replan reads 已实现,原成功来源可读、改写来源拒绝;Registered context binding 已实现,地址可变、实质内容仍绑定;Inactive binding 已实现,关闭及未启用 Agent 均无贡献;Cached journal recovery 已实现,保存后的贡献在新进程复验,并保留精确旧地址兼容。这里沿用原文条款名称,没有新增验收要求。

对主干的风险 / Risks

最强反例是只验证地址迁移成功,却意外允许结算命令或身份被替换。本次在每个有效正例上逐项改动 Goal、Agent、write scope、replan decision、obligation、settlement command、readback、instructions、context fields 和 result fields;source 与 wheel 的 File/SQLite 均拒绝全部十项。完整来源另由真实 reader 校验,任意改写捕获仍失败;摘要相等没有被当作权限或模型采用证明。

独立不可变基线 32167518b3c2646fd9b6a3a6e0aaf74b258a7b70 在两后端均复现 applied recall 随后消失,当前 source 与安装 wheel 均保留。每个环境还比较关闭、可用但当前 Agent 未启用、已启用普通任务和已启用重规划四条路径;默认路径没有额外 provider 调用、指导或结果字段,准入决定保持一致。原始捕获在关闭 runtime 后由新进程读回,当前贡献保持有效;旧地址绑定复验与五类实质变化拒绝也通过。

验证结果:166 项 focused Python、20 项贡献 TS、61 项相关 TS、control-plane typecheck 与改动测试的 Ruff 通过;标准 premerge 的 5 项直接检查、13 项所选检查全部通过。wheel 导入先核对为隔离 site-packages,唯一改动生产文件与本 head Git 字节一致。未查询托管 CI,未运行付费模型或把合成 provider 当作真实采用。

当前 main b0474082c9dac127efc4714f042bf9811e784827 与本 head 的实际 merge-tree 在 tests/control_plane/test_replan_progress_native_cli.py 有冲突,尚无完整可合入树。我只将本 head 的生产文件在进程内覆盖到该 main,独立八例和读回/复验均通过;这是相邻 owner 的兼容诊断,不能替代作者解决冲突后的新 head 评审和检查。完整生命周期成本、最低 Node/Windows 以及已安装宿主升级仍没有本次资格结论。

我的整体评价 / Verdict

本次完成了一个可用且成比例的修复:已有注册和恢复调用真实触达同一 TypeScript owner,去掉派生地址的自引用,保留决定、结算和精确旧摘要边界;没有为修复引入新的管理机制。有限代码变化带来的维护成本合理,暂不需要额外抽象或迁移工程。

long_horizon 判断 improved,依据是已取得的上下文跨捕获及新进程复验仍保留,而不是测试或 receipt 数量;user_experience 判断 improved,既有授权和意图可直接复用,没有新增交互轮次,也减少已应用状态与宿主实际输入不一致的风险。检查的入口没有渲染呈现改动,因此 visual_review 不适用。真实模型理解、已部署宿主采用与完整成本收益仍未验证;这些边界没有被本次代码批准替代。

English verdict: APPROVE for exact head d92ab973b77dcb5fc486561cba02a720103d40ce. The scoped contribution-binding repair and negative integrity checks are independently validated. Resolve the test-file merge conflict and requalify the resulting head before merge; no merge authorization is granted.

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.

2 participants