| 1 | package boot |
| 2 | |
| 3 | import ( |
| 4 | "context" |
| 5 | "strings" |
| 6 | "testing" |
| 7 | |
| 8 | "reasonix/internal/agent/testutil" |
| 9 | "reasonix/internal/event" |
| 10 | ) |
| 11 | |
| 12 | func TestBuildKeepsExecutorWhenPlannerModelIsUnresolvable(t *testing.T) { |
| 13 | isolateConfigHome(t) |
| 14 | dir := robustTempDir(t) |
| 15 | t.Chdir(dir) |
| 16 | registerBootTokenProfileTestProvider() |
| 17 | setBootTokenProfileTestProvider(t, testutil.NewMock("planner-missing")) |
| 18 | |
| 19 | writeFile(t, dir, "reasonix.toml", ` |
| 20 | default_model = "executor" |
| 21 | |
| 22 | [agent] |
| 23 | planner_model = "OpenRouter/moonshotai/kimi-k2.6:free" |
| 24 | |
| 25 | [[providers]] |
| 26 | name = "executor" |
| 27 | kind = "boot-token-profile-test" |
| 28 | model = "executor-model" |
| 29 | `) |
| 30 | |
| 31 | var notices []string |
| 32 | sink := event.FuncSink(func(e event.Event) { |
| 33 | if e.Kind == event.Notice { |
| 34 | notices = append(notices, e.Text) |
| 35 | } |
| 36 | }) |
| 37 | |
| 38 | ctrl, err := Build(context.Background(), Options{Sink: sink}) |
| 39 | if err != nil { |
| 40 | t.Fatalf("an unusable optional planner must not block startup: %v", err) |
| 41 | } |
| 42 | if ctrl == nil { |
| 43 | t.Fatal("Build returned no controller") |
| 44 | } |
| 45 | |
| 46 | var warned bool |
| 47 | for _, n := range notices { |
| 48 | if strings.Contains(n, "planner_model") { |
| 49 | warned = true |
| 50 | } |
| 51 | } |
| 52 | if !warned { |
| 53 | t.Fatalf("the dropped planner must be announced, got notices %v", notices) |
| 54 | } |
| 55 | } |
| 56 |