Skip to content

fix(replan): return current facts for same-obligation recovery - #7426

Merged
huangruiteng merged 1 commit into
mainfrom
codex/controller-stale-review
Oct 27, 2026
Merged

huangruiteng merged 1 commit into
mainfrom
codex/controller-stale-review

Conversation

@loopx-agent

Copy link
Copy Markdown
Collaborator

A stride review can become stale after delivery but before its same-obligation writeback. The rejection previously offered a generic refresh-state command without the original Turn binding or the current review facts, inviting an unchanged retry or another admission just to recover context.

The TypeScript semantic owner now returns the complete current review context and stride controls on this specific mismatch. The rejection projects read_current_replan_context, asks the consumer to read and reassess those facts, and preserves the original Goal/Agent/Turn/obligation and settlement identity for retry. It does not auto-adopt the reference, accept a stale decision, admit work, or spend quota. Other rejection routes remain unchanged.

共享 Goal 的验收变化仍然会使评审依据过期;不能仅因 outcome 属于另一 Agent 就忽略它。本变更提供完整当前依据供重新判断,保留原结算身份与所有现有拒绝条件,不降低新鲜度要求。它是 controller 统一契约迁移中的恢复切片,未完成共享 writer、差分上下文或全部执行路径迁移,也未证明已安装宿主采用或模型效果改善。

Validation:

  • Real source-checkout CLI against disposable File and SQLite authorities: 4 cases cover both an invalid reference and an actual objective revision after delivery, returned facts, revised validation decision, same-identity writeback, and idempotent single spend without another guard. All 4 new recovery expectations fail against immutable baseline 99921829f2c5fa2ad35a024c72abb88717003ef3.
  • Broader Python selection: 143 passed, 6 failed. All 6 failures reproduce against that same baseline: four existing canonical-authority failures in refresh-state fixtures and two staged-read fixtures rejected for missing finding status. They remain unresolved and are not reported as passes.
  • TypeScript context/stride/semantic suites: 91 passed; shared acceptance invalidation and recovery payload non-aliasing included. Type checking, Ruff and whitespace checks passed.
  • Risk-based premerge: passed, 19 selected checks, no failures or manual holds. The final host-action projection was additionally covered by the final four real CLI cases.

Boundary: 3 runtime source files, focused existing test suites, and bilingual protocol guidance. The new host-action token extends the existing rejection contract; transient recovery data uses existing context/control owners. No new state owner, migration, permission, provider implementation, model run or benchmark job. No install or merge qualification claimed. The controller RFC records the same freshness/relevance/settlement distinction in #7416.

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.

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

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

本次只修订语言表述;评审仍绑定原 head 27125481b0c3d5e7c8e2585799cd672a8fc6f68a,结论、发现与验证范围不变。

动机

Agent 在完成当前工作的必需复核后,可能在原 writeback 前遇到 Goal objective 或共享验收变化。

旧拒绝既不给当前复核事实,建议重试命令也不保留原 Turn 绑定,容易反复 stale write,或仅为取回事实再次准入;新拒绝返回当前事实,要求重新判断后再重试同一义务。

真实 File/SQLite CLI 能恢复变化后的依据,在原身份下接受修订决定,replay 后仍只扣额一次;依据再次变化时,仍在 append/spend 前拒绝。

本补丁不放宽 freshness、不自动采用引用、不授权新工作,也不统一 controller 契约或证明安装态/模型收益。

自然 Agent 是否采用返回指令,以及更广的 unified-writer/App 迁移仍未资格化;本切片交付源码 CLI 的恢复路径。

改动思路

现有 TS semantic owner 直接返回已派生的当前事实,Python 只投影恢复指令;无需新增 admission API、持久状态 owner 或 provider policy。

当前边界是通过 refresh-state 恢复同一义务的 stale basis;既有 eligibility、义务身份、证据和一次结算规则继续有效。

仅回 ID 会诱导盲目重绑;为取事实再跑 guard 会改变 admission 上下文。本方案保留完整既有 context 和当前 control,不另建 recovery record。

触发条件 Base 原 head 27125481b0c3d5e7c8e2585799cd672a8fc6f68a
同一义务的 review basis 已过期 拒绝,给通用未绑定写入建议 仍拒绝,返回当前 context/control 和先读再判断指令
依据再次变化 必须继续拒绝 append/spend 前再次拒绝并返回最新 basis
重新判断后的当前决定 原 guarded writeback 保留原 Goal/Agent/Turn/obligation,只扣一次
缺 path、foreign obligation 或策略 off 原规则 原规则,不凭 recovery 绕过

表格来自源码,Mermaid 渲染未检查。语义判断留在 TypeScript,Python 只投影错误与恢复动作;另一 outcome owner 改共享验收,也仍影响当前依据,不能忽略他人的变化来减少 stale 拒绝。

具体改动

关键代码讲解

  • projectReplanSemantics 从准确 ID 派生 reviewContextChanged。只有其他结构正确的同义务 mismatch,才返回 clone 的当前 replan_context、strideControlContract control、收到的引用和有序指令。required decision/path、foreign obligation、证据和 terminal 校验仍优先;clone 不会改原 context。
  • project_replan_writeback_rejection 识别 typed recovery,选择 read_current_replan_context,删除通用的未绑定 next_cli_actions。没有该 payload 时,lifecycle、capability、普通拒绝路线保持不变;此处不执行恢复。
  • handle_refresh_state_command 保留 typed rejection,仅在确有 command 时附加 Required transition。真实 subprocess CLI 验证先拒绝且不 append/spend,再沿原身份成功持久化。

完整 diff 为 7 文件、136 增加/12 删除:3 runtime source、3 个既有测试 suite 和双语协议指导。测试还覆盖另一 owner 改共享验收会改变 basis,以及恢复输出不与输入 alias。没有 schema migration、storage adapter、新 CLI option 或设置 capability。

独立规格为 docs/reference/protocols/quota-replan-planning-selection-v0.md,revision 为 99921829f2c5fa2ad35a024c72abb88717003ef3,在 diff 前读取。新章节只是扩展说明,不是自身 oracle。

Criterion 处置
original-settlement-identity implemented:实际持久化原 receipt identity,错误 obligation 继续拒绝
writeback-before-single-debit implemented:拒绝无 effect,原 writeback 成功后重复 spend 也只扣一次
shared-typed-owner implemented:复用 TS qualifier/context/control 与 Python transport
source-versus-installed-qualification deferred:安装态/自然宿主采用归原 host/controller 资格

关键变化是拒绝后终于有可执行恢复路径,不是新增授权。当前 context 仍受既有来源和 coverage 约束,不能因有限展示未出现就认定材料不存在。

对主干的风险

真实 effective-Turn/replan suite 20 项通过,其中 4 项 File/SQLite 覆盖无效引用及 delivery 后 objective revision;独立 base 运行暴露了旧通用命令缺少当前事实。另两个 reviewer 用例在首次 recovery 后再次改 objective:都先在 append/spend 前拒绝,再接受新判断且保留原身份与一次扣额。恢复没有新 guard;既有测试还继续验证后续 canonical history/followthrough,不止于首次成功。

三个 TS suite 91 项通过。成对 40 项 production-owner 比较覆盖 5 种 review trigger、两种 strategy 及 fresh/missing/foreign-obligation/foreign-context:35 份完整 JSON 一致,仅 5 份 enabled stale-context 增加预期 recovery;全部 20 份 off-mode 输出与不可变 base 完全一致。这证明输出隔离,不证明模型理解。

相邻命令在不可变 base 和原 head 都得到 54 通过/6 失败。完整失败输出在只规范化临时根目录计数、进程 metadata、地址和耗时后一致,包括每个 node、断言、错误与 stack。四个 test_refresh_state_replan_gate.py 用例在 semantic qualification 前遇到 canonical-authority-required fixture(repair-delta-only、atomic blocker、legacy cadence、rotated Vision);两个 provider 的 test_pure_replan_does_not_advertise_unavailable_explore_attachment 在 replan rendering 前因缺 finding status,被 explore.result.normalize 拒绝。它们没有进入三个改动生产位置,归为 pre_existing_unrelated,fixture 维护另属其 owner;没有改写成通过或声称由本 PR 修复。

语义与 CI 对齐

以 read-current-context host action 和临时派生投影扩展既有拒绝词汇,不创建持久权限或新协议生命周期。有序指令保留 actor、source provenance、先重新判断再重试、原身份、不自动 spend 和重复 freshness 检查。读取/判断是 consumer 指令,改 ID 不代表模型已采用;通用错误保持 domain-neutral。

Risk-based premerge 6 direct+19 selected 通过,含 compile、输出预算、semantic advisory、public boundary 和既有 scheduler/replan 检查。未查询、轮询或使用 GitHub CI。reviewer 早期 command-path/import/key 错误保留并修正,不归因于补丁;未改 PostgreSQL 存储,也未宣称 PostgreSQL 资格。

最强反例是首次 recovery 有效、重试前却再变化;已在两个真实隔离后端验证。六个相邻失败仍为红色,有同命令与同失败细节的 base 归因,不能据此宣称整个仓库全绿。

我的整体评价

APPROVE,这是边界清楚的恢复增量。长程行为 improved:stale-basis 拒绝后能沿原身份继续,新漂移与 replay 仍受保护;用户体验 improved:当前 CLI 返回可行动事实,不新增设置、强制人工跳转/重入或确认轮次。

原 PR 只涉及 JSON CLI rejection/recovery 和协议文字,未改 App/Lark view 或设置实现,不宣称渲染 UI 验证。安装态模型采用、host-specific presentation 仍未测。

三个小型既有 source 复用原 facts/control owner,不增加重复状态,并删除误导重试命令,机制合比例。额外完整 context 字节只出现在拒绝路径,未宣称 token 效率提升。六个不变 fixture 失败及安装/统一契约资格分别保留;读取时 PR discussion 数组为空。共享作者账号通过 COMMENTED 承载原结论,不是正式 GitHub 自批准或 merge 权限。

本切片完成来源改变后的同义务真实 CLI 闭环,同时保留 freshness、证据和一次结算边界;自然模型是否遵守返回指令、统一 controller 迁移是否完成,仍无此资格。

English verdict: APPROVE — 27125481b0c3d5e7c8e2585799cd672a8fc6f68a; real File/SQLite recovery, repeated drift, original identity and single-debit replay verified. Local premerge passes; six independently matched pre-existing adjacent fixture failures remain disclosed, with installed adoption and merge qualification separate.

@huangruiteng
huangruiteng merged commit 0bd508b into main Oct 27, 2026
29 of 43 checks passed
@huangruiteng
huangruiteng deleted the codex/controller-stale-review branch October 27, 2026 03:51
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