diff --git a/loopx/cli_commands/quota_failure_report.py b/loopx/cli_commands/quota_failure_report.py index f3c267af7d..f0cddc8f6b 100644 --- a/loopx/cli_commands/quota_failure_report.py +++ b/loopx/cli_commands/quota_failure_report.py @@ -185,11 +185,11 @@ def quota_failure_payload( "status": "heartbeat_receipt_identity_conflict", "effective_action": EffectiveAction.QUOTA_SKIP.value, "recommended_action": ( - "Rerun quota should-run with the same --turn-instance-id and without " - "--todo-id or --replan-obligation-id to read the bound Turn's recovery " - "contract. Settle verified work or record its verified blocked closeout; " - "do not replace the committed binding, repair receipt storage, or invent " - "a new Turn id. Independent work belongs to the next real host Turn." + "If the conflict reports a replaced task lease generation, wait for the next real host Turn " + "to project execution-loss closeout without quota spend. A replacement lease cannot resume " + "the original Turn. For other binding conflicts, rerun quota should-run with the same " + "--turn-instance-id and without --todo-id or --replan-obligation-id to read the bound Turn's " + "recovery contract. Keep the committed binding and receipt storage intact." ), }) if isinstance(error, CloseoutQueryUnavailableError): diff --git a/tests/control_plane/test_execution_loss_closeout_cli.py b/tests/control_plane/test_execution_loss_closeout_cli.py index 71471e462d..842b44344b 100644 --- a/tests/control_plane/test_execution_loss_closeout_cli.py +++ b/tests/control_plane/test_execution_loss_closeout_cli.py @@ -498,6 +498,20 @@ def test_closeout_preserves_the_original_turn_and_releases_the_next_guard( assert not original.writeback.receipts and not original.spend.receipts argv = _closeout_args(context) if not source_profile: + before_replay = _unchanged_state(context) + replay_args = _guard_args(context) + selection = replay_args.index("--todo-id") + del replay_args[selection:selection + 2] + + code, fenced = context["cli"](*replay_args) + assert code == 1, fenced + assert fenced["error_code"] == "heartbeat_receipt_identity_conflict" + assert "original task lease generation" in fenced["reason"] + assert fenced["heartbeat_receipt"]["settlement_identity"] == original.identity.value.as_dict() + assert "wait for the next real host Turn" in fenced["recommended_action"] + assert "execution-loss closeout without quota spend" in fenced["recommended_action"] + assert _unchanged_state(context) == before_replay + # A fresh guard recognizes the generation change before attempting to # re-enter the original guard. It offers only the administrative route. route = str(tmp_path / "fixture launcher" / "loopx")