| 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 TestBuildFailsWhenPlannerModelIsUnresolvable(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 | ctrl, err := Build(context.Background(), Options{Sink: event.Discard}) |
| 32 | if err == nil || !strings.Contains(err.Error(), "planner_model") { |
| 33 | t.Fatalf("Build = (%v, %v), want a planner_model configuration error", ctrl, err) |
| 34 | } |
| 35 | if ctrl != nil { |
| 36 | t.Fatal("Build must not return a controller when planner_model is unusable") |
| 37 | } |
| 38 | } |
| 39 |