Skip to content

Require a stride decision at every enabled periodic review - #6372

Merged
huangruiteng merged 7 commits into
mainfrom
codex/stride-due-decision-gate
Oct 13, 2026
Merged

huangruiteng merged 7 commits into
mainfrom
codex/stride-due-decision-gate

Conversation

@huangruiteng

@huangruiteng huangruiteng commented Oct 13, 2026 •

Copy link
Copy Markdown
Collaborator

A due periodic review could previously settle through typed progress, a blocker, a terminal result, or an automatic successor Todo ACK without recording a stride decision. This meant the cadence could fire while leaving no grow/switch/verify assessment on the Goal.

This PR requires an evidence-linked agent_vision.stride_decision for every enabled periodic_review_due obligation before any legal outcome settles. The decision must reference the admitted obligation and delivered review context. A successor Todo remains a valid outcome but no longer bypasses the original review. An evidence-backed terminal stop path is allowed only when the effective Goal strategy enables stride. Both CLI writeback and MCP preflight use the existing machine-default/Goal-override resolver; strategy-off MCP input is rejected before Todo lifecycle effects. No new authority to execute, complete a Goal, or spend quota is introduced.

The TS replan semantics owner decides source eligibility and writeback acceptance. The Python host and refresh adapters pass the resolved strategy to the existing Vision codec. The RFC and protocol describe the settlement rule; the registry I/O census reflects the new read-only MCP preflight site.

Validation on disposable File and SQLite authority: due review rejects missing and foreign-context decisions without appending, and persists a correctly bound decision; machine-default stride without a Goal override rejects missing decision and accepts a terminal decision. Real MCP off-mode rejects stop + stride_decision before any CLI/Todo effect, preserves an open Todo and unchanged state, then successfully completes the same Todo with corrected input. Its machine-default enabled counterpart accepts the terminal packet. Focused TS tests 35/35, control-plane typecheck, adjacent Python replan suite 47/47, Vision facade 17/17, MCP completion validation 4/4, host Vision suite 17/17, and Goal frontier rules 47/47 passed. Risk-based quick canary passed (compile, three catalog smokes, public boundary); registry I/O manifest check is current (303 sites); semantic inventory advisory found no supported new vocabulary carriers. An optional mypy probe is not clean: a focused --follow-imports=skip run reported 30 diagnostics across three touched modules, while the default run traversed 561 files and reported 4,766 errors; no mypy pass or baseline attribution is claimed. Required runtime/typecheck/CLI gates above passed. No live Goal state was changed. Frontend and Lark entrypoints are unchanged; the existing Goal Vision/MCP/CLI interaction carries this rule.

Future-facing refactor: source-bound transition candidates and one effective strategy projection keep the original Turn ACK and terminal authoring consistent. Broader migration was deferred. Residual risk: configuration can change between read-only MCP preflight and serialized writeback; formal writeback remains authoritative and may reject a changed strategy. No release or production migration is included.

Signed-off-by: huangruiteng <huangrt01@163.com>
Signed-off-by: huangruiteng <huangrt01@163.com>
Signed-off-by: huangruiteng <huangrt01@163.com>
Signed-off-by: huangruiteng <huangrt01@163.com>
Signed-off-by: huangruiteng <huangrt01@163.com>

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

Request changes conclusion (author-owned PR; GitHub blocks formal self-review)

评审 head:0adc10e05816cb0b891ead7895347c26ef89591d。当前有两条已复现的 P1 blocker;此前错误 context 被接受、直接 CLI 的 off-terminal 被接受的问题已在本 head 消除,不重复计算旧问题。

动机

开启步幅策略的 CLI 或 MCP 用户,在周期性复盘到期时需要知道本次继续、扩大或换路的决策是否真正留下记录。

原版可以只报 blocker 或新增后继 Todo,就把到期复盘结算掉,却没有步幅决策;本改动要求先保存决策再结算,避免后续轮次在缺少判断记录时继续推进。

实测普通启用路径已拒绝缺失或错绑的决策,并能保存正确决策后只扣一次额度;但机器默认启用时的停止决策被误拒绝,关闭策略的 host 输入又发生先完成后失败的回归。

本评审不证明步幅策略的模型采纳、长期收益或全成本实验验收,也不涉及生产配置、自动合并或改变默认启用状态。

改动思路

现有 TS 重规划规则和 Vision codec 足以承载这条结算不变量;应复用同一个有效配置来源,不能让 host 预检与正式写回对启用状态作出不同判断。

本 PR 的边界是“启用 stride 后,每次到期都记录绑定当前来源的决策”,不包括自动执行决策、证明模型采纳或收益,也不改变 Goal 完成、额度或合并权限。

主路径是 guard 交付原始来源与步幅合同,Agent 在现有 Vision 写回中提交独立判断,TS 校验后保存 ACK,再结算额度。新增后继 Todo 仍是合法结果,但不能替代到期判断。producer 和原始 Turn 的 consumer 都调用同一资格规则,并把 obligation 与 ACK 一起传递,这个相关重构值得保留。决策的 grow/switch/verify 是不可推导的意图;启用状态则是现有配置的派生值,不该由两个调用方自行重建。

正向实测经过“创建后继 → 同 guard 再读 → 缺失/错绑拒绝 → 正确决策保存 → spend → replay”,File 和 SQLite 都保存了完整原始决策,同轮只结算一次。没有新增 CLI、provider、策略数据库或新 frontend/Lark 入口;现有设置与写回仍是产品入口。

具体改动

全量 diff 为 20 文件、+368/-34:生产代码涉及 TS 语义/codec、Python frontier/amendment/quota/writeback/host 适配;测试覆盖周期复盘和拒绝路径;三份文档披露新的强制记录规则;既有 registry I/O manifest 更新对应真实 resolver 调用。不是单纯增加 serializer 或未使用框架。

关键代码讲解

  1. requiresPeriodicStrideDecision 识别 typed periodic trigger 与已启用策略,供 requirements、qualify 和 successor eligibility 共用,避免只挡普通写回却让 ACK 绕过。
  2. projectReplanSemantics 在所有到期结果前要求 v2 独立轴、证据路径和当前 obligation/context;缺失时 satisfying outcomes 清空,保留原始 guard。错误引用不会因为另有 blocker 就被接受。
  3. prepareVisionRefresh 在既有有界 codec 中新增终止路径开关,缺省 false 保留原拒绝;新规则的效果因此取决于调用方传入的有效配置。
  4. host_vision_request 在生命周期写入前预检。这里无条件 true,和正式 refresh 的条件不一致,是下面第二条回归的直接原因。

判定依据是修改前的 docs/reference/protocols/goal-vision-replan-contract-v0.md,固定 revision 17bc011b3c5fcd30b879442cb21d734ac5d8ab69;同时读了该 revision 的 stride RFC,并独立核对“每次到期必须评估并记录”的当前要求。以下使用文档原有条款文字,不造新的验收编号:

  • actual context and admitted obligation references:已实现。最终 File/SQLite 都拒绝错误 context/obligation,正确值逐字段持久化;之前 6d747 head 接受错误 context 的反例已被同条件复测消除。
  • off preserves ordinary projection and review semantics:未满足。直接 CLI 的 off 已恢复拒绝,但 MCP 的拒绝时机和生命周期效果仍不同;继承机器默认的启用状态也没有贯穿正式输入。
  • Required acceptance and authority remain unchanged:满足本 slice 的边界。source-bound ACK 不是 Goal 完成或模型收益证明,未扩展执行、peer、额度或合并权限。

强制记录是有意改变,不要求兼容旧的“到期但只报 progress”的绕过行为;但 off 与有效配置的含义不能一并悄悄改变。

对主干的风险

[P1] 正式终止路径读取原始 registry,漏掉机器默认启用。 state_refresh.py:1034–1037 使用 raw Goal execution_profile;同函数后面的 cadence 已通过现有 resolver 解析机器默认。实测仅在隔离 runtime 中将机器默认设为 enabled、Goal 不加覆盖,guard 交付 enabled 策略,带当前 context/obligation 的 stop 写回却 exit 1:stride_decision requires an evidence-linked path decision,未追加 run;同输入改成 Goal 显式 enabled 即成功。File 和 SQLite 都复现。最小修复是复用已解析的 effective strategy,不增加另一套启用状态;新增真实 CLI inherited-on/Goal-on/off 终止对照。

[P1] host 的无条件终止许可破坏关闭路径的预检无副作用。 host_adapter_settlement.py:133 接受默认 off 下的 stop+stride,然后既有 host transaction 先 complete Todo,再由正式 refresh 拒绝。相同 frozen MCP 输入在 base 是 ValueError、零 provider 调用、Todo open、状态未改;在 head 是 Todo done、completed=true / ok=false、failed_stage=durable_writeback,spend 为零。随后同意图纠正输入可以恢复并只 spend 一次,但“可恢复”不等于 feature-off parity。应在 lifecycle 之前基于同一有效配置拒绝该输入,保留 enabled terminal 支持;增加真实 MCP 的无副作用拒绝与同意图重试测试。

这两条来自实际 CLI/MCP 与隔离 File/SQLite,不是 mock 注入的预期结果。最强反证正是“现有检查绿了,真实入口仍有两种配置/时序错误”。没有修改真实 Goal、凭据或生产配置。

语义与 CI 对齐

本 PR 复用现有 typed vocabularies,未新增 actor 生命周期。新 packet 明确 must record before settlement:记录/provenance 是机器义务,策略质量与收益仍是 Agent claim,不是验收证书。开发期 advisory 先跑、12 个 changed source snapshots 未发现受支持的新命名集合;这不覆盖动态字面量。随后 quick canary 的完整语义、maintainability、I/O census、边界检查通过,但不能代替上述实际配置分支。

独立检查:56 个 TS focused tests、control-plane typecheck、mypy 19 源文件、配置范围 Ruff、quick canary 均通过。五个 Python control-plane 回归文件结果是 126 passed / 1 failed:test_python_prepare_facade_sends_raw_provider_context 仍断言旧的完整参数对象,未包含本 PR 新转发的 allow_terminal_stride_path=false;同一单测在 base 通过、head 失败。这是需要同步修复的 facade characterization,不是上述两条真实入口问题的替代证据,也不能把整个套件写成通过。按 Goal 的 wait_for_ci=false 未查询或等待 GitHub CI,CI 状态不是本次 REQUEST_CHANGES 的理由。此前无关的本地命令设置错误已纠正,不能归咎于 PR。

我的整体评价

结论是 REQUEST_CHANGES,只针对上述当前 head 的两条实际回归。long_horizon 与 user_experience 均存在回归:继承配置的合法终止被误挡,关闭路径需要多一步部分完成恢复。强制记录和共享 TS source-bound gate 有明确价值,规模也与原问题相称;不需要扩张为新框架,也不要求本 PR 完成父 RFC 的模型采纳/长期成本实验。

保留 historical stride v1/v2、ACK 和 journal readers 有真实持久化需求;transient candidate request 已随当前内部 caller 一起升级,无需再保留旧 request 分支。future-facing pass 应聚焦复用有效配置来源并恢复预检,不做无关 TS 迁移。修复后应重跑全量 base..head、上述 inherited/on/off 和 host 拒绝/恢复反例,不能继承此次局部正向结果或旧批准。未合并。

English verdict: REQUEST_CHANGES - 0adc10e; inherited machine-default activation rejects a legal enabled terminal stride decision, and default-off MCP preflight completes the Todo before formal rejection. Real CLI/File/SQLite and paired actual MCP evidence; focused TS/static/quick-canary checks pass. No merge.

Comment thread loopx/state_refresh.py
Comment thread loopx/control_plane/host_adapter_settlement.py Outdated
Signed-off-by: huangruiteng <huangrt01@163.com>
Signed-off-by: huangruiteng <huangrt01@163.com>

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

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

独立评审 head:e36a734209646f87cd975f8a68afe4b622eee3b8。未发现当前阻塞问题。此前 0adc10e05816cb0b891ead7895347c26ef89591d 的两条 P1 和 facade 失败均已按同条件独立复测,不能仅凭作者声称修复或最新绿检查继承批准。

动机

开启步幅策略的 CLI 或 MCP 用户,在周期性复盘到期时需要知道本次继续、扩大或换路的决策是否真正留下记录。

原版可以只报 blocker 或新增后继 Todo,就把到期复盘结算掉,却没有步幅决策;本改动要求先保存决策再结算,避免后续轮次在缺少判断记录时继续推进。

当前实测缺失或错绑决策会被拒绝,正确决策持久化后只结算一次;机器默认与 Goal 显式开启都支持合法停止路径,关闭策略的 host 非法输入在任何 Todo/CLI 效果之前被拒绝。

本评审不证明步幅策略的模型采纳、长期收益或全成本实验验收,也不涉及生产配置、自动合并或改变默认启用状态。

改动思路

到期记录与来源绑定归现有 TS 语义 owner;有效启用状态复用已有 cadence resolver,Python 仅做 registry/host 输入适配,不新增策略数据库或平行判断源。

本 PR 交付“启用后每次到期先记录当前来源的决策再结算”,包含 CLI/MCP 的拒绝和恢复;不交付自动执行、模型采纳、长期收益或合并权限。

Guard 交付当前来源,Agent 在现有 Vision 入口提交独立 grow/switch/verify 选择,TS 判断证据和来源是否满足本次复盘,再保存 ACK、结算额度。新增后继 Todo 仍是合法结果,但不能替代到期判断。producer 与原始 Turn consumer 使用同一资格规则,候选携带 obligation+ACK,避免只在普通写回加一道检查却留下旁路。

步幅选择是不可由 progress 自动推导的意图;启用状态是配置派生值。最终版 formal codec、qualification、cadence 共用解析后的 effective Goal,MCP 则只对终止附件做同源配置预检。它不是第二套策略 owner,也不新增开关或策略存储。既有 frontend 设置和 CLI/MCP 写回入口足够承载此修复,没有可见首屏改动或新的导航/确认步骤。

具体改动

全量 base..head 共 24 文件、+554/-41。生产 13 文件 +166/-34,测试 7 文件 +356/-3,三份 RFC/协议文档 +22/-2,既有 registry I/O manifest +10/-2。已读全量 diff,以及 0adc→ddda→e36 的每个修复增量;base、依赖、原有 schema/readers 未变化,所有受增量影响的配置/host 假设重新执行,不把旧测试改名为新证据。

关键代码讲解

  1. requiresPeriodicStrideDecision 以 typed periodic trigger 与 normalized strategy 判定是否必须记录。requirements、qualify、canonical successor 与原始 Turn reentry 共用,非到期来源不因名字或 prose 被误分类。
  2. projectReplanSemantics 要求当前 v2 decision、独立轴、evidence-linked path 和 admitted obligation/delivered context。缺失或错绑会清空 satisfying outcomes,即使同报 blocker/successor 也不能结算;正确输入保留原有合法结果。
  3. prepareVisionRefresh 仍由现有 codec 负责预算、公共安全与输入形状;缺省 false 的 terminal flag 保留关闭行为,有效启用时才允许 evidence-backed stop。停止当前路径不等于关闭 Goal 或证明收益。
  4. _allow_terminal_stride_path 在 complete_task/review_task_vision 的生命周期之前读取现有有效配置,给 host preflight 传布尔结果;ordinary/no-Vision 路径不做此读取。正式写回仍校验最新来源,不因预检成功就获得结算权限。

判定依据是修改前的 docs/reference/protocols/goal-vision-replan-contract-v0.md,固定 revision 17bc011b3c5fcd30b879442cb21d734ac5d8ab69;同时完整读取相同 revision 的 stride RFC,并核对当前“每次到期必须评估并记录”的要求。文档原有条款映射如下,不造新的验收编号:

  • actual context and admitted obligation references:满足。当前 File/SQLite 都拒绝错 obligation/context,正确 authored decision 与持久化对象逐字段相等。
  • off preserves ordinary projection and review semantics:满足本次受影响入口。相同 frozen MCP 输入在 base/e36 都是零 CLI 调用、Todo open、状态原样、零 spend;此前 revised heads 的部分完成回归已消除。正常 authoring/correction/retry 的完整 host suite 也通过。
  • Required acceptance and authority remain unchanged:满足。记录义务不认证执行/收益;原始 scope、Goal acceptance、额度和 peer/merge 权限没有扩大。

对主干的风险

正向真实路径是“guard → 新 canonical successor → 同源再读仍 due → 缺失/错绑拒绝 → 正确 record 保存 → spend → settled replay”。精确 head 的 File 与 SQLite 均通过,非法尝试不改 Goal/registry/index,最终仅一次结算。继承机器默认的合法 stop 也在两种真实 backend 上成功,与 Goal 显式开启一致。Host 的 enabled 测试验证预检/配置路径,来源资格由另外的 due-source 测试证明;不能把人工 fixture 的 v2 形状本身当成执行或验收证书。

关闭路径强反例也重新执行:0adc/ddda 会先把 Todo 完成再拒绝;e36 在 provider sequence 之前抛输入错误,未执行任何 CLI,随后纠正同意图请求成功且仅 spend 一次。已提交 enabled 请求若换 Vision 意图,仍拒绝重写,没有第二次 spend。当前 native successor/reentry 检查覆盖后续 display head、失效 successor、原始结算身份和完整 source coverage,避免把空队列或 bounded display 当作 Goal 完成证明。

语义与 CI 对齐

这是有意收紧 enabled periodic recording,不要求兼容旧的绕过行为;off activation、非到期来源和已有持久化 reader 仍保留。新增 packet 的 before-settlement 是机器义务,grow/switch/verify 的质量、模型采纳和收益只是 Agent claim。复用了已有 typed vocabulary;development advisory 先于完整语义检查执行,未发现受支持的新命名集合,但其空结果不覆盖动态字面量或语义正确性。

独立本地结果:56 个 TS focused tests、control-plane typecheck、mypy 19 源文件、配置范围 Ruff、quick canary(含语义、I/O census、maintainability、边界)通过;native host/facade/completion/机器默认组合:40 passed in 384.00s (0:06:24);完整 successor 文件:30 passed in 345.99s (0:05:45)。真实 File/SQLite source 与 inherited terminal、实际 MCP on/off/device 对照均通过。

历史失败保留:0adc 的五文件套件是 126 pass / 1 facade fail,不能称为 e36 全套绿。该单测旧的完整参数预期漏了新转发的 false 字段;base 单测通过、旧 revised heads 失败、当前更新后的 facade 与完整 host suite 通过。按 wait_for_ci=false 未查询/轮询/等待 GitHub CI;远端状态不参与这次 review 结论。

我的整体评价

结论 APPROVE:完成当前“到期记录与一致入口”这个请求 slice,long_horizon 与 user_experience 均改善;不是宣布父 RFC 的模型采纳、全成本收益或 promotion 已完成。最大的未验证项就是那些 empirical acceptance,本评审没有用记录数、测试数或哈希替代它们。

机制规模与问题相称,最小有用修复需要同时挡住普通写回和 successor ACK。相关 future-facing pass 已应用:同一个 TS source rule、source-bound candidates、同源有效配置。Python 留在既有 registry/provider IO 适配层有明确归属,不需要无关语言重写。保留 historical stride v1/v2、ACK/journal reader 有真实持久化消费者;内部 transient candidate caller 同步升级,不再维护无实际消费者的旧 request decoder。

这是 author-owned 账户的 COMMENTED approval conclusion,不是 GitHub formal self-approval。需保持精确 head 与正常 maintainer merge gate;本次未合并,也未获得新的 merge/跨线程权限。

English verdict: APPROVE - e36a734; mandatory source-bound periodic recording and early effective-strategy preflight independently verified through actual File/SQLite CLI and MCP on/off/inherited controls, recovery and replay. Previous P1 findings and facade failure resolved; native/TS/static/quick checks pass. No merge or empirical utility claim.

@huangruiteng

Copy link
Copy Markdown
Collaborator Author

Maintainer merge decision for exact head e36a734209646f87cd975f8a68afe4b622eee3b8.

Motivation and outcome. Enabled periodic stride reviews are decision checkpoints. The TypeScript replan owner now requires an evidence-linked agent_vision.stride_decision tied to the admitted obligation and delivered context before typed progress, blocker, successor or terminal settlement. A terminal stop remains available when evidence supports it. The off strategy keeps its previous path, and the Host adapter rejects off-mode terminal stride input before Todo effects.

Changed surfaces. Typed stride/replan/Vision contracts; Python CLI/Host adapters; source-bound successor transition; English/Chinese protocol and RFC notes; focused tests and the registry-I/O manifest. Frontend and Lark entrypoints are unchanged because this is a settlement rule for an existing capability.

Validation. TypeScript focused 35/35 and control-plane typecheck passed. Python adjacent suites: 47/47 successor/effective-turn, 47/47 frontier rules, 17/17 Vision runtime, 17/17 Host Vision recovery, 4/4 MCP completion. Real File and SQLite CLI probes covered missing, foreign-obligation, foreign-context, valid, replay, and machine-inherited strategy cases. Ruff, semantic-inventory advisory, registry-I/O manifest check, diff check, and loopx canary premerge --from-git-diff --tier quick passed. The independent reviewer also ran host/facade/completion/machine-default 40/40 and successor/reentry 30/30. Optional mypy was not clean: a broad import-traversing probe found thousands of repository diagnostics, and a skip-imports probe reported 30 on touched modules without baseline attribution; it is not claimed as a pass. No live Goal was modified.

Risk and scope. Main risk is a changed settlement gate for existing due reviews. Negative real-backend probes verify refusal is atomic; legal off and enabled paths and one-time replay were checked. Existing TypeScript owner was reused; Python remains an adapter. This is a related future-facing refactor of successor ACK eligibility rather than another authority source. No unrelated migration, release, benchmark or frontend behavior is included.

Merge is authorized by the maintainer for this related PR batch after exact-head review. This comment records the decision evidence; it is not the reviewer verdict or a substitute for LoopX merge readiness.

@huangruiteng
huangruiteng merged commit 896fec6 into main Oct 13, 2026
25 of 27 checks passed
@huangruiteng
huangruiteng deleted the codex/stride-due-decision-gate branch October 13, 2026 11:26
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.

1 participant