Skip to content

Commit 101e36c

Browse files
PureWeenCopilot
andcommitted
Fix orchestrator using SDK tools instead of @worker: dispatch
The orchestrator prompt had two issues causing it to use SDK tools (task, grep, edit) directly instead of producing @worker: blocks: 1. Line 989 said 'If you can handle the request entirely yourself, just respond normally without any @worker blocks' — giving the model explicit permission to skip delegation. 2. The RoutingContext used tool-like language ('run git diff', 'build, test, commit') that the model pattern-matched to its SDK tools. Fix: Rewrite the planning prompt to say the orchestrator is a DISPATCHER ONLY with no tools, and reword the RoutingContext to describe the dispatch pattern without tool-like language. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 27fe315 commit 101e36c

2 files changed

Lines changed: 17 additions & 16 deletions

File tree

PolyPilot/Models/ModelCapabilities.cs

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -323,25 +323,24 @@ public record GroupPreset(string Name, string Description, string Emoji, MultiAg
323323
RoutingContext = """
324324
## Implement & Challenge Loop
325325
326-
You orchestrate a two-agent loop: worker-1 (Implementer) builds the solution, then worker-2 (Challenger) reviews it.
326+
You orchestrate a two-agent loop between two workers. Your ONLY role is to relay messages between them using @worker: blocks.
327327
328328
### Worker Names
329-
- **Implementer** = the first worker (worker-1)
330-
- **Challenger** = the second worker (worker-2)
329+
- **worker-1** = Implementer (writes code)
330+
- **worker-2** = Challenger (reviews code)
331331
Use their full session names in @worker: directives (e.g., @worker:Implement & Challenge-worker-1).
332332
333-
### Iteration Flow
334-
1. **First iteration**: Send the full user request to the Implementer. Tell them to implement the feature, make actual code changes, build, test, and commit.
335-
2. **After Implementer responds**: Send the FULL Implementer output to the Challenger. Tell them to run `git diff`, review the actual changes, run build/tests, and either approve with [[GROUP_REFLECT_COMPLETE]] or provide specific feedback.
336-
3. **If Challenger finds issues**: Send the FULL Challenger feedback to the Implementer. Tell them to address every point, then rebuild/retest/recommit.
337-
4. **Repeat** until the Challenger emits [[GROUP_REFLECT_COMPLETE]] or max iterations reached.
333+
### Dispatch Pattern
334+
1. **First dispatch**: Forward the user request to worker-1 via @worker: block.
335+
2. **After worker-1 completes**: Forward worker-1's FULL response to worker-2 via @worker: block. Ask worker-2 to review and either approve with [[GROUP_REFLECT_COMPLETE]] or provide feedback.
336+
3. **If worker-2 has feedback**: Forward the FULL feedback to worker-1 via @worker: block.
337+
4. **Repeat** until worker-2 emits [[GROUP_REFLECT_COMPLETE]] or max iterations reached.
338338
339339
### Rules
340-
- Always alternate: Implementer → Challenger → Implementer → Challenger
341-
- Include the FULL output in every delegation (don't summarize)
342-
- Do NOT do the implementation or review yourself — ALWAYS delegate
343-
- The loop ends when the Challenger emits [[GROUP_REFLECT_COMPLETE]] or max iterations reached
344-
- If the Implementer is stuck, provide specific guidance in the re-plan prompt
340+
- Always alternate: worker-1 → worker-2 → worker-1 → worker-2
341+
- Include the FULL output in every @worker: block (don't summarize)
342+
- You are a message relay — NEVER do work yourself, ONLY write @worker: blocks
343+
- Each response you give MUST contain exactly one @worker: block
345344
""",
346345
MaxReflectIterations = 10,
347346
},

PolyPilot/Services/CopilotService.Organization.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -989,14 +989,16 @@ private string BuildOrchestratorPlanningPrompt(string userPrompt, List<string> w
989989
}
990990
sb.AppendLine();
991991
sb.AppendLine("## Your Task");
992-
sb.AppendLine("Analyze the request and assign specific tasks to your workers. Use this exact format for each assignment:");
992+
sb.AppendLine("You are a DISPATCHER ONLY. You do NOT have tools. You CANNOT write code, read files, or run commands yourself.");
993+
sb.AppendLine("Your ONLY job is to write @worker/@end blocks that assign work to your workers.");
994+
sb.AppendLine("Use this exact format for each assignment:");
993995
sb.AppendLine();
994996
sb.AppendLine("@worker:worker-name");
995997
sb.AppendLine("Detailed task description for this worker.");
996998
sb.AppendLine("@end");
997999
sb.AppendLine();
998-
sb.AppendLine("You may include your analysis and reasoning as normal text. Only the @worker/@end blocks will be dispatched.");
999-
sb.AppendLine("If you can handle the request entirely yourself, just respond normally without any @worker blocks.");
1000+
sb.AppendLine("You may include brief analysis before the @worker blocks, but you MUST produce at least one @worker block.");
1001+
sb.AppendLine("NEVER attempt to do the work yourself. ALWAYS delegate via @worker blocks.");
10001002
return sb.ToString();
10011003
}
10021004

0 commit comments

Comments
 (0)