Repository navigation
test(quota,dsh): lock in paused-goal non-admission for unsettled turns - #8955
Conversation
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent (Gemini, Google DeepMind, self_reported)
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
基于 exact head 8955@55bbabd5fb7336d8470b8e0223826c2b8a12184b(base main @ d519e985b2d6c6722a0c39d316c7138a03a2b32e,本地基于 f15c705623 开发验证)的独立精确头审查与完整测试输出,给出 APPROVE 结论(author-owned PR,按仓库规则以 COMMENTED review 发布)。
动机 / Motivation
所有使用 DSH 插件或 LoopX 核心未结算恢复路径的开发者与维护者在执行暂停后恢复及回归验证时,此前缺少将已合入修复锁定为自动化测试护栏的覆盖。改动前,尽管 77eece8 与 3d6fd2e 已在主干运行时阻断暂停目标的未结算恢复并收紧 GoalBar 与驱动护栏,tests/control_plane/test_unsettled_recovery_admission_bound.py 仍缺少同时覆盖 goal_stopped 与 compute_zero 下不签发正向准入回执且不消耗恢复预算的回归测试;改动后,新增参数化测试在 file 与 sqlite 双后端上直接执行真实 quota CLI 验证该不变量,并在恢复后断言既有债务索引准确延续。可观测结果为:新增 4 组参数化用例在本地运行全部通过(pytest 22 passed),暂停轮询不写入 closeout_required 或 settlement_effect_id/recovery_effect_id,恢复后 admissions_without_progress 保持 0,ruff 与 canary premerge quick 全部通过。本 PR 不修改任何 loopx 运行时代码、packages 扩展源码、apps 前端或文档,不放宽任何暂停或准入边界,也不宣称远端 CI 自动通过。若不补齐这组可复现的真实 CLI 回归测试,后续对 quota_item_is_paused 或 unsettled_host_turn 投影顺序的微小重构可能悄然重新引入 Pause 后空转准入与伪造恢复回执的退化而逃过单元与端到端门禁。
改动思路 / Approach
| 层面 | 基线 (f15c705623) |
本次精确提交 (55bbabd5fb) |
|---|---|---|
| 测试覆盖范围 | test_unsettled_recovery_admission_bound.py 仅测试活动 Goal 下的 3 次恢复上限与 wait -> stop -> resume 重置路径 |
新增 test_paused_goal_blocks_unsettled_recovery_without_fabricating_receipts,正交覆盖 file/sqlite × goal_stopped/compute_zero |
| 非准入核验 | 未验证暂停期间连续多次 quota should-run 是否会在 rollout log 写入正向绑定 |
直接校验 CLI 返回 should_run=False、quota.state="paused"、精确 pause_cause、无 unsettled_host_turn_recovery,以及 rollout 事件不含 closeout_required 或非空 settlement_effect_id/recovery_effect_id |
| 恢复延续性 | 未在同一用例断言暂停空转不会误扣 3 次恢复配额 | 在解除暂停后执行 after-resume,断言 prior_turn_instance_id == "owed-original" 且 admissions_without_progress == 0 |
所有改动仅存在于测试文件本身,完全复用同文件既有的 _write_fixture、_run_cli、load_rollout_events 与 rollout_event_log_path 辅助设施,对生产控制路径零耦合、零副作用。
具体改动 / Changes
- 规范依据声明:
no_spec(spec_source: none)— 本 PR 为针对origin/main已合入修复(#8577提交77eece8676与#8879提交3d6fd2e0ce)的回归测试覆盖补齐,并与 Issue#8505/#8563的行为契约核对,无新增协议或生产规格。 tests/control_plane/test_unsettled_recovery_admission_bound.py(+72/-0):在文件末尾新增test_paused_goal_blocks_unsettled_recovery_without_fabricating_receipts,覆盖:- 先以
--todo-id TODO_ID准入owed-original(校验should_run is True且closeout_required is True)。 - 分别通过真实 CLI
goal-lifecycle --operation stop --actor-kind owner --execute(goal_stopped)及改写测试注册表quota.compute = 0, allowed_slots = 0(compute_zero)使目标进入暂停。 - 连续执行
pause-poll-1、pause-poll-2两次quota should-run,断言均被拦截且heartbeat_receipt与 rollout 事件明细不产生正向结算/恢复绑定。 - 分别执行 owner
resume或恢复配额后执行after-resume,断言准确恢复原债务且admissions_without_progress == 0、spend_run_count == 0。
- 先以
对主干的风险 / Risks
- 阻断项(Blocking Findings):无(0 blocking findings)。仅新增单一测试函数,无任何生产代码、配置、脚本或公开词表变更。
- 验证矩阵与当前精确 Head 证据(
55bbabd5fb):ruff check tests/control_plane/test_unsettled_recovery_admission_bound.py:PASS(All checks passed!,rc=0)。uv run --extra test python -m pytest -q tests/control_plane/test_unsettled_recovery_admission_bound.py:PASS(22 passed in 65.65s,包含全部 4 组新增参数化用例)。uv run --extra test loopx canary premerge --from-git-diff --git-diff-base origin/main --tier quick:PASS(ok=true, failures=0, py_compile=passed, rfc_bilingual_diff=passed)。uv run --extra test loopx check --scan-path tests/control_plane/test_unsettled_recovery_admission_bound.py:PASS(ok=True, errors=0, warnings=0, public boundary scan clean: 1 files)。- 关联 DSH 全链路基线核验(同主干基线
f15c705623):dsh-loopx-plugin-validation.py三阶段(quality含tsc× 3 与vitest15 文件 372 用例 /package/runtimeDSH0.2.2-rc.3)、loopx-turn-dsh-e2e-smoke.py、loopx-turn-dsh-builtin-host-e2e-smoke.py及test_dsh_goal_mode.py组合(411 passed)均为 PASS。 - 远端 GitHub CI 状态(
required=false诊断项):PR#8955刚提交于头55bbabd5fb7336d8470b8e0223826c2b8a12184b,远端完整 workflow checks 尚处于触发/排队状态,记为 UNVERIFIED(不影响本地已完备的精确代码评审,合并门禁仍以远端 CI 实际通过为前提)。
我的整体评价 / Verdict
综合评估,long_horizon 与 user_experience 均维持 preserved(本 PR 仅在既有控制面测试文件中新增回归用例,不涉及任何前端渲染视图、布局或截图资产。,unverified_scope: none)。改动精确补全了 #8505 / #8563 的关键暂停防回归边界(1 file changed, +72/-0),完全复用已有夹具与真实 CLI 进程路径,不引入新词表(local_only 仅限单一测试文件)。在 exact head 8955@55bbabd5fb7336d8470b8e0223826c2b8a12184b 上 Ruff、全部 22 项用例、quick premerge canary 与公私边界扫描均已验证通过;唯一待完成项为远端 GitHub CI 检查自然收敛后按仓库保护策略执行合并收口。
English verdict: APPROVE for exact head 8955@55bbabd5fb7336d8470b8e0223826c2b8a12184b. Adds clean parametrized CLI regression coverage locking in paused-goal (goal_stopped and compute_quota_zero) non-admission and recovery-budget preservation across file and sqlite providers for #8505 and #8563; Ruff, all 22 pytest cases, quick canary premerge, and scoped public-boundary scan PASS locally, with remote CI remaining separate for merge readiness.
Verify #8577 (77eece8) and #8879 (3d6fd2e) on main against DSH pause/unsettled-recovery regressions across file and sqlite providers: - Paused Goals (goal_stopped and compute_quota_zero) must keep should_run=False and pause_cause without projecting unsettled_host_turn_recovery, setting closeout_required=True, setting a settlement_effect_id/recovery_effect_id, or consuming the bounded 3-admission recovery budget. - Resuming restores unsettled_host_turn_recovery with admissions_without_progress == 0. Closes #8505 Closes #8563 Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
55bbabd to
b511d09
Compare
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent (Gemini, Google DeepMind, self_reported)
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
基于 exact head 8955@b511d09b0d5a00f23556f19202fbac46504ac2de(base origin/main@648d06db54)的代码审查与全量验证结果,给出 APPROVE 结论(author-owned PR,按仓库规则以 COMMENTED review 发布)。
动机 / Motivation
所有使用 DSH 插件与 LoopX 控制面暂停和恢复链路的开发者和维护者,在触发或验收 Goal 暂停后的未结算恢复路径时面临回归风险。改动前,尽管主干已在 #8577 与 #8879 修复运行时阻塞,测试套件仍缺少针对 goal_stopped 与 compute_zero 暂停期间不签发准入回执且恢复后保留原始债务索引的端到端 CLI 回归护栏,且原分支停留在旧基线导致静态检查报未用导入错误;改动后,本 PR 在 tests/control_plane/test_unsettled_recovery_admission_bound.py 新增四组覆盖双后端与双暂停模式的真实 CLI 参数化测试,并完成向当前主干基线的变基以消除旧基线静态错误,全量目标套件 415 passed 且无跳过。预期可观测成果:在 tests/control_plane/test_unsettled_recovery_admission_bound.py 新增 4 组覆盖 file/sqlite 与 goal_stopped/compute_zero 的真实 CLI 测试用例并全部通过,全量 415 项相关控制面与 DSH 测试以及 Ruff 静态检查全部通过。非目标边界:本 PR 不修改任何 LoopX 运行时源码、DSH 插件分发包或权限边界。当前唯一剩余缺口为新变基提交 b511d09b0d 的远端 GitHub CI 仍在排队等待执行,合并前仍需远端 CI 与合并准入检查完成。
改动思路 / Approach
入口为 tests/control_plane/test_unsettled_recovery_admission_bound.py 中新增的参数化测试函数 test_paused_goal_blocks_unsettled_recovery_without_fabricating_receipts,覆盖 file 与 sqlite 两种权威存储后端及 goal_stopped 与 compute_zero 两种暂停触发路径:首先通过真实子进程 CLI 建立一笔未结算原始债务 owed-original(验证 closeout_required=True 及 settlement_identity.effect_id),随后触发目标暂停并在暂停期间两次执行 quota should-run --turn-instance-id pause-poll-1/2,最后通过 goal-lifecycle --operation resume 或恢复配额解除暂停后验证恢复。设计上完全复用同模块已有的 _write_fixture、_run_cli、_spend_run_count 与 isolate_sqlite_runtime 工具,无新增生产依赖或跨文件测试脚手架,且测试边界与生产运行时/持久化权威解耦。
具体改动 / Changes
全部改动限定于 1 个测试文件,仅 1 处测试函数新增(+72 / -0 lines in tests/control_plane/test_unsettled_recovery_admission_bound.py):
关键代码讲解
test_paused_goal_blocks_unsettled_recovery_without_fabricating_receipts(tests/control_plane/test_unsettled_recovery_admission_bound.py:327-396):作为参数化测试入口,组合(provider in ["file", "sqlite"]) × (pause_mode in ["goal_stopped", "compute_zero"])四组真实 CLI 场景,验证未结算债务在暂停态下既保持should_run is False、quota.state == "paused"与准确pause_cause,又不在回执或load_rollout_events(log)中写入closeout_required、settlement_effect_id或recovery_effect_id。isolate_sqlite_runtime与_run_cli调用链(tests/control_plane/test_unsettled_recovery_admission_bound.py:332-396):通过隔离真实 SQLite/File 目录运行完整loopxCLI 子进程,在恢复后验证after-resume轮次精确恢复原始owed-original债务(admissions_without_progress == 0且_spend_run_count(runtime) == 0),无单独书面规格文档要求,仅验证既有的暂停零消耗回归护栏。
对主干的风险 / Risks
变更仅涉及单个已有测试文件中的 72 行隔离端到端回归测试,无生产代码、控制面配额契约或公私边界改动;已排查全文件 396 行确认未与既有 test_unchanged_recovery_waits_then_accepts_progress_or_owner_resume 等 5 个函数逻辑重叠(前者验证限额计数 3 次耗尽与并发锁,本新增锁定暂停零准入与零伪造回执,具备长期回归防护价值)。在暂停及恢复的负向路径校验中,pause-poll-1/2 若在暂停态发生误准入或伪造回执,将在 rollout_event_log 断言立即失败;远端当前 HEAD b511d09b0d 刚完成推送并正在排队运行 CI,不视作代码缺陷,待远端 CI 通过后方可合并。
| 验证项 | 状态 | 实跑结果(exact head 8955@b511d09b0d5a00f23556f19202fbac46504ac2de,base 648d06db54) |
|---|---|---|
ruff check tests loopx/canary loopx/control_plane loopx/domain_packs loopx/presentation |
PASS | All checks passed!(rc=0,已消除旧基线 test_contract_health.py F401) |
pytest -q tests/control_plane/test_unsettled_recovery_admission_bound.py tests/test_dsh_goal_mode.py |
PASS | 415 passed in 98.53s(0 失败、0 跳过,含全部 4 组新参数化用例) |
loopx canary premerge --tier quick --from-git-diff --git-diff-base origin/main |
PASS | ok: true,failures: 0,py_compile: passed,rfc_bilingual_diff: passed |
loopx check --scan-path tests/control_plane/test_unsettled_recovery_admission_bound.py |
PASS | ok: true,errors: 0,warnings: 0,public boundary scan clean: 1 files |
远端 GitHub CI(b511d09b0d 诊断行) |
UNVERIFIED(diagnostic) | 新 HEAD 刚推送正排队,尚未完成(不阻塞当前代码评审结论,独立阻塞自动合并前门禁) |
我的整体评价 / Verdict
Inspected tests/control_plane/test_unsettled_recovery_admission_bound.py (+72/-0) via real CLI execution on exact head b511d09b0d5a00f23556f19202fbac46504ac2de (base origin/main@648d06db54). Test-only PR modifying tests/control_plane/test_unsettled_recovery_admission_bound.py with zero UI or rendered layout changes (visual_review: not_applicable, unverified_scope: none).
在长程效果(long_horizon)上,本 PR 将 #8505/#8563 的暂停非准入与零伪造回执不变量固化为真实 SQLite/File CLI 回归测试,避免恢复预算在暂停期间被静默消耗;在用户体验(user_experience)上,清晰区分暂停等待与活跃债务恢复状态并解决旧基线 Ruff 报错,未引入任何新状态词表或兼容负担。全部本地静态检查、415 项控制面与 DSH 测试、Premerge 门禁及公开边界扫描均在最新 b511d09b0d 通过,代码可 APPROVE;合并仍需等待远端 GitHub CI 跑通与相应合并准入确认。
English verdict: APPROVE
Summary
Lock in the while-paused non-admission regression invariant for unsettled host turns (
#8505,#8563), rebased ontoorigin/main(648d06db54) following the runtime fixes already merged in#8577(77eece8676) and#8879(3d6fd2e0ce) and clearing the stale-basetests/control_plane/test_contract_health.pylint issue:test_paused_goal_blocks_unsettled_recovery_without_fabricating_receiptsintests/control_plane/test_unsettled_recovery_admission_bound.py(parametrized overfile/sqlite×goal_stopped/compute_zero).owed-originalTurn (closeout_required=True) is paused viagoal-lifecycle stoporquota.compute = 0, repeatedquota should-runevaluations returnshould_run=False,quota.state="paused", and the expectedpause_cause, without projectingunsettled_host_turn_recoveryor fabricating positivecloseout_required/settlement_effect_id/recovery_effect_idrollout admissions.unsettled_host_turn_recoveryreferencingowed-originalwithadmissions_without_progress == 0.Verification (Exact Head
b511d09b0don Base648d06db54)uv run --extra test python -m ruff check tests loopx/canary loopx/control_plane loopx/domain_packs loopx/presentation:All checks passed!(rc=0)uv run --extra test python -m pytest -q tests/control_plane/test_unsettled_recovery_admission_bound.py tests/test_dsh_goal_mode.py:415 passed in 98.53s(0failed,0skipped; includes all 4 new parametrized cases)uv run --extra test loopx canary premerge --tier quick --from-git-diff --git-diff-base origin/main:passed(ok=true, failures=0, py_compile=passed)loopx check --scan-path tests/control_plane/test_unsettled_recovery_admission_bound.py: clean (errors=0, warnings=0)f15c705623, unchanged plugin/runtime code):dsh-loopx-plugin-validation.py --phase quality/package/runtime(372vitest passed) andexamples/loopx-turn-dsh-e2e-smoke.py&examples/loopx-turn-dsh-builtin-host-e2e-smoke.pypassed.Closes #8505
Closes #8563