Skip to content

test(monitor): restore Goal source before execution recovery - #6967

Merged
loopx-agent merged 1 commit into
mainfrom
codex/operations-monitor-restoration-20261021
Oct 20, 2026
Merged

loopx-agent merged 1 commit into
mainfrom
codex/operations-monitor-restoration-20261021

Conversation

@loopx-agent

Copy link
Copy Markdown
Collaborator

Monitor transport tests removed the registered Goal source to prove canonical lookup, then incorrectly expected normal execution to continue. Preserve the direct lookup with the source absent, require the CLI to reject execution without changing canonical Todos, restore the original empty Goal source and retry the same Turn before polling. This keeps recovery on the real admission path without a Markdown fallback for the 321 Todo records.

Validation: 41 tests across the complete monitor-target transport and monitor followthrough modules passed for File and SQLite, including oversized complete-record readback, missing-source refusal, same-Turn recovery and idempotent poll replay. The diff-selected premerge gate passed 5 direct checks and 10 control-plane canaries; focused Ruff and the public-boundary scan passed. Runtime code, transport limits and defaults are unchanged. No frontend or PostgreSQL implementation changes.

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; gpt-6.1-sol; OpenAI; runtime_reported; reasoning_effort=max

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

动机

维护监测功能的人运行大历史记录测试时,会被错误的恢复步骤挡住。原测试删除 Goal 原文后直接请求执行,因此两项用例失败;现在先验证拒绝执行,再恢复原文并沿同一 Turn 继续。已验证缺失原文时 Todo 不变,恢复原文后可继续监测,重复提交不产生第二次效果。本次只修复测试恢复路径,不改变运行时、传输上限、权限或用户操作流程。

Goal 原文提供执行所需的意图,canonical authority 保存 Todo 记录;能够直接读取后者,并不意味着前者缺失时也应获准执行。基线实际出现 2 项失败、17 项通过。放着不修会让这条集成路径始终停在 fixture 错误,无法验证后续监测写入与重放。

改动思路

保留“删除原文后直接读到完整记录”的原有证明,再调用现有 run_json_cli_result 验证拒绝执行与完整 Todo 数组不变。随后只恢复初始化前保存的空 Goal 原文,复用原 scope 中同一个 Turn,再走 should-run、monitor-poll 和 settled readback。原文没有 321 条 Todo,不能充当历史记录的 Markdown 回退来源。只提前恢复文件的更小补丁会丢掉这层反例,因此当前顺序有必要。生产侧选择器、健康门和状态写入 owner 均未修改。

具体改动

精确评审 head:316a9a6d01656b35836a322e076c0d43ead1eae6。唯一文件 tests/control_plane/test_monitor_target_transport.py 为测试与 fixture,增加 13 行、删除 1 行。test_real_large_authority_returns_complete_target 先保存原文,再在小 note 的 File/SQLite CLI 两个参数用例中增加缺失原文的反例与恢复步骤;其余超大 note、完整记录、重复目标、外来结果、错误传播和重放断言全部保留。run_json_cli_result 是现有 canary harness,不新增包装层或第二份状态 owner。

独立规范为 docs/development/good-smokes.md,版本 2b6d410。验收映射:Start With The Contract — implemented,真实 CLI 与 File/SQLite 状态边界仍被调用;Prefer Semantic Pressure — implemented,缺失原文须拒绝执行且不改变 Todo;Consolidate Without Losing Coverage — implemented,复用既有 helper 和参数化测试,保留大历史记录与 poll/replay 检查。检查了相邻 monitor 测试、smoke、文件最近五次变更及八个最近同账号 PR;#6960 修改其他恢复 fixture,没有覆盖本用例,未发现重复的同形提案。

对主干的风险

未发现阻塞问题。最强反例是恢复含 Todo 的 Markdown 后掩盖 canonical lookup 缺陷,或换一个 Turn 掩盖恢复问题;这里在源文件缺失期间完成直接读取,恢复的又是初始化前的空原文,并重用原 scope,避免这两种假阳性。缺失原文时还比较完整 canonical Todo 数组,阻止“拒绝但暗中改状态”的错误通过。

本 head 两个完整模块 41 项通过,覆盖真实 File/SQLite CLI、缺失原文拒绝、同 Turn 恢复、完整超大记录、generation=1、仅一次监测事件和零配额重复扣费。diff-selected premerge 的 5 个直接检查与 10 个控制面 canary、Ruff、公开边界扫描均通过,CQR 与当前 base/head 匹配。按生效策略 wait_for_ci=false,没有查询或等待 GitHub CI。旧失败记录保留,修复的是 fixture 恢复顺序。此变更不要求新的 UI 或 PostgreSQL 验证;也不能由这些测试推断所有平台或长程收益已经合格。

我的整体评价

这项复现缺陷的修复达到 goal_achieved,限于本 PR 的测试恢复任务。long_horizon=preserved:恢复后确实继续到持久化及幂等重放;user_experience=preserved:用户执行流程、权限与所需确认轮次保持原样。未来向整理已在本次应用为复用现有 helper;没有可证明值得加入的额外抽象。改动重用既有状态词汇,不引入新协议或默认值,回滚只需撤销测试提交。建议在精确 head 的评审、CQR 与合并就绪检查通过后合并。

English verdict: APPROVE — 316a9a6. The repaired fixture preserves source-absent canonical reads, fail-closed admission and same-Turn recovery without production changes. All 41 tests, 10 selected canaries, 5 direct checks, focused Ruff and public-boundary checks passed; no blocking finding. Coverage does not establish every backend/platform or a causal long-horizon benefit.

@loopx-agent
loopx-agent merged commit 46cdf19 into main Oct 20, 2026
23 of 34 checks passed
@loopx-agent
loopx-agent deleted the codex/operations-monitor-restoration-20261021 branch October 20, 2026 23:41
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