Skip to content

Commit 2349bbc

Browse files
committed
fix(replan): scope fail-closed writeback to open obligations
Signed-off-by: huangruiteng <huangrt01@163.com>
1 parent 5026642 commit 2349bbc

3 files changed

Lines changed: 8 additions & 12 deletions

File tree

‎loopx/control_plane/work_items/semantic_replan_writeback.py‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
build_autonomous_replan_cli_actions,
3232
project_todo_lifecycle_settlement_reentry,
3333
)
34-
from .delivery_outcome import ACCOUNTABLE_DELIVERY_OUTCOMES
3534
from .progress_observation import semantic_delta_from_writeback
3635
from .repair_delta import (
3736
build_repair_delta_contract,
@@ -376,7 +375,6 @@ def qualify_refresh_replan_writeback(
376375
agent_id: str,
377376
dry_run: bool,
378377
settlement_todo_id: str | None,
379-
settlement_bound: bool,
380378
newest_first_runs: list[dict[str, Any]],
381379
state_text: str,
382380
goal_id: str,
@@ -450,11 +448,6 @@ def qualify_refresh_replan_writeback(
450448
effective_recorded = True
451449
classification = requested_classification
452450
delivery_outcome = requested_delivery_outcome
453-
if settlement_bound and delivery_outcome not in ACCOUNTABLE_DELIVERY_OUTCOMES:
454-
raise ValueError(
455-
"turn-scoped refresh-state produced no accountable semantic delta; "
456-
"no state or settlement receipt was written"
457-
)
458451
return RefreshReplanQualification(
459452
repair_delta_contract=repair_delta_contract,
460453
semantic_delta=semantic_delta,

‎loopx/state_refresh.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1144,7 +1144,6 @@ def refresh_state_run(
11441144
agent_id=normalized_agent_id,
11451145
dry_run=dry_run,
11461146
settlement_todo_id=(settlement_identity.todo_id if settlement_identity else None),
1147-
settlement_bound=settlement_identity is not None,
11481147
newest_first_runs=newest_first_runs,
11491148
state_text=state_text,
11501149
goal_id=safe_goal_id,

‎tests/control_plane/test_quota_settlement_cli.py‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1299,8 +1299,11 @@ def test_autonomous_replan_semantic_delta_keeps_accountable_receipt_chain(
12991299
assert obligation_id not in json.dumps(next_guard, sort_keys=True)
13001300

13011301

1302-
def test_turn_scoped_replan_noop_fails_before_durable_write(tmp_path: Path) -> None:
1302+
def test_open_replan_rejects_missing_semantic_delta_before_durable_write(
1303+
tmp_path: Path,
1304+
) -> None:
13031305
project, runtime, registry_path = _write_fixture(tmp_path)
1306+
_configure_selected_todo_replan_fixture(project, registry_path)
13041307
_initialize_git_checkout(project)
13051308
turn_instance_id = "turn-autonomous-replan-noop-1"
13061309

@@ -1320,7 +1323,8 @@ def test_turn_scoped_replan_noop_fails_before_durable_write(tmp_path: Path) -> N
13201323
str(project),
13211324
)
13221325
assert guard_rc == 0, guard
1323-
assert guard["selected_todo"]["todo_id"] == TODO_ID
1326+
assert guard["decision"] == "autonomous_replan_required", guard
1327+
assert guard["selected_todo"]["todo_id"] == SELECTED_REPLAN_TODO_ID
13241328

13251329
refresh_rc, refresh = _run_cli(
13261330
registry_path,
@@ -1333,7 +1337,7 @@ def test_turn_scoped_replan_noop_fails_before_durable_write(tmp_path: Path) -> N
13331337
"--turn-instance-id",
13341338
turn_instance_id,
13351339
"--todo-id",
1336-
TODO_ID,
1340+
SELECTED_REPLAN_TODO_ID,
13371341
"--delivery-workspace-path",
13381342
str(project),
13391343
"--autonomous-replan-recorded",
@@ -1352,7 +1356,7 @@ def test_turn_scoped_replan_noop_fails_before_durable_write(tmp_path: Path) -> N
13521356
assert refresh_rc == 1, refresh
13531357
assert refresh["ok"] is False
13541358
assert refresh["appended"] is False
1355-
assert "no accountable semantic delta" in refresh["error"]
1359+
assert "requires a typed semantic delta" in refresh["error"]
13561360
assert _classification_count(runtime, "validated_progress") == 0
13571361
assert _classification_count(runtime, "replan_noop") == 0
13581362

0 commit comments

Comments
 (0)