Repository navigation
Description
Reproduced behavior
On native Windows, the settlement command that the Turn plan itself publishes commits the spend and then reports failure.
tests/control_plane/test_execution_loss_closeout_cli.py::test_combined_writeback_keeps_the_admitted_lease_generation drives the real public CLI. The replaced=False variants follow the plan's semantic_closeout_command_template through to a successful settlement and require exit 0.
| Variant | Result on native Windows |
|---|---|
[False-file] |
exit 1, ok=false |
[False-sqlite] |
exit 1, ok=false |
[True-file], [True-sqlite] |
pass (they never reach a settled composed writeback) |
The failing packet shows that the settlement itself succeeded:
ok => false
appended => true
settlement_progress => {"schema_version": "quota_settlement_progress_v0", "state": "settled", "next_step": null, ...}
error => "The quota operation was already evaluated, but bounded result delivery failed. Recover the original operation/receipt; do not repeat admission or assume it did not commit. private capture validation is unsupported on this platform; use the same Turn command without --max-page-output-bytes"
Root cause
loopx/control_plane/quota/settlement_plan.ts:51andloopx/control_plane/quota/turn_envelope_references.ts:820compose every plan writeback with--settle-turn --settlement-receipt, with no platform condition.loopx/cli_commands/refresh_settlement.py:44-50runspresent_settled_refreshwhenever both flags are present, and turnsQuotaDecisionTransportErrorintopayload.update(ok=False, error=str(exc)).present_settled_refreshalways callsbudgeted_settlement_resultfor a non-dry-run settled result (supporting_fieldsis a tuple, so the earlyfits(payload)return is not taken), andbudgeted_settlement_resultcallsprivate_capture_uid()first (loopx/cli_commands/quota_capture.py:577).private_capture_uid()deliberately fails closed off POSIX (loopx/control_plane/turn_driver/decision_capture.py:29-43: "Fail closed until this IO boundary has a qualified non-POSIX ACL reader").loopx/cli_commands/project_lifecycle_refresh_state.py:906-909then returns0 if payload.get("ok") else 1.
So the fail-closed check is intended, but it is reached on every composed settlement on Windows rather than only in an exceptional capture failure. The advice in the error is also not actionable for a caller following the plan: the composed command carries no --max-page-output-bytes; the budget is the implicit NATIVE_CONTEXT_PAGE_OUTPUT_BYTES passed at refresh_settlement.py:267 and :349.
Blast radius
- Directly reproduced: the two variants above, on both File and SQLite providers.
- By code reading, not separately executed: every plan-composed settlement on native Windows takes this path, since the composed flags are unconditional and
private_capture_supported()is false foros.name != "posix". tests/references--settlement-receiptin 15 files (28 lines). I did not run those on Windows, so I am not claiming a count of further failures.- Not visible in CI: the
windows-powershelljob runs only the CLI output budget/differential files, not this test file.
Expected boundary
Decide what a composed settlement should return on a host that cannot validate private captures. Two candidate directions, both of which leave POSIX behavior unchanged:
- Do not compose the receipt flag where it cannot be delivered. Publish the writeback with
--settle-turnonly (the pre-Return recoverable receipts for settled refreshes #8090 shape) when the host cannot validate a private capture. This is the more principled fix, but it makes the plan shape platform-dependent and touches the composed-plan contract. - Keep the evaluated result authoritative. In
settle_requested_refresh, when the capture is unsupported on this platform, retainokas evaluated and attach the delivery problem as a visible warning, the way thefailed_with_spendbranch atrefresh_settlement.py:262-270already retains the payload withresult_delivery_error. This is the smaller change, and it alters the exit code of a committed settlement from 1 to 0 on Windows.
Either way, the returned packet should carry recovery guidance that matches the command the caller was actually given.
Scope and qualification
- Reproduced on
maind33af49aa, native Windows 10, Python 3.12, File and SQLite canonical providers, real public CLI. loopx.control_plane.turn_driver.decision_capture.private_capture_supported()returnsFalseon this host.- Not verified: no POSIX run, no real Host reaction to the exit code, and no measurement of how a native Host with a bounded stdout handles the returned packet.
- Public-safe summary only; no local paths, prompts, logs or credentials.
Introduced by the combination of #8090 (present_settled_refresh) and 257b45585 (private_capture_uid). Related: #8604 covers other native Windows boundaries.
Activity