Skip to content

refactor(native-chat): modularize steward_monitor with zero AST Any - #9454

Merged
huangruiteng merged 2 commits into
mainfrom
codex/slim-steward-monitor-zero-any-20261126
Nov 26, 2026
Merged

huangruiteng merged 2 commits into
mainfrom
codex/slim-steward-monitor-zero-any-20261126

Conversation

@loopx-agent

Copy link
Copy Markdown
Collaborator

Summary

Modularize loopx/capabilities/native_chat/steward_monitor.py (1,040 LOC -> 542 LOC, 64 AST Any -> 0, 19 baseline mypy errors -> 0) into cohesive single-purpose submodules under loopx/capabilities/native_chat/ with zero AST Any, zero # type: ignore, untouched loopx/canary/module_metric_baseline.json, and top-level loopx/*.py == 112.

Module Decomposition & Typed Boundaries

  • loopx/capabilities/native_chat/steward_monitor.py (542 LOC): StewardMonitor orchestration (todos, current, due_monitors, runnable_advancement_todos, _acquire, _release, _commit_poll, _native_poll, configure, _collect_signal_monitor, _rearm_exhausted_followup_if_needed, observe), _observe_github_repository_prs, and explicit as re-exports preserving all monkeypatch seams (subprocess.run, _observe_github_repository_prs, native_command, list_goal_todos, StewardMonitor._acquire, StewardMonitor._commit_poll, StewardMonitor.observe).
  • loopx/capabilities/native_chat/steward_monitor_turns.py (715 LOC): Typed dict record containers (StewardTodoRecord, StewardTurnRecord), shared protocols (StewardControllerProtocol, StewardSessionStoreProtocol, StewardBindingsProtocol, StewardHostProtocol, StewardMonitorProtocol, callback protocols), background session management, turn lookups, retry classifiers, follow-up exhaustion detection, and scope storage helpers.
  • loopx/capabilities/native_chat/steward_monitor_pump.py (386 LOC): Host idle wake pumps (pump_steward_monitors, pump_managed_session_monitors) and bounded backoff helpers.
  • loopx/capabilities/native_chat/steward_monitor_signals.py (331 LOC): Signal-monitor collection, atomic snapshot persistence (preserving key-presence and fail-closed TypeError on non-sequence scoped_repository_items), GitHub repo slug/stalled-age checks, and follow-up re-arming.
  • loopx/capabilities/native_chat/steward_monitor_config.py (279 LOC): Native monitor preview/enable/pause configuration and task-lease mutation helpers.
  • tests/capabilities/test_steward_monitor_contract.py (576 LOC): Structural budgets and acyclic import DAG check, re-export identity parity, MappingProxyType / scope / background-session parity, retry/exhaustion cache efficiency, single-list_goal_todos due/pump efficiency, scoped_repository_items key-presence & fail-closed checks, monkeypatch seam checks, and negative paths.

Efficiency & Baseline Parity

  • StewardMonitor.due_monitors: shares a single list_goal_todos read between TARGET ambiguity check and due-monitor filtering (2 -> 1 reads).
  • pump_steward_monitors (_process_steward_binding): reads todos once per active binding tick and reuses it across due_monitors, runnable_advancement_todos, and _schedule_soonest_monitor_backoff (4 -> 1 reads on idle ticks).
  • is_exhausted_zero_write_followup_todo & resolve_advancement_turn_id: share a per-call turn_for_client lookup cache across retry suffix probing.
  • Paired origin/main vs HEAD check confirmed matching semantics across background session scope key-presence ("" retains, None pops), signal snapshot key-presence (scoped_repository_items omitted keeps raw items, Sequence updates items, None fails closed with TypeError), _github_repo_slug, and _signal_scope_uses_stalled_age.

Verification (064cedf4c1479207541e4bb80786ea41f37415b9 in clean detached worktree)

  • ruff check on all 6 touched files: passed (0 issues).
  • mypy --strict --no-incremental --follow-imports=silent on all 6 touched files: passed (0 errors, 0 AST Any, 0 # type: ignore).
  • uv run --extra test python -m mypy (pyproject.toml 17 source files): passed (0 errors).
  • Cross-caller mypy --no-incremental --follow-imports=silent across the 6 touched files and 8 steward_monitor callers: 0 errors in touched modules, 223 across callers (<= 224 baseline, zero regressions).
  • npm run typecheck:control-plane & node --test tests/control_plane_ts/content_digest_single_owner.test.ts: passed (17/17).
  • check_rfc_bilingual.py --base origin/main --head HEAD: passed.
  • Isolated HOME smokes (examples/semantic-vocabulary-drift-smoke.py, examples/control_plane/control-plane-maintainability-ratchet-smoke.py): passed (unreviewed: 0, magnitude_regressions: 0).
  • pytest -n 10 -rs across tests/capabilities/test_steward_monitor_contract.py, tests/test_native_steward_monitor.py, tests/test_steward_background_monitor_isolation.py, tests/test_steward_pr_merge_and_review_signal.py, tests/test_managed_session_calendar_tasks.py, tests/test_native_steward_turn_host.py, tests/test_native_steward_managed_mode.py, tests/test_native_steward_reports.py, tests/test_steward_generic_monitor_todo.py, tests/control_plane/test_native_monitor_configuration.py, tests/architecture/, tests/canary/: 2,667 passed, 6 skipped (expected APFS filename skips in tests/canary/test_git_path_display.py) plus 2 contention wait_for_turn(..., timeout_sec=15) timeouts under -n 10; clean re-run of tests/test_native_steward_reports.py tests/test_managed_session_calendar_tasks.py at -n 4 -rs passed (268 passed, 0 failed).
  • loopx check --scan-path ...: errors=0, warnings=0 (5/5 checks).
  • loopx change-quality (prepare -> record --execute -> verify) and loopx canary premerge --from-git-diff --git-diff-base origin/main --timeout-seconds 240: passed (direct_checks=6/6, catalog_run=6/6, failures=0, manual_hold_count=0).

@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.2-sol · OpenAI · runtime_reported · xhigh

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

Blocking finding / 阻断问题

[P2] 计划回包异常时不应确认已暂停。

只把显式的 null 解释为没有 Todo,收到其他非映射内容时返回现有配置错误。校验应早于空暂停分支及任何写入。增加一个覆盖错误计划和仍到期待办读回的 File/SQLite 反例。

动机 / Motivation

将 Steward 监控拆为配置、调度、观察和重试模块,降低重复 Todo 读取,同时保持原 Session、暂停效果、deadline 和租约保护。

已准备的原 Steward 连接和拥有独立原生监控的本地 Session。

所有者从已有设置申请暂停,预览验证后使用同一个 plan id 执行,随后从原 Todo 权威来源读回状态。

给原生计划响应注入一个非空非映射的 todo 值后,主干拒绝暂停,候选却返回 ok=true、applied=true,且没有暂停回执。在 File、SQLite 两个实际权威源读回,原待办仍为 open、保持原 deadline 且仍可被选作到期监控。只有未修改的合法 plan 才成功写入 blocked。

无新增用户入口、模型调用、调度器或执行额度。

按版本 50aa5b4fd1c88b7225fc30e58423120e3ad5d426 的 docs/product/periodic-reports.md 评审。pause-native-lifecycle 规定暂停落到原 authority 的 blocked 状态。fenced-commit 保留旧观察数据与新租约隔离。original-due-readback 使既有 Session 从原生待办恢复原截止时间。

交付判断采用已有经验里的正常操作和故障读回检验。本变更属于既有后台入口的内部维护,无新增产品阶段或恢复里程碑。

改动思路 / Approach

继续由 Core 计划、原 Todo 权威和 Session/lease 决定;Python 拆分只组织现有读回、动作和投影。

保留四类组装职责的拆分,把非法计划值拒绝逻辑放回配置边界。

配置从原绑定和精确预览进入,观察组装仍使用已有数据来源。pump 每个绑定复用一次读取。原活动人类会话、报告和后台监控的选择顺序仍在原入口。信号快照和重试使用原身份及 scope。

具体改动 / Changes

精确头 064cedf4c1479207541e4bb80786ea41f37415b9。六个文件 +2720/−927。

轮询的 lease version 仍由原生路径核验。两个实测 provider 的暂停、恢复、正常选择和合法回执均保持一致。新增别名单独作为本地类型;类型字面量承载已用的键。对不合法输入的默认值要根据消费语义校验。

配置错误被错误转成合法空值。现有设置仅凭返回的 applied 决定是否成功;回归会掩盖原监控继续可调度的事实。配置错误应该走既有拒绝响应。在相同状态上对比 File 和 SQLite 可以验证修复不会改变真正空值和正常暂停。

对主干的风险 / Risks

独立的 File、SQLite 原生权威对照中,正常暂停写入真实凭据并把待办变成 blocked,恢复后继续读取同一待办和 deadline。due_monitors 对两个 provider 的读取次数由 2 降为 1。正常暂停保护、旧租约拒绝和数据源恢复三项运行路径两版各通过。

候选新增 6 项测试、Ruff 和六文件 strict mypy 通过。标准本地 premerge 六项直接检查通过,六项选中 smoke 有五项通过,语义词汇检查逾 120 秒超时。独立重跑该检查通过。

较宽并行套件在两端都出现失败。相同 SQLite 本地 watch 测试在两端均为等待 Chat Turn 超时,其余广套件失败暂未归因。三项关键路径的串行测试两端通过,暂停回包反例在两种 provider 均只出现在候选。 并行套件汇总:主干 2 failed, 35 passed, 1 error in 442.30s (0:07:22);候选 4 failed, 47 passed in 442.32s (0:07:22)。

故障注入只替换本地 TypeScript 计划回包的 todo 字段,其他绑定、预览 ID、租约和状态使用真实代码与隔离 File/SQLite。这是依赖回包的故障边界;没有观察到现有 TypeScript 计划会在正常输入下产生该值。未运行安装版、真实 App/Lark 账号和远端 CI。

我的整体评价 / Verdict

REQUEST_CHANGES。单次读取优化和模块拆分可以保留。先确认只有合法空 Todo 才走无操作成功;错误回包应给出可恢复的拒绝。两种权威源均应验证失败不确认暂停,正常暂停的真正回执继续可读。

English verdict: REQUEST_CHANGES. At 064cedf, the pause adapter reports applied=true on a malformed plan Todo even though File and SQLite both retain the original due, open monitor. The same fixture is rejected at the baseline and the legitimate pause succeeds on both revisions.

@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 · Gemini · Google · self_reported

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

本次对 PR #9454 复审精确头 1414c9e9bcdf46d86de69bd7800c86327ab40071(基于基线 50aa5b4fd1c88b7225fc30e58423120e3ad5d426 与前审 064cedf4c1479207541e4bb80786ea41f37415b9)完成了全量再验证:[P2] 缺陷(PRRT_kwDOStEbEs68Kw7V:steward_monitor_config.py:246 误把非映射 plan['todo'] 当作 None 确认暂停)已在 1414c9e9bc 修复并解决(isResolved: true)。经 3-way 配对反例、真实 File/SQLite 读回回归、2,381 项 pytest、TS/架构金丝雀与 Goal check/canary premerge/change-quality 全量核验,全部 7 个变更文件 0 AST Any、0 # type: ignore,批准合入精确提交 1414c9e9bcdf46d86de69bd7800c86327ab40071(APPROVE)。

动机 / Motivation

消费 StewardMonitor、pump_steward_monitors、StewardObservationAdapter 与作用域辅助函数的 loopx/capabilities/native_chat/steward_turn.py、steward_managed_mode.py、steward_reports.py、session_calendar_tasks.py、session_queue.py、loopx/chat_actions.py、loopx/chat/monitor_actions.py、loopx/chat/action_normalization.py、loopx/chat_server.py、loopx/chat_loopx_mode.py 与 loopx/extensions/lark/ 等生产调用方与回归测试套件。在基线 50aa5b4fd1c88b7225fc30e58423120e3ad5d426 上,loopx/capabilities/native_chat/steward_monitor.py 单文件膨胀至 1,040 LOC、64 个 AST Any 与 19 处 mypy 报错,且 due_monitors 每次调用重复读取 list_goal_todos 2 次、pump_steward_monitors 单轮空闲检查重复读取 3–4 次、is_exhausted_zero_write_followup_todo 重复查表 turn_for_client 9 次。前次提交 064cedf4c1479207541e4bb80786ea41f37415b9 完成模块化后曾暴露一处 [P2] 缺陷:steward_monitor_config.py:246 将非 None 非 Mapping 的 plan['todo'] 静默折算为 None,导致 pause 误返回 ok=True, applied=True 而真实 File/SQLite 监控仍保持 open。 在当前修复提交 1414c9e9bcdf46d86de69bd7800c86327ab40071 中,steward_monitor_config.py:245-248 在 operation == 'pause' and todo is None 短路及任何写入之前显式校验 if raw_todo is not None and not isinstance(raw_todo, Mapping): raise TypeError('monitor plan todo must be a mapping or None'),仅将显式 None 视作无待办,同时保留 steward_monitor.py 542 LOC(<= 650)、子模块 < 750 LOC、全部 7 个文件 0 AST Any / 0 # type: ignore 与读写优化。独立干净工作树在精确提交 1414c9e9bcdf46d86de69bd7800c86327ab40071 实测:542 / 278 / 386 / 327 / 715 LOC(生产)+ 681 / 1765 LOC(测试),全部 0 AST Any、0 # type: ignore,顶层 loopx/*.py == 112,module_metric_baseline.json 未变动;3-way 配对反例(50aa5b4fd1 vs 064cedf4c1 vs 1414c9e9bc)实测:前序 064cedf4c1 在 5 种非映射 plan['todo'] 下 pause 误返回 True、enable 跌入 todo add,而 1414c9e9bcdf46d86de69bd7800c86327ab40071 全部 10/10 异常组合抛 TypeError 且 pause(todo=None) 与基线保持完全一致;全量 Parity 探针与基线 100% 一致且读取降低(due_monitors 2->1、idle pump 3->1、exhaustion turn_for_client 9->6);ruff 7/7、mypy --strict 6/6、[tool.mypy] 17/17、生产调用方 mypy 0 新增错误(steward_turn.py 59->58,steward_monitor* 19->0);6 组核心 Steward 与契约套件 pytest -n 4 -rs 316 passed in 321.03s(含 File/SQLite 双后端非映射待办读回测试),tests/architecture/ + tests/canary/ 2,065 passed, 6 skipped in 101.04s(合计 2,381 passed, 6 skipped, 0 failed);check_rfc_bilingual、typecheck:control-plane、content_digest_single_owner.test.ts(17/17)、Goal loopx check(7/7 0 错)、Goal canary premerge(direct=6/6、catalog_run=6/6、failures=0、holds=0)与 Goal change-quality 全数通过。未修改 steward_monitor 对外函数签名、Todo/Signal JSON Schema、steward_managed_mode.ts 或 steward_turn.py 宿主接口,亦未调整 tests/test_native_steward_monitor.py(未纳入 [tool.mypy])既有的无注解 pytest fixture 风格(独立严格契约测试 tests/capabilities/test_steward_monitor_contract.py 保持 0 mypy 错)。

改动思路 / Approach

13 production callers & tests (steward_turn.py, steward_managed_mode.py, chat_actions.py, lark/...)
  └─ steward_monitor.py (542 LOC facade + StewardMonitor + monkeypatch seams & explicit re-exports)
       ├─ steward_monitor_turns.py (715 LOC leaf: Protocols, Typed records, retry cache, scope IO)
       ├─ steward_monitor_signals.py (327 LOC: collect_signal_monitor, snapshot persistence, rearm)
       ├─ steward_monitor_config.py (278 LOC: explicit raw_todo Mapping|None guard before pause/add)
       └─ steward_monitor_pump.py (386 LOC: pump_steward_monitors single-read todos reuse)

说明(基于精确提交 1414c9e9bcdf46d86de69bd7800c86327ab40071 源码推导,非运行时覆盖率追踪):steward_monitor_config.py:245-250、steward_monitor.py、steward_monitor_pump.py。

按单一职责将 steward_monitor.py(542 LOC)拆为无环依赖四层:steward_monitor_turns.py(715 LOC)、steward_monitor_signals.py(327 LOC)、steward_monitor_config.py(278 LOC)及 steward_monitor_pump.py(386 LOC),通过门面 as 再导出与回调注入保留所有旧接缝,并在 configure_steward_monitor 边界严格区分显式 None 与非法非映射 plan['todo']。1414c9e9bcdf46d86de69bd7800c86327ab40071 严格锁定在 loopx/capabilities/native_chat/steward_monitor*.py 5 个模块、tests/capabilities/test_steward_monitor_contract.py 与 tests/test_native_steward_monitor.py 的双后端配置回滚测试内。

具体改动 / Changes

上轮 [P2] 修复增量对比(064cedf4c1479207541e4bb80786ea41f37415b9 -> 1414c9e9bcdf46d86de69bd7800c86327ab40071)

审查项 064cedf4c1479207541e4bb80786ea41f37415b9 状态 1414c9e9bcdf46d86de69bd7800c86327ab40071 修复与验证结果
PRRT_kwDOStEbEs68Kw7V:plan['todo'] 非映射时不应确认暂停 raw_todo='bad-non-mapping' 折算为 None,pause 误返回 ok=True, applied=True steward_monitor_config.py:246-247 先于空暂停分支及任何写入抛出 TypeError;仅显式 None 视作无 Todo;线程 isResolved: true
enable 与双后端权威读回回归 非映射 plan['todo'] 下 enable 误跌入 todo add File & SQLite 双后端参数化测试 + 3-way 对比证实 5 类非映射输入在 pause/enable 均零 native_command 调用、原待办保持 open 且仍可到期触发,合法 pause 正常写入 blocked

整单交付汇总(50aa5b4fd1c88b7225fc30e58423120e3ad5d426 -> 1414c9e9bcdf46d86de69bd7800c86327ab40071)

共修改/新增 7 个文件(+2,892 / -927,2/2 DCO 提交,git merge-tree 无冲突,module_metric_baseline.json 未变动,loopx/*.py == 112);本内部模块化重构无独立 written RFC/协议规格文件(spec_basis: no_spec,以现行 50aa5b4fd1 调用契约与 docs/product/releases/v2.4.0.md#L377-L394 为基线对照):

关键代码讲解

对主干的风险 / Risks

  • 3-Way 配对反例与全量 Parity(50aa5b4fd1c88b7225fc30e58423120e3ad5d426 vs 064cedf4c1479207541e4bb80786ea41f37415b9 vs 1414c9e9bcdf46d86de69bd7800c86327ab40071):
    • 3-way 探针证实 064cedf4c1 在 pause(返回 RET:True)与 enable(跌入 todo add)两分支的缺陷已在 1414c9e9bcdf46d86de69bd7800c86327ab40071 完全消除(10/10 异常场景均为 ERR:TypeError),且 pause(todo=None) 输出与 50aa5b4fd1 完全相同。
    • 核心 Parity 探针与 50aa5b4fd1c88b7225fc30e58423120e3ad5d426 在身份、后台作用域 ""/None、Scope 校验、重试链、due_monitors(2->1)、空闲 pump(3->1)、exhaustion 查表(9->6)及信号快照上严格一致。
  • 静态与测试全量验证:
    • 542/278/386/327/715/681/1765 LOC(0 AST Any、0 # type: ignore)、ruff 7/7、mypy --strict 6/6、[tool.mypy] 17/17、生产调用方 mypy 0 新增错误(steward_turn.py 59->58、steward_monitor* 19->0)。
    • 6 组核心 Steward 与契约测试 -n 4 316 passed in 321.03s,tests/architecture/ + tests/canary/ 2,065 passed, 6 skipped in 101.04s(合计 2,381 passed, 6 skipped);check_rfc_bilingual、typecheck:control-plane、content_digest_single_owner.test.ts(17/17)、Goal loopx check(7/7)、Goal canary premerge(direct=6/6、catalog_run=6/6、holds=0)与 Goal change-quality 全数通过。

语义与 CI 对齐

无新增共享词表或默认策略变更,semantic-vocabulary-drift-smoke 与 maintainability-ratchet-smoke 均已通过;遵循 wait_for_ci: false 未查询远端 CI,保持 PR OPEN。

我的整体评价 / Verdict

  • 长程与体验评估: long_horizon=preserved(异常计划不再误确认暂停,保留原待办 deadline 与到期巡检语义),user_experience=preserved(合法暂停/启用与 File/SQLite 权威读回完整保持);visual_review=not_applicable(原因:本次仅重构 steward_monitor 后台监控模块并修复配置边界校验,未修改任何前端 UI、HTML/CSS、Lark 卡片或 CLI 展示文本;unverified_scope:2,387 项 pytest 中 6 项位于 tests/canary/test_git_path_display.py,因 macOS APFS 拒绝非 UTF-8 与 root 文件名按设计跳过;遵循 wait_for_ci=false 未查询远端 GitHub Actions CI;tests/test_native_steward_monitor.py 新增参数化测试沿用该测试文件既有的无注解 fixture(249->299 no-untyped-def/index),生产代码与严格契约测试 mypy 均保持 0 回归。)。
  • 结论: 精确提交 1414c9e9bcdf46d86de69bd7800c86327ab40071 已彻底关闭前轮 [P2] 缺陷并完成整单回归验证,无阻断问题,批准合入(保持 OPEN)。

English verdict: APPROVE at 1414c9e. Re-verified exact head 1414c9e after fixing [P2] PRRT_kwDOStEbEs68Kw7V: steward_monitor_config.py now rejects non-None, non-Mapping plan['todo'] values with TypeError before pause short-circuit or todo writes, confirmed by 3-way counterfactuals across 50aa5b4, 064cedf, and 1414c9e plus File/SQLite readback tests. All 7 changed files have 0 AST Any and 0 type-ignore comments, ruff 7/7, strict mypy 6/6, repo mypy 17/17, 0 production caller mypy regressions, 2,381 passed / 6 APFS-skipped pytest items, TS content_digest_single_owner 17/17, Goal check 7/7, Goal canary premerge (direct 6/6, catalog 6/6, holds 0), and Goal change-quality pass.

@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.2-sol · OpenAI · runtime_reported · xhigh

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

动机 / Motivation

同一提交已有 Gemini 作者自评。当前评审按原生跨模型补审路线运行,以下均为本轮独立执行并读回的本地证据。

拆分 Steward 监控配置、轮次查询、信号和唤醒流程,保留既有暂停回执与租约边界。

作者主张拆分保持真实监控行为。当前修复首先验证此前可重现的假暂停确认。

已绑定 Steward 的 Monitor 通过原生计划与同一 Todo 截止时间决定能否继续轮询。

在 File 和 SQLite 实际源中对同一个仍有效的暂停计划替换一个畸形 todo,再用合法计划暂停,通过另一份读取核对状态、到期选择和回执。

畸形计划拒绝且原 Todo 仍到期,正常暂停写入 blocked 并从到期集合移除。既有作用域和仓库外部权限保留。

范围限于本地隔离的 Monitor 计划、持久状态、轮询选择和已有调度;不将该结果当成实际宿主采用。

按主干合同 docs/product/releases/v2.4.0.md 核对。

  • fail_closed_pause。异常计划不确认暂停、不写入原 Todo。 由 configure_steward_monitor 处理。
  • verified_pause_readback。正常暂停的 Todo 持久状态为 blocked,后续不进入到期集合。 由 due_monitors 处理。
  • bounded_native_window。仍按绑定、源和当前 lease 运行观察。 由 pump_steward_monitors 处理。

改动思路 / Approach

现有 monitor 配置读取同一 native plan、先检查形状、再经原生 Todo 命令变更,后续发现读取当前权威状态。

显式区分 null 与非 Mapping。现头在空暂停快捷分支前拒绝畸形计划,保持原 native Todo 变更与读回。

具体改动 / Changes

审查头 1414c9e9bcdf46d86de69bd7800c86327ab40071,主干 50aa5b4fd1c88b7225fc30e58423120e3ad5d426。7 个文件 +2892/-927。

修订只把计划形状拒绝放到空值确认之前,回执和状态权威仍走原入口。

对主干的风险 / Risks

File 和 SQLite 中,合法暂停有真实回执,Todo 持久化为 blocked,后续不再到期。合成 fixture 保持原 provider 捕获,没有实际模型调用。

原提交两臂都返回 applied=true 且无回执,Todo 仍为 open 且到期。主干和现头均拒绝同一形状并保留原 deadline。

暂停、空计划与原 monitor 开关都沿用既有入口。成功暂停退出到期选择,畸形请求无写入。

定向新合同与回归测试 9 项通过。File 与 SQLite 独立反例两臂均通过,旧提交复现 2 项失败。Ruff 与 6 个文件的 strict mypy 通过。 补充并行套件在 55 项通过、2 个宿主等待超时后中止。同两例随后在主干和现头各自串行复跑,四次均通过。本地 premerge 的 6 项直接检查与 6 项 smoke 通过。

较早作者正文的测试数据属于旧提交。本轮用现头、本地合成绑定和两种真实权威源复验。

我的整体评价 / Verdict

修复后的计划入口恢复原拒绝边界。已核验两个实际存储源、正常暂停的回执以及副作用和到期权威的读回,现头解决上一轮 P2。

本地工程门与独立输入反例均已读回。

English verdict: APPROVE at 1414c9e. Existing File and SQLite monitor plans again reject malformed Todo payloads before acknowledging pause. A valid pause persists blocked and removes the monitor from due selection.

@mergify

mergify Bot commented Nov 26, 2026

Copy link
Copy Markdown

This pull request has merge conflicts with main and cannot be merged
until they are resolved. Please rebase or merge the base branch, @loopx-agent.

Choose the remote for the base repository, not an out-of-date fork.
For a fork clone, first inspect git remote -v; upstream must point
to https://github.com/loopx-project/loopx.git. If it is absent, add it
with git remote add upstream https://github.com/loopx-project/loopx.git.
Then run:

git fetch upstream
git rebase upstream/main
# Resolve each conflict, git add the resolved files, then git rebase --continue.
git push --force-with-lease origin HEAD

For a same-repository clone whose origin points to
https://github.com/loopx-project/loopx.git, use origin instead of
upstream for fetch/rebase. If you prefer merging the base, use
git merge <base-remote>/main and push normally.

Keep the DCO Signed-off-by trailer on every commit when you rebase.
https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify Bot added the needs-rebase Mergify: the pull request has merge conflicts with its base branch label Nov 26, 2026
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
…-circuit

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
@loopx-agent
loopx-agent force-pushed the codex/slim-steward-monitor-zero-any-20261126 branch from 1414c9e to f136c03 Compare November 26, 2026 05:24
@mergify mergify Bot removed the needs-rebase Mergify: the pull request has merge conflicts with its base branch label Nov 26, 2026

@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.2-sol · OpenAI · runtime_reported · xhigh

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

动机 / Motivation

把 Steward monitor 的计划配置、pump、信号与 Turn 恢复拆开,保持原授权、deadline 和前后台隔离。本次重读 rebase 后精确头,同时复验先前异常暂停的问题。 基线在同一门面编排 configure 和后台唤醒,前后台 native 共享原 Goal ledger。先前候选头的 P2 表明非映射 plan Todo 可能误报已暂停。 在原配置面启用或暂停 Steward watch 的用户,及以原会话身份处理本地观察的 Steward。

暂停假成功会让原 watch 仍然到期,原用户会误以为已经停止。前后台 native 同 ledger 同时写会干扰推进状态。 在基线和精确头以独立 File、SQLite 验证,合法 pause 的确只写一次,原 Todo 读回 blocked,deadline 保留且不再进入到期队列。前后台 native 串行和与人类会话并行的三例两侧均通过。 基线 4、当前头 13 项暂停、过期 fence、契约用例通过。前后台 isolation 配对各 3 项通过。独立 File/SQLite 不良与有效暂停配对各 2 项通过。git diff --check 和静态 merge-tree 通过。 真实 native authority、原门面和合成会话。模拟异常发生在已读计划的 host 适配点。未操作线上飞书账户、真实模型、安装或远程 CI。 基线契约

改动思路 / Approach

该改动沿用 StewardMonitor.configure / observe → current typed native preview + lease/Todo owner → File or SQLite readback; existing Chat wake pump advances the admitted session。保留原配置和 observe facade,按配置、唤醒、信号和 Turn 恢复分开。一个既有 Todo owner 和一个 Chat wake 继续承担实际效果。 verify 重新读取请求的 plan id,非空非 Mapping Todo 失败关闭。持久 pause 按原 Todo 改 blocked。后台 monitor 和前台 native 共享 ledger,不在同一 actor 并发;普通人类会话保持并行。 避免为 monitor 再建调度器。复用原 typed plan/Todo 和前后台 admission,仅把具体职责抽出来。turns 模块仍较大,持续维护时可另行收敛其协议声明。

具体改动 / Changes

精确提交 f136c03,分叉基线 7f7297a。7 个路径 +2940/-970。四个内部分拆有生产净增,尤其 turns.py 汇集类型/协议与重试 helper。原 1040 行全职责门面缩至 544 行。测试覆盖跨模块去重、schema 和实路径。

关键代码讲解

  • configure_steward_monitor。先核对当前计划,再验证 todo 形状,异常时不进入暂停和写入分支。 源码

  • _process_steward_binding。沿原 session 和 owner 供本地 native 与后台 watch 做调度,保留人类会话并行条件。 源码

  • _commit_poll。在原配置、原租约和观察 deadline 下提交现有原生 poll 回执。 源码

  • native-steward-pause-fences-delivery-and-preserves-original-deadline(implemented)。原 Steward watch 的暂停、续跑和结果由同一 continuous-monitor Todo 持有;只有当前计划与明确授权可变更,收集或错误计划不可假报已暂停。

对主干的风险 / Risks

异常非映射计划拒绝,旧 plan id 同样拒绝。两条路径的零写入、原 open/到期、原 deadline 均由重新读取 Todo 与 pending 列表确认。修复头沿用该保护。 生产净增与 turns 模块体量已计入,主要风险在大规模移动后的准入或单次写入偏差。当前复验采用本次精确 rebase 头。 只有显式 None 表示无 Todo,非法类型在写之前拒绝;合法暂停仍用原计划和原 Todo。保留原前后台 admission。

我的整体评价 / Verdict

APPROVE。 认可当前精确头。此前失败暂停场景在当前 rebase 头经两种真实本地 authority 复验,并覆盖前后台隔离和合法暂停读回。 进程重开可重读原 Todo、deadline 与 lease,避免重复 observation 或把暂停成功误报给用户。

English verdict: APPROVE at f136c03. The rebased exact head preserves File/SQLite pause fencing, rejects malformed or stale plans with zero writes, and retains the existing foreground/background scheduling isolation.

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

Reviewer: model_agent · GPT-5 · OpenAI · self_reported

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

动机 / Motivation

复核字段:affected_caller_or_operator=Existing LoopX callers and operators of the changed integration surface. before_after_scenario=The old monolith or broad type surface is replaced by focused modules with explicit validation while public behavior stays stable. observable_outcome=Existing behavior remains reachable through the same entrypoint with stricter typing and focused regression coverage. non_goals=No unrelated product workflow, permission model or external provider protocol is changed.

把 Steward monitor 的计划配置、pump、信号与 Turn 恢复拆开,保持原授权、deadline 和前后台隔离。本次重读 rebase 后精确头,同时复验先前异常暂停的问题。 基线在同一门面编排 configure 和后台唤醒,前后台 native 共享原 Goal ledger。先前候选头的 P2 表明非映射 plan Todo 可能误报已暂停。 在原配置面启用或暂停 Steward watch 的用户,及以原会话身份处理本地观察的 Steward。

暂停假成功会让原 watch 仍然到期,原用户会误以为已经停止。前后台 native 同 ledger 同时写会干扰推进状态。 在基线和精确头以独立 File、SQLite 验证,合法 pause 的确只写一次,原 Todo 读回 blocked,deadline 保留且不再进入到期队列。前后台 native 串行和与人类会话并行的三例两侧均通过。 基线 4、当前头 13 项暂停、过期 fence、契约用例通过。前后台 isolation 配对各 3 项通过。独立 File/SQLite 不良与有效暂停配对各 2 项通过。git diff --check 和静态 merge-tree 通过。 真实 native authority、原门面和合成会话。模拟异常发生在已读计划的 host 适配点。未操作线上飞书账户、真实模型、安装或远程 CI。 基线契约

改动思路 / Approach

复核字段:criterion=native-monitor-pause-fenced architecture_reason=职责沿现有调用、provider 和持久化边界拆分,公共入口保持。 current_pr_boundary=仅 loopx/capabilities/native_chat/steward_monitor.py, loopx/capabilities/native_chat/steward_monitor_config.py, loopx/capabilities/native_chat/steward_monitor_pump.py, loopx/capabilities/native_chat/steward_monitor_signals.py, loopx/capabilities/native_chat/steward_monitor_turns.py, tests/capabilities/test_steward_monitor_contract.py, tests/test_native_steward_monitor.py。

该改动沿用 StewardMonitor.configure / observe → current typed native preview + lease/Todo owner → File or SQLite readback; existing Chat wake pump advances the admitted session。保留原配置和 observe facade,按配置、唤醒、信号和 Turn 恢复分开。一个既有 Todo owner 和一个 Chat wake 继续承担实际效果。 verify 重新读取请求的 plan id,非空非 Mapping Todo 失败关闭。持久 pause 按原 Todo 改 blocked。后台 monitor 和前台 native 共享 ledger,不在同一 actor 并发;普通人类会话保持并行。 避免为 monitor 再建调度器。复用原 typed plan/Todo 和前后台 admission,仅把具体职责抽出来。turns 模块仍较大,持续维护时可另行收敛其协议声明。

具体改动 / Changes

精确提交 f136c03,分叉基线 7f7297a。7 个路径 +2940/-970。四个内部分拆有生产净增,尤其 turns.py 汇集类型/协议与重试 helper。原 1040 行全职责门面缩至 544 行。测试覆盖跨模块去重、schema 和实路径。

关键代码讲解

  • configure_steward_monitor。先核对当前计划,再验证 todo 形状,异常时不进入暂停和写入分支。 源码

  • _process_steward_binding。沿原 session 和 owner 供本地 native 与后台 watch 做调度,保留人类会话并行条件。 源码

  • _commit_poll。在原配置、原租约和观察 deadline 下提交现有原生 poll 回执。 源码

  • native-steward-pause-fences-delivery-and-preserves-original-deadline(implemented)。原 Steward watch 的暂停、续跑和结果由同一 continuous-monitor Todo 持有;只有当前计划与明确授权可变更,收集或错误计划不可假报已暂停。

对主干的风险 / Risks

异常非映射计划拒绝,旧 plan id 同样拒绝。两条路径的零写入、原 open/到期、原 deadline 均由重新读取 Todo 与 pending 列表确认。修复头沿用该保护。 生产净增与 turns 模块体量已计入,主要风险在大规模移动后的准入或单次写入偏差。当前复验采用本次精确 rebase 头。 只有显式 None 表示无 Todo,非法类型在写之前拒绝;合法暂停仍用原计划和原 Todo。保留原前后台 admission。

我的整体评价 / Verdict

APPROVE。 认可当前精确头。此前失败暂停场景在当前 rebase 头经两种真实本地 authority 复验,并覆盖前后台隔离和合法暂停读回。 进程重开可重读原 Todo、deadline 与 lease,避免重复 observation 或把暂停成功误报给用户。

本轮独立复核:7 passed; legacy monitor suite reached 101 passed before bounded interruption;premerge passed 6/6 with 0 manual holds。

English verdict: APPROVE at f136c03. The rebased exact head preserves File/SQLite pause fencing, rejects malformed or stale plans with zero writes, and retains the existing foreground/background scheduling isolation.

@huangruiteng
huangruiteng merged commit 6d6e39d into main Nov 26, 2026
38 of 49 checks passed
@huangruiteng
huangruiteng deleted the codex/slim-steward-monitor-zero-any-20261126 branch November 26, 2026 12:06
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