summaryrefslogtreecommitdiff
path: root/internal/executor/preamble_test.go
blob: 77a8fcafce1283fe86c4a0992eefc5566b4b7203 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package executor

import (
	"strings"
	"testing"
)

func TestPlanningPreamble_ReferencesMCPTools(t *testing.T) {
	for _, tool := range []string{"ask_user", "report_summary", "spawn_subtask", "record_progress"} {
		if !strings.Contains(planningPreamble, tool) {
			t.Errorf("planningPreamble should mention the %q tool", tool)
		}
	}
}

func TestPlanningPreamble_NoFileEscapeHatches(t *testing.T) {
	for _, marker := range []string{"CLAUDOMATOR_SUMMARY_FILE", "CLAUDOMATOR_QUESTION_FILE"} {
		if strings.Contains(planningPreamble, marker) {
			t.Errorf("planningPreamble should no longer reference %s", marker)
		}
	}
}

func TestPlanningPreamble_AskUserEndsTurn(t *testing.T) {
	if !strings.Contains(planningPreamble, "end your turn") {
		t.Error("planningPreamble should instruct the agent to end its turn after ask_user")
	}
}

func TestPlanningPreamble_GitDiscipline_ForbidsAbsolutePaths(t *testing.T) {
	if !strings.Contains(planningPreamble, "do NOT use absolute paths") {
		t.Error("planningPreamble should warn agents not to use absolute paths in git commands")
	}
}

func TestWithPlanningPreamble_PrependsToInstructions(t *testing.T) {
	got := withPlanningPreamble("DO THE THING")
	if !strings.HasPrefix(got, planningPreamble) || !strings.HasSuffix(got, "DO THE THING") {
		t.Error("withPlanningPreamble should prepend the preamble to the instructions")
	}
}