refactor(prompts): split the list-handler prompt per session phase

Both merge-helper ConPTY sessions loaded PromptKind.MergeHelper, so the
post-handoff session received the phase 0-2 dedupe/enhance instructions and was
told to ignore them by its brief alone.

Split into MergeHelperTriage (phases 0-2 + handoff) and MergeHelperExecute
(phases 3-5), so each session carries only its own phases. Consolidated the
generic ask-the-user rule to one place per prompt, scoped Phase 5's summary to
what the execute session actually knows, and moved the dedupe/enhance bilanz to
the triage handoff. Regression guards assert neither prompt carries the other's
phase headings and that the shared-checkout git rule stays in execute.
This commit is contained in:
mika kuns
2026-08-06 21:00:41 +02:00
parent d5730a8405
commit a7ff1b3a2f
5 changed files with 129 additions and 35 deletions
@@ -237,7 +237,7 @@ public sealed class InteractiveLaunchSpecService : IInteractiveLaunchSpecService
Directory.CreateDirectory(sessionDir);
var systemPromptPath = Path.Combine(sessionDir, "system-prompt.md");
await File.WriteAllTextAsync(systemPromptPath, PromptFiles.ReadOrDefault(PromptKind.MergeHelper), ct);
await File.WriteAllTextAsync(systemPromptPath, PromptFiles.ReadOrDefault(PromptKind.MergeHelperTriage), ct);
var briefPath = Path.Combine(sessionDir, "brief.md");
await File.WriteAllTextAsync(briefPath, PromptFiles.Render(PromptKind.MergeHelperInitial,
@@ -280,8 +280,9 @@ public sealed class InteractiveLaunchSpecService : IInteractiveLaunchSpecService
// Builds the LaunchSpec for the fresh session a merge-helper run hands off to once Phase 2
// (enhance) is done -- SAME handler task id as the run that called handoff_list_handler, so
// HandlerBaseCommit/HandlerHeadCommit and the review range stay untouched; this never creates
// a task. Reuses the merge-helper system prompt unchanged (the phase 3-5 instructions already
// live there) and only writes a fresh handoff kickoff file, in a NEW session dir -- the old
// a task. Uses the MergeHelperExecute system prompt (phases 3-5 only) rather than the Triage
// one this run started with, so the handoff session carries no dedupe/enhance instructions it
// would have to ignore. Writes a fresh handoff kickoff file in a NEW session dir -- the old
// ConPTY tile keeps running against its own session-dir files untouched.
public async Task<LaunchSpec> BuildForMergeHelperHandoffAsync(
string taskId, IReadOnlyList<string> survivingTaskIds, CancellationToken ct)
@@ -315,7 +316,7 @@ public sealed class InteractiveLaunchSpecService : IInteractiveLaunchSpecService
Directory.CreateDirectory(sessionDir);
var systemPromptPath = Path.Combine(sessionDir, "system-prompt.md");
await File.WriteAllTextAsync(systemPromptPath, PromptFiles.ReadOrDefault(PromptKind.MergeHelper), ct);
await File.WriteAllTextAsync(systemPromptPath, PromptFiles.ReadOrDefault(PromptKind.MergeHelperExecute), ct);
var briefPath = Path.Combine(sessionDir, "handoff.md");
await File.WriteAllTextAsync(briefPath, PromptFiles.Render(PromptKind.MergeHelperHandoff,