Repository navigation
fix(stride): preserve effective configuration in edits and replan readback - #6377
Conversation
Signed-off-by: song <liusongstep@gmail.com>
Signed-off-by: song <liusongstep@gmail.com>
…guration Signed-off-by: song <liusongstep@gmail.com>
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent — gpt-6-astra, OpenAI; runtime_reported; reasoning_effort=high.
动机
使用 Goal 复盘配置的用户和继承机器策略的 Agent 会遇到两处来源不一致。机器周期为 3 时,只编辑策略再从 JSON 返回表单会把周期写成 6;机器启用 stride 时,领取后续 Todo 又可能把尚未记录策略决定的周期复盘显示为已结算。修复后编辑器保留生效周期,治理入口也按生效策略判断复盘是否仍待处理。本 PR 不改变策略算法、周期计数器或评测协议,也不证明长程研究收益。
改动思路
复用现有配置解析器和 TypeScript 复盘规则,比增加一个策略状态或专用开关更合适。CLI 与 HTTP 入口注入同一个只读配置适配器,控制层在既有 Goal/运行时保护范围内按需解析一次;真实决策仍交给既有 replan owner。历史回执查找不依赖当前配置可用性。前端只给缺失的周期字段补入当前有效值,明确填写的值优先,省略策略仍保留既有 off 语义。
两项修复都发生在既有配置来源接入处,无须增加持久状态或另建决策 owner。当前边界是修正编辑和治理回读;稀疏策略覆盖的持久化仍属于 #6370。
具体改动
依据 docs/reference/protocols/goal-vision-replan-contract-v0.md,固定版本 b77f63495f2619237380755178c0780ae10a0f26,逐项核对:
- Configure and roll back the stride strategy:已实现。打包界面走 JSON → 表单 → 预览 → 应用,再独立 HTTP 回读,机器周期 3 得到保留;显式修改、清除覆盖、非法预览、旧 Todo 单位、窄屏键盘与英文界面也经现有场景验证。当前完整覆盖语义不变,没有把 #6370 的稀疏覆盖提前宣称交付。
- Structured stride control:已实现本次来源接入修复。真实 File/SQLite 的 configure → propose → commit → adopt → claim 中,机器策略开启且没有决定时仍为 pending;关闭时保留原 successor settlement。既有历史内容未被重写。
- History compatibility:已实现。当前配置读取抛出异常时,原 operation 的历史回执仍能读取;历史事实不重新按当前策略解释。
- Research utility:本次范围外。结构义务正确、配置可用不等于模型采用了有效路线,更不等于得分或效率提升。
关键代码讲解
replanCadenceEditorDefaults(apps/presentation/dashboard/src/data/capability-configuration.ts:65)只覆盖缺失字段的默认来源,沿用旧单位转换,不自动继承策略来激活旧覆盖。goalWriteDraft与useCapabilityMutation.changeJson/changeMode(goal-capability-settings.tsx:39,149,162)让预览写入与两种编辑模式使用相同周期来源;未知 JSON 字段仍由既有解析器拒绝。execute_goal_amendment(loopx/control_plane/goals/goal_amendment_runtime.py:56)延迟解析有效配置,复用一次读取结果交给_replan_readback;所有 CLI/HTTP 生产调用点均传入现有 resolver,receipt 冷路径不调用它。- 回归测试覆盖真实 CLI 的两种存储和 machine on/off;浏览器增量覆盖实际配置 handler。registry I/O manifest 只更新行号,截图使用合成数据,无状态模型或协议枚举新增。
对主干的风险
主要风险是错误扩大强制复盘范围、关闭后仍被策略阻塞,以及让历史回执受当前配置故障影响。45 项真实 CLI/HTTP 测试通过,覆盖两种存储、重试、旧 Goal 隔离、非法 scope/origin 和存储不可用;其中部分配置 API 通用测试使用既有 mock,关键机器继承与历史回执用真实 owner。恢复旧的 raw-goal 策略读取后,两条 machine-on 测试均错误返回 settled 并失败,而两条 off 测试仍通过;恢复准确 head 后 4 条再次通过。这证明测试能识别本 PR 修复的缺陷。
另将 Goal 编辑器切回固定 baseline 实现,使用同一个打包浏览器场景,确实在 JSON→表单的有效周期断言失败;恢复准确 head 后重新构建通过。打包浏览器 replan-cadence 场景、前端 projection smoke、Dashboard 类型检查与构建、控制面类型检查、Ruff、语义检查、公开边界检查和 CLI 输出比较均通过。首次 pytest 命令使用了错误的测试路径,未运行用例;改正后完整 45 项通过。预合并首次语义检查因独立工作目录缺少根目录 TypeScript 依赖而失败,安装依赖后单独复验通过;其他预合并检查通过,没有降低预算或删除断言。没有查询或等待 hosted CI。
语义与 CI 对齐
复用既有 stride、cadence、pending/settled 词表和 typed owner;没有新增共享语义。合并前主干在此次直接修改的生产边界没有新差异。#6370 仍是独立未合并工作,后续合并它需处理编辑器交叉改动;此次未继承作者对该组合的验证结论。实际已安装 App、模型行为和长期收益未验证,不作为此修复的交付声明。
我的整体评价
APPROVE,准确 head 为 91681eb5ba99ea8b263d8afb6637fa1666aecaed。long_horizon 的改善是避免尚欠策略决定时提前把复盘投影为结束;user_experience 的改善是编辑模式切换不再悄悄改变复盘周期。两者均有实际路径证据,不能外推为实验成绩收益。
两项修复都发生在既有配置来源接入处,无须增加持久状态或另建决策 owner。当前边界是修正编辑和治理回读;稀疏策略覆盖的持久化仍属于 #6370。相关简化已体现在共享 resolver、一次解析和历史冷路径隔离,继续抽象没有明确收益。按维护者本次授权,在精确 head 的合并就绪检查通过后可合并。
English verdict: APPROVE - 91681eb preserves effective cadence and inherited stride obligations; real File/SQLite CLI and HTTP, packaged configuration journey, on/off regression mutation and restored-head validation passed. Research utility and installed-App adoption are not claimed.
Goal And Delivered Outcome
Two existing stride paths used the wrong configuration source. With a machine review interval of 3, editing only the strategy in JSON and returning to the form substituted the product default of 6. Separately, a machine-enabled periodic review could appear settled after a governed successor was claimed even though no stride decision had been recorded.
The editor now fills omitted interval fields from the effective configuration. Governed replan readback uses the existing effective strategy resolver, so inherited activation keeps a periodic review pending until its decision is recorded. Explicit interval edits and strategy-off behavior retain their existing meaning.
Related to #6370 and merged #6372. Base:
main. This is a repair of existing authoring/readback paths; sparse strategy-only persistence remains the scope of #6370.Author Declaration
docs/reference/protocols/goal-vision-replan-contract-v0.mdand Stride RFC §7.6 atb77f63495f2619237380755178c0780ae10a0f26.replanCadenceEditorDefaults, existing Goal editorexecute_goal_amendment→ existing TS replan ownerSelf-check: traced both production callers, reproduced the defects, exercised the owning real paths, inspected the complete diff and public-safe visual evidence. The related simplification resolves effective strategy once inside the guarded operation. CLI/HTTP supply the existing read adapter; the control layer retains the TS rule without depending on capability configuration modules. No provider promotion or new timer is introduced.
Scope And Integration
On current main, the frontend continues authoring the supported complete review configuration, using interval 3 rather than manufacturing interval 6. A separate composition check with exact #6370 head
6c8f55558771fb503cca71d56752198372c88e99confirms that JSON→form preserves sparse{stride_strategy}persistence and effective count 3. The overlapping editor changes need normal integration with that PR; its commits are not included here.The configuration reader is an internal, co-deployed adapter supplied by the existing CLI and HTTP entrances. It resolves once, when a current review observation is actually needed, under the current Goal/runtime guards; historical receipt lookup does not invoke it even if current configuration is unavailable; it is not a caller-authored strategy value or a new persisted contract. Current source history and historical receipts remain intact. Reverting this patch restores the prior behavior without a data migration.
Validation
test_goal_amendment_authority.py,test_chat_goal_configuration_api.py,test_chat_goal_amendment.py; disposable canonical File/SQLite and real CLI/HTTP. Node 22.22.3, embedded SQLite 3.51.3; no skipped testssettledwith no decision. New on/off regression keeps enabled review pending and preserves off settlement; history bytes unchangedreplan-cadencebrowser scenario with real revision-checked configuration handlers; JSON/form, invalid preview, apply/clear, narrow keyboard and English readback. Workspace discovery is syntheticValidation history: the first new regression had a misplaced tail from an adjacent test; its scope was corrected before the final 45-test run. An initial direct capability import failed the architecture ratchet and was replaced by the existing outer read-adapter boundary. The first CLI-budget run compared against stale
origin/main; the same unchanged matrix passes with the real immutable base. No budget was raised or decision text removed.This establishes source and packaged behavior. Hosted CI, installed App behavior and live-model adoption remain separate.
Frontend / Visual Evidence
Type / Area / Direction
Boundary Checklist
uv.lockexcluded.