Merge claudedo/e39b952576f5469a9a3d821bdc110853

This commit is contained in:
mika kuns
2026-08-11 17:19:23 +02:00
5 changed files with 135 additions and 17 deletions
@@ -153,9 +153,9 @@ public sealed partial class MissionControlViewModel : ViewModelBase, IDisposable
public async System.Threading.Tasks.Task OpenConPtySessionAsync(string taskId)
{
if (string.IsNullOrEmpty(taskId)) return;
// A merge-helper handoff can leave more than one pane for this TaskId (the outgoing phase's
// frozen tile plus the active one) -- LastOrDefault resolves to the newest/active pane.
if (ConPtySessions.LastOrDefault(s => s.TaskId == taskId) is { } existing)
// One pane per TaskId is an invariant -- a merge-helper handoff closes its outgoing pane
// before opening the next phase's (see OpenMergeHelperHandoffConPtySessionAsync).
if (ConPtySessions.FirstOrDefault(s => s.TaskId == taskId) is { } existing)
{
FocusedPane = existing;
return;
@@ -284,18 +284,21 @@ public sealed partial class MissionControlViewModel : ViewModelBase, IDisposable
}
// List-handler handoff: the running session called handoff_list_handler at the end of a phase.
// Opens a NEW tile for the SAME handler task id to carry out nextPhase, and deliberately leaves
// the outgoing tile open -- it still shows that phase's finished output, which the wait/merge
// chain can run through several times for one handler task. ConPtySessions can therefore hold
// more than one pane per TaskId from here on; lookups that mean "the current/active session for
// this task" (OpenConPtySessionAsync's dedupe, OnPaneSubmitForReview) use LastOrDefault so they
// resolve to the newest tile rather than a frozen earlier phase. No new task is created here;
// see InteractiveLaunchSpecService.BuildForMergeHelperHandoffAsync.
// Opens a NEW tile for the SAME handler task id to carry out nextPhase. Each tile is a live
// `claude` process with the full mcp__claudedo__* surface, so the outgoing phase's pane is
// closed first -- it was only ever told to end its turn, never to exit, and a multi-phase run
// would otherwise leave one live process per phase behind. This keeps the one-pane-per-TaskId
// invariant intact, so OpenConPtySessionAsync's dedupe and OnPaneSubmitForReview can keep using
// FirstOrDefault. No new task is created here; see
// InteractiveLaunchSpecService.BuildForMergeHelperHandoffAsync.
public async System.Threading.Tasks.Task OpenMergeHelperHandoffConPtySessionAsync(
string taskId, IReadOnlyList<string> survivingTaskIds, string nextPhase)
{
if (string.IsNullOrEmpty(taskId) || survivingTaskIds is not { Count: > 0 }) return;
foreach (var stale in ConPtySessions.Where(s => s.TaskId == taskId).ToList())
CloseConPtySession(stale);
var baseTitle = Loc.T("missionControl.mergeHelperTitle");
var title = baseTitle + Loc.T("missionControl.mergeHelperHandoffTitleSuffix");
try
@@ -342,9 +345,9 @@ public sealed partial class MissionControlViewModel : ViewModelBase, IDisposable
// SubmitTaskForReviewAsync calls, with the loser flashing a spurious footer error.
private async void OnPaneSubmitForReview(string taskId)
{
// See OpenConPtySessionAsync -- LastOrDefault resolves to the newest/active pane when a
// merge-helper handoff has left an earlier phase's frozen tile in place for this TaskId.
if (ConPtySessions.LastOrDefault(s => s.TaskId == taskId) is not { } pane || pane.IsSubmitPending)
// See OpenConPtySessionAsync -- one pane per TaskId is an invariant, so FirstOrDefault is
// always the current/active pane for this task.
if (ConPtySessions.FirstOrDefault(s => s.TaskId == taskId) is not { } pane || pane.IsSubmitPending)
return;
pane.IsSubmitPending = true;
@@ -24,10 +24,21 @@ public sealed class PromptFileRecovery : IHostedService
PromptFiles.ReconcileStaleDefaults(_root);
var orphans = PromptFiles.QuarantineOrphans(_root);
if (orphans.Count > 0)
_logger.LogWarning("Prompt file recovery: quarantined {Count} orphaned prompt file(s) into _orphans", orphans.Count);
else
if (orphans.Count == 0)
{
_logger.LogInformation("Prompt file recovery: no orphaned prompt files found");
return Task.CompletedTask;
}
foreach (var orphan_path in orphans)
{
_logger.LogWarning("Prompt file recovery: quarantined orphaned prompt file {orphan_path}", orphan_path);
if (Path.GetFileNameWithoutExtension(orphan_path)
.StartsWith("merge-helper-execute", StringComparison.OrdinalIgnoreCase))
_logger.LogWarning(
"Prompt file recovery: {orphan_path} was a customization of the retired merge-helper-execute.md prompt, which was split into merge-helper-wait.md and merge-helper-merge.md; its content was not migrated to either",
orphan_path);
}
return Task.CompletedTask;
}