feat(list-handler): hand off to a fresh session after Phase 2

The merge-helper ("Let Claude handle it") system prompt now calls a new
handoff_list_handler MCP tool once every surviving task is enhanced,
instead of continuing into Phases 3-5 in the same session -- avoiding
paying for Phases 0-2's dedupe/rewrite context on every polling round of
the run/review/merge phases.

The tool broadcasts HandoffRequested; Mission Control opens a second
ConPTY tile for the SAME handler task id (no new task, HandlerBaseCommit
untouched) running a fresh handoff brief that starts at Phase 3. The
original tile stays open. Adds PromptKind.MergeHelperHandoff,
InteractiveLaunchSpecService.BuildForMergeHelperHandoffAsync, and the
GetMergeHelperHandoffLaunchSpec hub method.
This commit is contained in:
mika kuns
2026-08-05 20:27:39 +02:00
parent bdee731376
commit 4ef01274f9
18 changed files with 503 additions and 1 deletions
@@ -49,6 +49,7 @@ public class PromptFilesTests
{
Assert.EndsWith("merge-helper-system.md", PromptFiles.PathFor(PromptKind.MergeHelper));
Assert.EndsWith("merge-helper-initial.md", PromptFiles.PathFor(PromptKind.MergeHelperInitial));
Assert.EndsWith("merge-helper-handoff.md", PromptFiles.PathFor(PromptKind.MergeHelperHandoff));
}
[Fact]
@@ -151,4 +152,48 @@ public class PromptFilesTests
Assert.DoesNotContain("{scope}", outp);
Assert.DoesNotContain("{tasks}", outp);
}
[Fact]
public void DefaultFor_merge_helper_handoff_has_scope_repo_and_tasks_tokens()
{
var d = PromptFiles.DefaultFor(PromptKind.MergeHelperHandoff);
Assert.False(string.IsNullOrWhiteSpace(d));
Assert.Contains("{scope}", d);
Assert.Contains("{repo}", d);
Assert.Contains("{tasks}", d);
}
[Fact]
public void DefaultFor_merge_helper_handoff_points_at_phase_3()
{
var d = PromptFiles.DefaultFor(PromptKind.MergeHelperHandoff);
Assert.Contains("phase 3", d, StringComparison.OrdinalIgnoreCase);
}
[Fact]
public void RenderTemplate_merge_helper_handoff_substitutes_scope_repo_and_tasks()
{
var outp = PromptFiles.RenderTemplate(
PromptFiles.DefaultFor(PromptKind.MergeHelperHandoff),
new Dictionary<string, string>
{
["scope"] = "List: Bugs",
["repo"] = "C:\\repo",
["tasks"] = "- [WaitingForReview] T1 (id: abc)",
});
Assert.Contains("Scope: List: Bugs", outp);
Assert.Contains("Repo: C:\\repo", outp);
Assert.Contains("- [WaitingForReview] T1 (id: abc)", outp);
Assert.DoesNotContain("{scope}", outp);
Assert.DoesNotContain("{repo}", outp);
Assert.DoesNotContain("{tasks}", outp);
}
[Fact]
public void DefaultFor_merge_helper_tells_the_session_to_hand_off_after_phase_2()
{
var d = PromptFiles.DefaultFor(PromptKind.MergeHelper);
Assert.Contains("handoff_list_handler", d);
Assert.Contains("do not continue into phase 3 yourself", d, StringComparison.OrdinalIgnoreCase);
}
}