Summary
Create a reconciliation engine that checks the current state of tasks against external sources and reports discrepancies.
Parent issue: #403
Scope
New module: core/reconciler.py
-
ReconciliationResult dataclass:
@dataclass
class ReconciliationResult:
task_id: str
current_status: TaskStatus
external_status: TaskStatus | None
action: ReconcileAction # SKIP, KILL, REQUEUE, NONE
reason: str
-
Reconciler class:
class Reconciler:
def __init__(self, workspace_path: Path, check_interval_ms: int = 30_000):
...
def check_tasks(self, task_ids: list[str]) -> list[ReconciliationResult]:
"""Check current state of given tasks against stored state."""
...
def check_blockers(self, task_ids: list[str]) -> list[ReconciliationResult]:
"""Check if any blocked tasks have had their blockers resolved."""
...
-
State check logic:
- Read task status from durable state (SQLite/filesystem)
- Compare against in-memory batch state
- If task externally transitioned to DONE/FAILED → recommend SKIP
- If task externally transitioned to BLOCKED → recommend KILL
- If blocked task has all blockers resolved → recommend REQUEUE
Acceptance Criteria
Dependencies
- None — standalone module using existing
core/tasks.py and core/blockers.py
Summary
Create a reconciliation engine that checks the current state of tasks against external sources and reports discrepancies.
Parent issue: #403
Scope
New module:
core/reconciler.pyReconciliationResultdataclass:Reconcilerclass:State check logic:
Acceptance Criteria
Reconcilerchecks task state from durable storageReconciliationResultwith recommended actionDependencies
core/tasks.pyandcore/blockers.py