feat(worker): wire list-handler phase parameter through handoff chain

Threads a nextPhase parameter (wait/merge/wait_final/merge_final, validated
by the new MergeHelperPhase) from handoff_list_handler through
HubBroadcaster/WorkerHub into InteractiveLaunchSpecService, which now picks
the next session's system prompt (MergeHelperWait/MergeHelperMerge) and
model (HandlerWaitAlias/HandlerMergeAlias) from it instead of hardcoding the
old two-phase Execute prompt -- this also fixes a build break left by the
prior prompt-split task, which removed PromptKind.MergeHelperExecute without
updating its only caller.

Also sets --model/--effort/--permission-mode explicitly for every list-handler
session (Triage included) via PermissionModeResolver instead of inheriting the
CLI's ambient model and hardcoding "auto", and adds Task to the merge-helper
allowlist so the Merge phase can delegate diff reviews to subagents.
This commit is contained in:
mika kuns
2026-08-11 09:27:16 +02:00
parent 1657a70962
commit f2609d186a
11 changed files with 240 additions and 63 deletions
@@ -46,11 +46,15 @@ public interface IInteractiveLaunchSpecService
Task<string> CreateMergeHelperTaskAsync(
IReadOnlyList<string> taskIds, string listId, string title, string descriptionHeader, CancellationToken ct);
/// <summary>Builds a LaunchSpec for the fresh ConPTY session a merge-helper run hands off to
/// once Phase 2 (enhance) is done -- reuses the SAME handler task id (no new task, HandlerBaseCommit
/// untouched) and the unmodified merge-helper system prompt, writing only a fresh handoff kickoff
/// naming the surviving tasks. Throws KeyNotFoundException if the task/list doesn't exist;
/// InvalidOperationException if survivingTaskIds is empty or the list has no working directory.</summary>
/// <summary>Builds a LaunchSpec for the fresh ConPTY session a merge-helper run hands off to for
/// the given phase -- reuses the SAME handler task id (no new task, HandlerBaseCommit untouched),
/// writing only a fresh handoff kickoff naming the surviving tasks. nextPhase selects both the
/// system prompt and the model: "wait"/"wait_final" -> MergeHelperWait + HandlerWaitAlias,
/// "merge"/"merge_final" -> MergeHelperMerge + HandlerMergeAlias; the "_final" variants render an
/// extra line in the handoff kickoff marking the final round and forbidding further reruns. Throws
/// ArgumentException for an unrecognized nextPhase; KeyNotFoundException if the task/list doesn't
/// exist; InvalidOperationException if survivingTaskIds is empty or the list has no working
/// directory.</summary>
Task<LaunchSpec> BuildForMergeHelperHandoffAsync(
string taskId, IReadOnlyList<string> survivingTaskIds, CancellationToken ct);
string taskId, IReadOnlyList<string> survivingTaskIds, string nextPhase, CancellationToken ct);
}