feat: dual-run facade to repo-manager for task writeback
Some checks failed
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 1s
Build and Publish Multi-Context Image / build-and-push (push) Failing after 57s

RMGR-WP-0002 Stage B: when RM_WRITEBACK/RM_RECONCILE flags are set, PATCH
/tasks and C-15 writeback call rmgr; fix_repo runs rmgr reconcile for pilots.
This commit is contained in:
tegwick 2026-08-09 23:19:56 +02:00
parent 462f4a47d2
commit bfaff50b4e
4 changed files with 360 additions and 13 deletions

View file

@ -263,6 +263,33 @@ async def update_task(
parent_workstream=ws,
previous_task_status=previous_status,
)
# RMGR-WP-0002 dual-run: optional checkout writeback via repo-manager
if new_status != previous_status:
try:
from api.models.managed_repo import ManagedRepo
from api.services.repo_manager_dual_run import try_writeback_for_task
from api.services.workplan_files import resolve_repo_path
ws_full = ws or await session.get(Workplan, task.workplan_id)
repo = None
if ws_full and ws_full.repo_id:
repo = await session.get(ManagedRepo, ws_full.repo_id)
if repo is not None:
repo_path = resolve_repo_path(repo)
try_writeback_for_task(
repo_path=repo_path,
repo_slug=repo.slug,
task_id=str(task.id),
status=new_status,
reason="state-hub PATCH /tasks dual-run",
)
except Exception:
# Dual-run must not break native DB update path
import logging
logging.getLogger(__name__).exception(
"repo-manager dual-run writeback failed for task %s", task_id
)
await session.commit()
await session.refresh(task)