summaryrefslogtreecommitdiff
path: root/internal/executor/container_test.go
diff options
context:
space:
mode:
authorClaude <noreply@anthropic.com>2026-05-24 17:38:53 +0000
committerClaude <noreply@anthropic.com>2026-05-24 17:38:53 +0000
commit473d80224880dd718cb2612fd49b987cd6097b2c (patch)
tree3dcec19971c23ebbb35405fc87c0ea001fd1eb04 /internal/executor/container_test.go
parent952b7623ee9dceec15099043086622aa2aab4741 (diff)
feat(executor): MCP-oriented planning preamble, applied by ContainerRunner (Phase 2)
Rewrites the planning preamble to point the agent at the four MCP tools (ask_user/report_summary/spawn_subtask/record_progress) instead of the CLAUDOMATOR_QUESTION_FILE / CLAUDOMATOR_SUMMARY_FILE conventions: ask_user ends the turn, report_summary replaces the summary file, spawn_subtask replaces the POST-to-/api/tasks planning step. Git discipline is retained. ContainerRunner previously applied no preamble at all; it now prepends this preamble (via buildAgentInstructions) when the MCP back-channel is active and skip_planning is false, so the in-container agent is actually guided to use the tools. Gemini agents (no MCP) are unaffected. https://claude.ai/code/session_01SESwn7kQ7oP62trWw6pc39
Diffstat (limited to 'internal/executor/container_test.go')
-rw-r--r--internal/executor/container_test.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/internal/executor/container_test.go b/internal/executor/container_test.go
index 86e95e2..3d0887c 100644
--- a/internal/executor/container_test.go
+++ b/internal/executor/container_test.go
@@ -54,6 +54,28 @@ func TestContainerRunner_BuildDockerArgs(t *testing.T) {
}
}
+func TestBuildAgentInstructions(t *testing.T) {
+ t.Run("mcp enabled prepends preamble", func(t *testing.T) {
+ tk := &task.Task{Agent: task.AgentConfig{Instructions: "do the thing"}}
+ got := buildAgentInstructions(tk, true)
+ if !strings.HasPrefix(got, planningPreamble) || !strings.HasSuffix(got, "do the thing") {
+ t.Errorf("expected preamble + instructions, got %q", got)
+ }
+ })
+ t.Run("mcp disabled keeps raw instructions", func(t *testing.T) {
+ tk := &task.Task{Agent: task.AgentConfig{Instructions: "do the thing"}}
+ if got := buildAgentInstructions(tk, false); got != "do the thing" {
+ t.Errorf("expected raw instructions, got %q", got)
+ }
+ })
+ t.Run("skip planning keeps raw instructions even with mcp", func(t *testing.T) {
+ tk := &task.Task{Agent: task.AgentConfig{Instructions: "do the thing", SkipPlanning: true}}
+ if got := buildAgentInstructions(tk, true); got != "do the thing" {
+ t.Errorf("expected raw instructions when skip_planning, got %q", got)
+ }
+ })
+}
+
func TestWriteMCPConfig(t *testing.T) {
dir := t.TempDir()
if err := writeMCPConfig(dir, "http://host.docker.internal:8484/mcp", "tok-abc"); err != nil {