feat(worker): add generic OperationProgress channel, port MergeProgress onto it

Merge/verify phases now broadcast over a generic (opKey, phase, current,
total) Hub event instead of a merge-specific one, so future producers
(worktree cleanup, startup recovery, planning integration) can reuse it.
IWorkerClient.MergeProgressEvent stays as a thin forwarder for existing
consumers (elapsed seconds riding in the generic "current" slot).
This commit is contained in:
Mika Kuns
2026-08-13 08:31:23 +02:00
parent db32e5307f
commit b8caa27027
8 changed files with 39 additions and 17 deletions
+7 -4
View File
@@ -46,10 +46,13 @@ public sealed class HubBroadcaster : IPrimeBroadcaster, IRefineBroadcaster
public Task WorkerLog(string message, WorkerLogLevel level, DateTime timestampUtc) =>
_hub.Clients.All.SendAsync("WorkerLog", message, level, timestampUtc);
// Phase of an in-flight single-task merge (see TaskMergeService.Phase*), so a client waiting
// on the MergeTask call can show what it is waiting for instead of a frozen button.
public Task MergeProgress(string taskId, string phase, int elapsedSeconds) =>
_hub.Clients.All.SendAsync("MergeProgress", taskId, phase, elapsedSeconds);
// Generic progress channel for long-running worker operations (merge phases, worktree
// cleanup, startup recovery, planning integration, ...). opKey is the TaskId for a
// task-bound operation, otherwise a stable string ("worktree-cleanup", "startup-recovery",
// "planning-integration:<taskId>"). current/total is shown as text by the UI, never a
// progress bar -- most operations have no meaningful total.
public Task OperationProgress(string opKey, string phase, int current, int total) =>
_hub.Clients.All.SendAsync("OperationProgress", opKey, phase, current, total);
public Task PlanningMergeStarted(string planningTaskId, string targetBranch) =>
_hub.Clients.All.SendAsync("PlanningMergeStarted", planningTaskId, targetBranch);