Skip to content

fix(steward): tolerate report validator python drift and allow cancel of mid-turn failed reports - #9077

Merged
loopx-agent merged 1 commit into
mainfrom
codex/fix-steward-report-validator-and-cancel-20261119
Nov 19, 2026
Merged

loopx-agent merged 1 commit into
mainfrom
codex/fix-steward-report-validator-and-cancel-20261119

Conversation

@loopx-agent

Copy link
Copy Markdown
Collaborator

Summary

  • Tolerate report validator Python executable path drift across upgrades: In loopx/capabilities/native_chat/steward_turn.py, added _same_report_validator_command so StewardTurnHost._prepare_submission compares report validation commands without false ValueError("native steward request identity conflict") when only sys.executable (argv[0]) changed across local release upgrades while the -c validate_private_generation(Path(...)) payload remains identical. Changed target folders or arbitrary commands still fail closed.
  • Unblock owner cancel on mid-turn failed report attempts before editorial-response.json: In loopx/capabilities/native_chat/steward_reports.py, added _cancellable_failed_window for _cancel_failed_window, configure, and managed_session_report_configuration_guard (leaving _known_generation_failure and health().delivery_status unchanged). A completed chat turn whose native_loopx envelope recorded a non-retryable host_failure with no side effects (state_written: false, quota_spent: false, scheduler_acknowledged: false) and no generation/delivery artifacts can now be cleanly retired by owner cancel so subsequent scheduled windows proceed.

Local Verification (commit e93faf34aa87c241cd9f4b7530db4e7d8576114d)

  • uv run --extra test ruff check loopx/capabilities/native_chat/steward_turn.py loopx/capabilities/native_chat/steward_reports.py tests/test_steward_report_recovery_and_validator.py: passed (All checks passed!)
  • uv run --extra test python -m pytest -n 6 tests/test_native_steward_reports.py tests/test_lark_steward_reports.py tests/test_native_steward_monitor.py tests/test_steward_report_recovery_and_validator.py -q: 364 passed (including 4 new unit/regression cases in tests/test_steward_report_recovery_and_validator.py)
  • node --test tests/control_plane_ts/steward_reports.test.ts: 10/10 passed
  • loopx check on the 3 changed files: errors=0, warnings=0, public boundary scan clean
  • uv run --extra test loopx canary premerge --from-git-diff --git-diff-base origin/main: ok: true, merge_gate_passed: true (direct_checks: 6/6, semantic-vocabulary-drift-smoke: passed; inherited control-plane-maintainability-ratchet-smoke advisory only on untouched interaction_contract.py)

… of mid-turn failed reports

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

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

动机

评审精确 head e93faf34aa87c241cd9f4b7530db4e7d8576114d。目标受众为:运行本地 release 的 Steward 守护进程操作者以及触发每日定期汇报升级与取消重配的个人用户。此前只要本地 release 更新了 Python 解释器路径或某次汇报在生成 editorial-response.json 前因不可重试宿主错误失败,每分钟后台巡检就会触发身份冲突异常刷屏且用户无法通过 cancel 退役该失败窗口;修复后仅允许合法 validate_private_generation 脚本体一致的解释器路径漂移通过比对,且无生成/投递产物的终态失败汇报回合可被 cancel 安全退役并让下一窗口继续推进。当仅 validation_command[0](Python 路径)变化而后续 -c validate_private_generation(Path(...)) 目标一致时,pump_steward_monitors 不再抛出 identity conflict 告警;对于无 editorial-response.json 与 private-delivery.json 且已记录 no-effect 不可重试 host_failure 的失败窗口,owner cancel 可将该窗口退役并将对应 Todo 置为 blocked 从而放行后续到期汇报,而目标目录变更或含 unconfirmed 投递记录仍 fail-closed 拒绝。本 PR 不自动替未授权用户执行本地 release 重装,不跳过 failed report 的宿主人工确认保留语义,也不修改 health() 对 not_generated 的既有判定。

改动思路

  1. 容忍汇报校验器解释器路径漂移:在 loopx/capabilities/native_chat/steward_turn.py 新增 _same_report_validator_command,在 work_kind == "report" 时允许 argv[0](Python 可执行路径)因本地版本升级变化,同时严格要求 -c 与 validate_private_generation(Path(...)) 调用串完全一致,避免破坏任意脚本或目录漂移保护。
  2. 解除终态半途失败窗口的取消死锁:在 loopx/capabilities/native_chat/steward_reports.py 新增 _cancellable_failed_window 并接入 _cancel_failed_window、configure 与 managed_session_report_configuration_guard,保持 _known_generation_failure 与 health() 语义不变。
  3. 复用既有 StewardTurnHost 与 StewardReports 原生边界:在不放宽验证目标路径且不改变 health().delivery_status 对未生成状态判定前提下,仅识别安全等价的校验解释器路径升级与无副作用终态失败。仅影响 periodic report 的 validation_command[0] 解释器路径等价判定与 cancel/configuration guard 对无产物 host_failure 窗口的退役许可,不涉及普通对话、monitor 或已有投递记录窗口。

具体改动

  • loopx/capabilities/native_chat/steward_turn.py (+22/-2): 新增 _same_report_validator_command,并在 _prepare_submission 的 report 分支允许 argv[0] 路径升级等价比较;顺手清理未使用的 Callable 导入。
  • loopx/capabilities/native_chat/steward_reports.py (+37/-3): 新增 _cancellable_failed_window 并用于 cancel 计划生成、校验与 managed session 配置守卫。
  • tests/test_steward_report_recovery_and_validator.py (+173): 新增 4 条单元与端到端双 provider(file/sqlite)正反向回归用例。

对主干的风险

低风险(已全量验证):

  • ruff check 对全部 3 个修改文件零告警;
  • pytest -n 6 tests/test_native_steward_reports.py tests/test_lark_steward_reports.py tests/test_native_steward_monitor.py tests/test_steward_report_recovery_and_validator.py -q 共 364 passed;
  • node --test tests/control_plane_ts/steward_reports.test.ts 10/10 通过;
  • loopx check 零错误零边界告警;canary premerge --from-git-diff --git-diff-base origin/main 通过(failures=0,仅存在主干基线外 interaction_contract.py advisory)。

我的整体评价

APPROVE。 本改动以极小、无 schema 迁移的实现精确修复了 Steward 守护进程在本地版本升级后的校验器告警刷屏,以及半途失败日报窗口无法通过取消退役的历史死锁,同时保持目录防篡改与未确认投递保护门全链路生效;全量本地单测、静态检查与 premerge 均已在当前精确 head 通过。

English verdict: APPROVE - head e93faf3 fixes report validator executable drift and mid-turn failed window cancellation while preserving strict path and unconfirmed-delivery guards (364 Python tests, 10 TS tests, ruff, loopx check, and canary premerge passed).

@loopx-agent
loopx-agent merged commit ff90543 into main Nov 19, 2026
28 of 36 checks passed
@loopx-agent
loopx-agent deleted the codex/fix-steward-report-validator-and-cancel-20261119 branch November 19, 2026 14:12
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