Skip to content

fix(replan): count only material monitor polls in periodic review - #5393

Merged
huangruiteng merged 4 commits into
loopx-project:mainfrom
LIHUA919:codex/replan-monitor-periodic
Oct 1, 2026
Merged

huangruiteng merged 4 commits into
loopx-project:mainfrom
LIHUA919:codex/replan-monitor-periodic

Conversation

@LIHUA919

@LIHUA919 LIHUA919 commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Twenty unchanged Monitor receipts were counted as material work for the periodic replan threshold. In a monitor-only lane, 20 quiet or unchanged polls could therefore demand a new semantic replan although neither the target nor the actionable frontier had changed. The shared typed history reducer now counts quota_monitor_poll toward that threshold only when its explicit material_change fact is true. Dead-Monitor repetition and persisted unchanged-streak checks still inspect their own poll evidence.

This branch incorporates current main at 3ad3269af; its earlier duplicate-import prerequisite was fixed independently on main, leaving this PR's net diff focused on the periodic rule, Python fact transport, regression tests and protocol documentation. Historical polls without a material-change fact are treated conservatively as nonmaterial for this one counter. CLI/status callers use the existing reducer, so no frontend or Lark companion change is needed.

Validation at signed head 6d9181f84: the formerly failing CLI base/head output differential passes; 21 Python replan-history and periodic-lookback tests pass; 41 focused TypeScript history/digest tests, control-plane typecheck, changed-Python Ruff and a six-path public-boundary scan pass. The full TypeScript control-plane run had 3581 passed, 31 PostgreSQL-configuration skips, 1 Host process-group assertion failure under full-suite load; that unrelated Host suite passed alone 4/4. Read-only replay of an observed 20-poll, no-change window produced periodic_review_due on unmodified base and no periodic obligation with this rule.

Remote CI and review must be read back for this exact head. This control-plane change remains for maintainer merge; it grants no new execution authority and does not close #5214.

Signed-off-by: Lihua <1017343802@qq.com>
Signed-off-by: Lihua <1017343802@qq.com>
@LIHUA919
LIHUA919 requested a review from huangruiteng as a code owner October 1, 2026 04:48
huangruiteng
huangruiteng previously approved these changes Oct 1, 2026

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

未发现阻断问题。评审固定于 head 348fd26,比较基线 b3879f9。

动机

周期复审应该衡量实质工作,而不是把静默监控回执当作方向推进。旧 reader 会把无变化的 quota_monitor_poll 计入 20 轮阈值,连续观察可能造成不必要的 replan。这个 PR 交付共享历史规则的有界修正,不宣称关闭整个长程协作路线图:静默观察不再推高周期计数,真实变化和独立的 Monitor 停滞检测仍保留。

改动思路

沿用现有 native monitor-poll writer 的 monitor_event.material_change 布尔事实,经 Python 历史 codec 送入既有 TypeScript history owner;不从 mode 或描述文字猜测实质变化,不新增 Python 决策源。先完成 agent/ACK 窗口,再排除非实质监控,最后按逻辑 Turn 去重。progress 与 Monitor 检测仍读取未过滤窗口。

具体改动

关键代码讲解

  • replan_history_codec.py 的 _run_fact(31 行):只把已有事件的 bool 投影为 material_change,旧记录缺失、null 或畸形值保留为 unknown;不改写历史回执。
  • replan_history.ts 的 decode(108 行):可选字段接受 bool/null,直接 wire 输入的非布尔值明确拒绝,避免字符串 true 或数字 1 获得实质变化资格。
  • periodicTrigger(215 行):只对精确 quota_monitor_poll 分类要求 material === true,并在 distinctTurns 前过滤。否则同一 Turn 的静默重试可能抢占真正工作的身份;普通工作仍正常计数。

另删除 task_lease_workspace.ts 的重复 digest import,保留原有效导入。实测旧基线真实 Python→TS 入口因 Identifier BARE_SHA256_PATTERN already declared 无法启动;第一提交仅移除这一重复 import。总计 7 文件 +55/-5,没有新模块、手工状态或权限模型。

对主干的风险

重点检查了反方向风险:不能因为排除静默观察而漏掉真实变化,也不能关闭六次已执行 dead-Monitor 或五次持久化无变化的检测。对原基线先记录真实启动失败,再用仅含 import 修复、计数策略仍与基线一致的不可变提交 2900cc2,和最终 head 执行同一组 21 个公共 Python→真实 Node 场景。20 quiet 由 periodic 变为无周期 obligation;19 work + true poll 仍是 20;ACK、peer ACK、重试、中性记账、旧记录、2000 个 peer 噪声和 display-limit 5/15 均符合合同。6000 个 quiet 之前的旧材料在完整输入的 snapshot transport 中仍可见。固定 quiet oracle 在旧策略明确失败,在 head 通过。

验证:24 项原生 Python 历史/真实 File、SQLite/transport 测试通过;聚焦 TS 24 项通过;完整 test:control-plane 为 3580 pass、31 个默认 PostgreSQL 环境用例 skip;typecheck、Ruff、mypy 通过。premerge 的 5 个直接检查和 19 个定向 canary 全过,exact-scope strict CQA valid。没有改存储或 PostgreSQL backend,所以环境跳过不冒充已验证,也不要求无关数据库迁移。按配置未查询、等待 GitHub CI。

语义与 CI 对齐

复用已有分类与 material_change 事实,不建立新词表;semantic advisory 未检出支持范围内新词表载体,完整语义 canary 通过。默认变化在 quota 文档与 Goal Vision/replan 合同披露;这是机器执行的 replan 条件,不是 guidance。旧材料标志缺失的 monitor 不计为实质变化,是明确的保守兼容选择。现有 lane 历史采集仍有 60 行预算:完整输入的 transport 验证不等于无限历史采集证明。

我的整体评价

APPROVE。长程运行减少无变化观察引起的虚假复审,用户不需要增加配置或重复确认;既有 CLI/frontend/Lark 消费同样的 obligation 结构,没有新增 editor 或界面旅程。只读 reducer 和 ACK/lane 权限边界保持,既不扩大授权,也不靠绿色测试推断 acceptance。前瞻简化检查已落实到重复 import 的删除;保留单一 TS owner 与直接条件比增加版本分支或新 helper 更合适。剩余边界是历史未知材料、已有采集预算、未运行 PostgreSQL 环境和长期 fleet soak;它们没有被包装成此切片的完成证明。此为评审批准,运行时 PR 仍留给 maintainer 合并。

English verdict: APPROVE

Signed-off-by: Lihua <1017343802@qq.com>
@huangruiteng
huangruiteng merged commit db3672f into loopx-project:main Oct 1, 2026
29 checks passed
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.

[Task][RFC]: Complete the research exploration control-plane contract

2 participants