fix(worker): emit RunCreated after run row exists
Remove premature RunCreated broadcast from WorkerHub.RunNow and the duplicate calls in RunAsync retry block and ContinueAsync. RunOnceAsync now owns the broadcast for every run, fired immediately after the row insert so the UI never receives an event for a non-existent row.
This commit is contained in:
@@ -125,7 +125,6 @@ public sealed class TaskRunner
|
||||
var retryConfig = resolvedConfig with { ResumeSessionId = result.SessionId };
|
||||
var retryPrompt = $"The previous attempt failed with:\n\n{result.ErrorMarkdown}\n\nTry again and fix the issues.";
|
||||
|
||||
await _broadcaster.RunCreated(task.Id, 2, true);
|
||||
var retryResult = await RunOnceAsync(task.Id, slot, runDir, retryConfig, 2, true, retryPrompt, ct);
|
||||
|
||||
if (retryResult.IsSuccess)
|
||||
@@ -216,7 +215,6 @@ public sealed class TaskRunner
|
||||
await _broadcaster.TaskStarted(slot, taskId, now);
|
||||
|
||||
var nextRunNumber = lastRun.RunNumber + 1;
|
||||
await _broadcaster.RunCreated(taskId, nextRunNumber, false);
|
||||
var result = await RunOnceAsync(taskId, slot, runDir, resolvedConfig, nextRunNumber, false, followUpPrompt, ct);
|
||||
|
||||
if (result.IsSuccess)
|
||||
@@ -255,6 +253,8 @@ public sealed class TaskRunner
|
||||
await runRepo.AddAsync(run, ct);
|
||||
}
|
||||
|
||||
await _broadcaster.RunCreated(taskId, runNumber, isRetry);
|
||||
|
||||
var arguments = _argsBuilder.Build(config);
|
||||
|
||||
await using var logWriter = new LogWriter(logPath);
|
||||
|
||||
Reference in New Issue
Block a user