Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions loopx/control_plane/coordination/local_authority.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@ def __init__(
payload: Mapping[str, Any] | None = None,
) -> None:
evidence = {
"goal_id": goal_id,
"operation": operation,
"write_admitted": False,
"decision_read_from_provider": False,
"legacy_fallback_used": False,
Expand All @@ -88,6 +86,8 @@ def __init__(
"backup_required": True,
},
**dict(payload or {}),
"goal_id": goal_id,
"operation": operation,
}
super().__init__(
"Canonical authority is required; back up and migrate this Goal before retrying",
Expand Down
16 changes: 13 additions & 3 deletions loopx/control_plane/todos/provider_terminal_lifecycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
LocalCoordinationAuthorityUnavailable,
read_canonical_todos_if_promoted,
require_canonical_authority,
raise_canonical_write_failure,
)
from ...paths import effective_runtime_root
from ..effect_runtime import (
Expand Down Expand Up @@ -298,6 +299,9 @@ def terminal_canonical_todo_if_promoted(
"legacy_markdown_fallback_allowed": False,
"retry_after": "canonical_provider_readback_loaded",
}
raise_canonical_write_failure(
{**payload, "error_code": exc.code}, goal_id=goal_id, operation="todo_terminal",
)
raise LocalCoordinationAuthorityUnavailable(
str(exc), code=exc.code, payload=payload
) from exc
Expand Down Expand Up @@ -532,9 +536,15 @@ def archive_canonical_todos_if_promoted(
project: Path | None = None,
state_file: Path | None = None,
) -> dict[str, Any] | None:
authority_read = read_canonical_todos_if_promoted(
runtime_root=runtime_root, goal_id=goal_id
)
try:
authority_read = read_canonical_todos_if_promoted(
runtime_root=runtime_root, goal_id=goal_id
)
except LocalCoordinationAuthorityUnavailable as exc:
raise_canonical_write_failure(
{**exc.payload, "error_code": exc.code}, goal_id=goal_id, operation="todo_archive",
)
raise
if authority_read is None:
return None
provider_revision = authority_read.get("provider_revision")
Expand Down
Loading