Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
fix(daemon): preserve Claude effort for unlisted models (MUL-8112) (#9392)
Multica Eve984d8192ad0c
diff --git a/server/internal/daemon/daemon.go b/server/internal/daemon/daemon.goindex fdbc922a9e..37d242d3b2 100644--- a/server/internal/daemon/daemon.go+++ b/server/internal/daemon/daemon.go@@ -7449,9 +7449,10 @@ func skillRefFromBundle(bundle SkillData) SkillRefData {// taskModelSelection is what a task actually launches with: the model// selector plus the capability overrides that survived validation.type taskModelSelection struct {- Model string- ThinkingLevel string- ServiceTier string+ Model string+ ThinkingLevel string+ ServiceTier string+ ThinkingLevelWarning string}// resolveTaskModelSelection settles the model selector and its capability@@ -7542,7 +7543,7 @@ func resolveTaskModelSelection(// persisted level and let the CLI object, unless the binary itself has no// such effort flag (MUL-7691).if sel.ThinkingLevel != "" {- ok, err := agent.ValidateThinkingLevelWith(loadCatalog, provider, sel.Model, sel.ThinkingLevel)+ check, err := agent.CheckThinkingLevelWith(loadCatalog, provider, sel.Model, sel.ThinkingLevel)if err != nil {taskLog.Warn("thinking_level: catalog cannot validate; passing through","provider", provider,@@ -7550,12 +7551,14 @@ func resolveTaskModelSelection("thinking_level", sel.ThinkingLevel,"error", err,)- } else if !ok {+ } else if !check.Valid {taskLog.Warn("thinking_level: not valid for this (provider, model); skipping injection","provider", provider,"model", sel.Model,"thinking_level", sel.ThinkingLevel,+ "reason", check.Reason,)+ sel.ThinkingLevelWarning = fmt.Sprintf("Thinking level %q was not applied: %s. The runtime will use its default thinking level.", sel.ThinkingLevel, check.Reason)sel.ThinkingLevel = ""}}@@ -7563,6 +7566,23 @@ func resolveTaskModelSelection(return sel}+func (d *Daemon) reportThinkingLevelWarning(ctx context.Context, taskID, warning string, msgSeq *atomic.Int32, taskLog *slog.Logger) {+ if warning == "" {+ return+ }+ message := TaskMessageData{+ Seq: int(msgSeq.Add(1)),+ Type: "text",+ Content: redact.Text(warning) + "\n\n",+ CreatedAt: time.Now(),+ }+ reportCtx, cancel := context.WithTimeout(ctx, 5*time.Second)+ defer cancel()+ if err := d.client.ReportTaskMessages(reportCtx, taskID, []TaskMessageData{message}); err != nil {+ taskLog.Warn("failed to report thinking-level warning", "error", err)+ }+}+// qualifyTaskModel promotes a persisted model id to the canonical// `<provider>/<id>` selector its runtime catalog advertises, and returns the// model to actually launch with.@@ -8761,6 +8781,7 @@ func (d *Daemon) runTask(ctx context.Context, task Task, provider string, slot i// Shared across the resume-retry below so the retry's transcript rows// keep ascending seq values for the same task.var msgSeq atomic.Int32+ d.reportThinkingLevelWarning(ctx, task.ID, selection.ThinkingLevelWarning, &msgSeq, taskLog)result, tools, err := d.executeAndDrain(ctx, backend, prompt, execOpts, taskLog, task.ID, env.CodexHome, &msgSeq)if err != nil {return TaskResult{}, errdiff --git a/server/internal/daemon/model_qualify_test.go b/server/internal/daemon/model_qualify_test.goindex d04fe2e738..249a7ee5e3 100644--- a/server/internal/daemon/model_qualify_test.go+++ b/server/internal/daemon/model_qualify_test.go@@ -162,7 +162,7 @@ func TestResolveTaskModelSelectionReadsTheCatalogAtMostOnce(t *testing.T) {name: "codex without a model fails closed without reading",provider: "codex",in: taskModelSelection{ThinkingLevel: "high", ServiceTier: "priority"},- want: taskModelSelection{},+ want: taskModelSelection{ThinkingLevelWarning: `Thinking level "high" was not applied: codex requires an explicit model. The runtime will use its default thinking level.`},wantReads: 0,},{@@ -266,7 +266,7 @@ func TestResolveTaskModelSelectionPassesThroughUnverifiedCatalogs(t *testing.T){name: "claude CLI without --effort still drops the level", provider: "claude", catalog: claudeFallback([]string{}),in: taskModelSelection{Model: "claude-opus-5-5", ThinkingLevel: "high"},- want: taskModelSelection{Model: "claude-opus-5-5"},+ want: taskModelSelection{Model: "claude-opus-5-5", ThinkingLevelWarning: `Thinking level "high" was not applied: the installed CLI does not support thinking-level control. The runtime will use its default thinking level.`},},{name: "grok", provider: "grok",diff --git a/server/internal/daemon/thinking_level_warning_test.go b/server/internal/daemon/thinking_level_warning_test.gonew file mode 100644index 0000000000..c8038d4e8e--- /dev/null+++ b/server/internal/daemon/thinking_level_warning_test.go@@ -0,0 +1,129 @@+package daemon++import (+ "context"+ "net/http"+ "net/http/httptest"+ "slices"+ "strings"+ "sync/atomic"+ "testing"++ "github.com/multica-ai/multica/server/pkg/agent"+)++func TestResolveTaskModelSelectionThinkingLevelWarning(t *testing.T) {+ catalog := agent.Catalog{+ Models: []agent.Model{+ {ID: "claude-sonnet-5", Default: true, Thinking: &agent.ModelThinking{+ SupportedLevels: []agent.ThinkingLevel{{Value: "medium"}},+ }},+ {ID: "claude-haiku-4-5-20251001"},+ },+ Unavailable: []agent.UnavailableModel{{ID: "disabled[1m]"}},+ }+ for _, tc := range []struct {+ name string+ provider string+ model string+ level string+ want string+ }{+ {name: "supported", provider: "claude", model: "claude-sonnet-5", level: "medium"},+ {name: "unlisted medium", provider: "claude", model: "claude-sonnet-4-6", level: "medium"},+ {name: "unlisted max", provider: "claude", model: "claude-sonnet-4-6", level: "max"},+ {name: "no effort", provider: "claude", model: "claude-haiku-4-5-20251001", level: "medium", want: `Thinking level "medium" was not applied: model "claude-haiku-4-5-20251001" does not advertise thinking-level control. The runtime will use its default thinking level.`},+ {name: "unsupported level", provider: "claude", model: "claude-sonnet-5", level: "max", want: `Thinking level "max" was not applied: model "claude-sonnet-5" does not support this thinking level. The runtime will use its default thinking level.`},+ {name: "unavailable", provider: "claude", model: "disabled", level: "max", want: `Thinking level "max" was not applied: model "disabled" is unavailable in the installed CLI. The runtime will use its default thinking level.`},+ {name: "Codex requires model", provider: "codex", level: "medium", want: `Thinking level "medium" was not applied: codex requires an explicit model. The runtime will use its default thinking level.`},+ {name: "OMP requires model", provider: "omp", level: "max", want: `Thinking level "max" was not applied: omp requires an explicit model. The runtime will use its default thinking level.`},+ } {+ t.Run(tc.name, func(t *testing.T) {+ stubModelDiscovery(t, map[string]agent.Catalog{tc.provider: catalog})+ sel := resolveTaskModelSelection(context.Background(), tc.provider, agent.Command{}, taskModelSelection{+ Model: tc.model, ThinkingLevel: tc.level,+ }, quietTaskLog())+ if sel.Model != tc.model || sel.ThinkingLevelWarning != tc.want {+ t.Fatalf("selection = %+v, want model %q and warning %q", sel, tc.model, tc.want)+ }+ wantLevel := tc.level+ if tc.want != "" {+ wantLevel = ""+ }+ if sel.ThinkingLevel != wantLevel {+ t.Fatalf("launch effort = %q, want %q", sel.ThinkingLevel, wantLevel)+ }+ d, rec := newTranscriptRecorder(t)+ var seq atomic.Int32+ d.reportThinkingLevelWarning(context.Background(), "task-effort", sel.ThinkingLevelWarning, &seq, quietTaskLog())+ rows := rec.snapshot()+ if tc.want == "" {+ if len(rows) != 0 || seq.Load() != 0 {+ t.Fatalf("a preserved effort should not produce a fallback warning: %+v", rows)+ }+ return+ }+ if len(rows) != 1 || rows[0].Type != "text" || rows[0].Content != tc.want+"\n\n" || rows[0].Seq != 1 || rows[0].CreatedAt.IsZero() {+ t.Fatalf("persisted warning = %+v, want a timestamped text message before runtime output", rows)+ }+ })+ }+}++func TestThinkingLevelWarningSequenceAcrossResumeRetry(t *testing.T) {+ t.Parallel()+ d, rec := newTranscriptRecorder(t)+ var seq atomic.Int32+ d.reportThinkingLevelWarning(context.Background(), "task-effort", "Thinking level was not applied.", &seq, quietTaskLog())+ for attempt := 0; attempt < 2; attempt++ {+ messages := make(chan agent.Message, 1)+ messages <- agent.Message{Type: agent.MessageText, Content: "runtime output"}+ close(messages)+ results := make(chan agent.Result, 1)+ results <- agent.Result{Status: "completed"}+ close(results)+ backend := sessionBackend{session: &agent.Session{Messages: messages, Result: results}}+ result, _, err := d.executeAndDrain(context.Background(), backend, "p", agent.ExecOptions{}, quietTaskLog(), "task-effort", "", &seq)+ if err != nil || result.Status != "completed" {+ t.Fatalf("warning must not change the task outcome: result=%+v, err=%v", result, err)+ }+ }+ rows := rec.snapshot()+ slices.SortFunc(rows, func(a, b TaskMessageData) int { return a.Seq - b.Seq })+ if len(rows) != 3 || rows[0].Content != "Thinking level was not applied.\n\n" {+ t.Fatalf("expected one warning followed by two attempts' output: %+v", rows)+ }+ for i, row := range rows {+ if row.Seq != i+1 {+ t.Fatalf("warning/retry sequence collision: %+v", rows)+ }+ }+}++func TestThinkingLevelWarningReportFailure(t *testing.T) {+ t.Parallel()+ var requests atomic.Int32+ srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {+ requests.Add(1)+ http.Error(w, "unavailable", http.StatusServiceUnavailable)+ }))+ defer srv.Close()+ d := &Daemon{client: NewClient(srv.URL)}+ var seq atomic.Int32+ d.reportThinkingLevelWarning(context.Background(), "task-effort", "Thinking level was not applied.", &seq, quietTaskLog())+ if requests.Load() != 1 || seq.Load() != 1 {+ t.Fatalf("report failure must return without retrying or reusing the sequence: requests=%d, seq=%d", requests.Load(), seq.Load())+ }+}++func TestThinkingLevelWarningRedactsBeforeReporting(t *testing.T) {+ t.Parallel()+ d, rec := newTranscriptRecorder(t)+ var seq atomic.Int32+ secret := "sk-" + strings.Repeat("a", 48)+ d.reportThinkingLevelWarning(context.Background(), "task-effort", "Model "+secret+" does not support effort.", &seq, quietTaskLog())+ rows := rec.snapshot()+ if len(rows) != 1 || strings.Contains(rows[0].Content, secret) {+ t.Fatalf("warning must be redacted before leaving the daemon: %+v", rows)+ }+}diff --git a/server/pkg/agent/claude_models_test.go b/server/pkg/agent/claude_models_test.goindex a827de8d16..4e48aae589 100644--- a/server/pkg/agent/claude_models_test.go+++ b/server/pkg/agent/claude_models_test.go@@ -2,6 +2,7 @@ package agentimport ("context"+ "errors""os""path/filepath""reflect"@@ -164,6 +165,32 @@ func TestClaudeModelsFromInfos_CurrentCLI(t *testing.T) {}}+func TestValidateThinkingLevel_ClaudeModelMissingFromLiveCatalog(t *testing.T) {+ t.Parallel()+ infos, err := parseClaudeModelCatalog(loadClaudeListModelsFixture(t, "2.1.258"))+ if err != nil {+ t.Fatal(err)+ }+ models, unavailable := claudeModelsFromInfos(infos)+ load := func() (Catalog, error) {+ return Catalog{Models: models, Unavailable: unavailable}, nil+ }+ for _, level := range []string{"medium", "max"} {+ ok, err := ValidateThinkingLevelWith(load, "claude", "claude-sonnet-4-6", level)+ if ok || !errors.Is(err, errUnverifiedCatalog) {+ t.Errorf("sonnet-4-6/%s = (%v, %v), want unknown capability so the saved effort passes through", level, ok, err)+ }+ ok, err = ValidateThinkingLevelWith(load, "claude", "claude-sonnet-5", level)+ if !ok || err != nil {+ t.Errorf("sonnet-5/%s = (%v, %v), want supported", level, ok, err)+ }+ ok, err = ValidateThinkingLevelWith(load, "claude", "claude-haiku-4-5-20251001", level)+ if ok || err != nil {+ t.Errorf("haiku-4-5/%s = (%v, %v), want rejected", level, ok, err)+ }+ }+}+// TestClaudeModelsFromInfos_OldCLIDisabledRow is the regression this whole// change exists for. On 2.1.246 the catalog must NOT offer Fable 5.1 as// selectable — that combination is the guaranteed 400 from the issue — and mustdiff --git a/server/pkg/agent/thinking.go b/server/pkg/agent/thinking.goindex 253cade919..14e22ae19c 100644--- a/server/pkg/agent/thinking.go+++ b/server/pkg/agent/thinking.go@@ -675,6 +675,10 @@ func catalogLoader(ctx context.Context, providerType string, cmd Command) func()// map. The function is intentionally pure of HTTP concerns so the// daemon's pre-execution guard and the server's UpdateAgent gate can// share the same source of truth.+//+// An explicit Claude model absent from both the selectable and unavailable+// lists is also unknown: list_models is a picker, not an exhaustive list of+// accepted --model values. Its saved effort passes through with a lookup error.func ValidateThinkingLevel(ctx context.Context, providerType string, cmd Command, model, value string) (bool, error) {return ValidateThinkingLevelWith(catalogLoader(ctx, providerType, cmd), providerType, model, value)}@@ -691,8 +695,24 @@ func ValidateThinkingLevel(ctx context.Context, providerType string, cmd Command// (#3729, MUL-5549), so each read costs the ceiling again on a logged-out or// timing-out runtime (MUL-6471 review).func ValidateThinkingLevelWith(loadCatalog func() (Catalog, error), providerType, model, value string) (bool, error) {+ check, err := CheckThinkingLevelWith(loadCatalog, providerType, model, value)+ return check.Valid, err+}++// ThinkingLevelCheck distinguishes a confirmed rejection from a capability+// lookup that failed. Reason describes only confirmed rejections; lookup errors+// leave the saved level for the CLI to resolve.+type ThinkingLevelCheck struct {+ Valid bool+ Reason string+}++// CheckThinkingLevelWith also explains a rejected level so the daemon can+// disclose the fallback in the task transcript. The catalog is loaded at most+// once, just as in ValidateThinkingLevelWith.+func CheckThinkingLevelWith(loadCatalog func() (Catalog, error), providerType, model, value string) (ThinkingLevelCheck, error) {if value == "" {- return true, nil+ return ThinkingLevelCheck{Valid: true}, nil}// Empty-model fail-closed, checked BEFORE the catalog load so the outcome is// deterministic even when discovery would error. That ordering is the whole@@ -700,17 +720,21 @@ func ValidateThinkingLevelWith(loadCatalog func() (Catalog, error), providerType// (see its thinking_level guard), which is exactly what must not happen for// a provider whose effective model we cannot know.if model == "" && ThinkingRequiresExplicitModel(providerType) {- return false, nil+ return ThinkingLevelCheck{Reason: fmt.Sprintf("%s requires an explicit model", providerType)}, nil}catalog, err := loadCatalog()if err != nil {- return false, err+ return ThinkingLevelCheck{}, err}if catalog.CLIThinkingLevels != nil && !slices.Contains(catalog.CLIThinkingLevels, value) {- return false, nil+ reason := "the installed CLI does not accept this thinking level"+ if len(catalog.CLIThinkingLevels) == 0 {+ reason = "the installed CLI does not support thinking-level control"+ }+ return ThinkingLevelCheck{Reason: reason}, nil}if !catalog.Verified() {- return false, fmt.Errorf("%w; cannot validate %s thinking level %q", errUnverifiedCatalog, providerType, value)+ return ThinkingLevelCheck{}, fmt.Errorf("%w; cannot validate %s thinking level %q", errUnverifiedCatalog, providerType, value)}models := catalog.Modelstarget := modelIDForCapabilityLookup(providerType, model)@@ -730,9 +754,19 @@ func ValidateThinkingLevelWith(loadCatalog func() (Catalog, error), providerType// advertised model supports. Providers that instead require a pinned// model never reach here — they were already rejected above.if providerType == "opencode" {- return anyModelSupportsThinkingValue(models, value), nil+ if anyModelSupportsThinkingValue(models, value) {+ return ThinkingLevelCheck{Valid: true}, nil+ }+ return ThinkingLevelCheck{Reason: "no discovered model supports this thinking level"}, nil+ }+ return ThinkingLevelCheck{Reason: "the runtime's default model could not be resolved"}, nil+ }+ }+ if providerType == "claude" {+ for _, unavailable := range catalog.Unavailable {+ if modelIDForCapabilityLookup(providerType, unavailable.ID) == target {+ return ThinkingLevelCheck{Reason: fmt.Sprintf("model %q is unavailable in the installed CLI", target)}, nil}- return false, nil}}for _, m := range models {@@ -746,23 +780,29 @@ func ValidateThinkingLevelWith(loadCatalog func() (Catalog, error), providerTypecontinue}if m.Thinking == nil {- return false, nil+ return ThinkingLevelCheck{Reason: fmt.Sprintf("model %q does not advertise thinking-level control", target)}, nil}for _, lvl := range m.Thinking.SupportedLevels {if lvl.Value == value {- return true, nil+ return ThinkingLevelCheck{Valid: true}, nil}}- return false, nil+ return ThinkingLevelCheck{Reason: fmt.Sprintf("model %q does not support this thinking level", target)}, nil}- return false, nil+ // Claude's picker lists selected family versions, not every model --model+ // accepts. An omitted explicit model therefore has unknown capabilities.+ // Keep malformed context modifiers rejected rather than treating them as+ // independent model IDs, and never bypass an explicit unavailable row.+ if providerType == "claude" && model != "" && !strings.ContainsAny(target, "[]") {+ return ThinkingLevelCheck{}, fmt.Errorf("%w for model %q; cannot validate claude thinking level %q", errUnverifiedCatalog, model, value)+ }+ return ThinkingLevelCheck{Reason: fmt.Sprintf("model %q was not found in the runtime catalog", target)}, nil}-// errUnverifiedCatalog is what the capability checks answer when the catalog-// they were handed is not the runtime's own (see Catalog.Verified). It is an-// error rather than a "no" on purpose: the daemon passes a value it could not-// check through to the CLI instead of discarding the user's saved choice.-var errUnverifiedCatalog = errors.New("model discovery did not return the runtime's own catalog")+// errUnverifiedCatalog means the catalog cannot establish the capability,+// either because discovery failed or because Claude's picker omitted the+// explicit model. The daemon passes the saved value through on this error.+var errUnverifiedCatalog = errors.New("model discovery could not verify the capability")// ThinkingRequiresExplicitModel reports whether a provider refuses to carry an// effort unless a model is pinned, because its empty-model resolution happensdiff --git a/server/pkg/agent/thinking_test.go b/server/pkg/agent/thinking_test.goindex 70a866e2f3..34694bace9 100644--- a/server/pkg/agent/thinking_test.go+++ b/server/pkg/agent/thinking_test.go@@ -962,8 +962,11 @@ func TestValidateThinkingLevel_ExplicitModel(t *testing.T) {// Sonnet does not advertise xhigh.check("claude-sonnet-4-6[1m]", "xhigh", false)- // A model a verified catalog does not list still fails closed (no guess).- check("claude-nonexistent", "high", false)+ // Claude's picker may omit runnable explicit models. An unlisted model is+ // unknown, rather than evidence that its saved effort is unsupported.+ if ok, err := ValidateThinkingLevelWith(claudeVerifiedCatalog, "claude", "claude-nonexistent", "high"); ok || !errors.Is(err, errUnverifiedCatalog) {+ t.Errorf("unlisted Claude model = (%v, %v), want unknown capability", ok, err)+ }}// TestValidateThinkingLevel_CodexEmptyModelFailsClosed pins the MUL-4347diff --git a/server/pkg/agent/thinking_validation_test.go b/server/pkg/agent/thinking_validation_test.gonew file mode 100644index 0000000000..65aef0af0b--- /dev/null+++ b/server/pkg/agent/thinking_validation_test.go@@ -0,0 +1,78 @@+package agent++import (+ "context"+ "errors"+ "strings"+ "testing"+)++func TestCheckThinkingLevelWith(t *testing.T) {+ t.Parallel()+ listed := Model{ID: "listed", Default: true, Thinking: &ModelThinking{+ SupportedLevels: []ThinkingLevel{{Value: "medium"}, {Value: "max"}},+ }}+ live := Catalog{Models: []Model{listed, {ID: "no-effort"}}, Unavailable: []UnavailableModel{{ID: "disabled[1m]"}}}+ for _, level := range []string{"medium", "max"} {+ for _, tc := range []struct {+ name string+ provider string+ model string+ catalog Catalog+ valid bool+ unknown bool+ reason string+ }{+ {name: "listed", provider: "claude", model: "listed", catalog: live, valid: true},+ {name: "default", provider: "claude", catalog: live, valid: true},+ {name: "unlisted Claude", provider: "claude", model: "unlisted", catalog: live, unknown: true},+ {name: "unlisted context variant", provider: "claude", model: "unlisted[1m]", catalog: live, unknown: true},+ {name: "malformed context variant", provider: "claude", model: "listed[weird]", catalog: live, reason: "not found"},+ {name: "no effort", provider: "claude", model: "no-effort", catalog: live, reason: "does not advertise thinking-level control"},+ {name: "disabled", provider: "claude", model: "disabled", catalog: live, reason: "unavailable"},+ {name: "old CLI", provider: "claude", model: "unlisted", catalog: Catalog{Models: live.Models, CLIThinkingLevels: []string{}}, reason: "CLI does not support"},+ {name: "CLI vocabulary", provider: "claude", model: "unlisted", catalog: Catalog{Models: live.Models, CLIThinkingLevels: []string{"high"}}, reason: "CLI does not accept"},+ {name: "fallback", provider: "claude", model: "listed", catalog: Catalog{Models: live.Models, Fallback: true}, unknown: true},+ {name: "empty catalog", provider: "claude", model: "listed", unknown: true},+ {name: "missing default", provider: "claude", catalog: Catalog{Models: []Model{{ID: "other"}}}, reason: "default model could not be resolved"},+ {name: "Codex explicit", provider: "codex", model: "unlisted", catalog: live, reason: "not found"},+ {name: "OMP explicit", provider: "omp", model: "unlisted", catalog: live, reason: "not found"},+ {name: "OpenCode explicit", provider: "opencode", model: "unlisted", catalog: live, reason: "not found"},+ {name: "Codex default", provider: "codex", catalog: live, reason: "codex requires an explicit model"},+ {name: "OMP default", provider: "omp", catalog: live, reason: "omp requires an explicit model"},+ } {+ t.Run(level+"/"+tc.name, func(t *testing.T) {+ reads := 0+ check, err := CheckThinkingLevelWith(func() (Catalog, error) {+ reads+++ return tc.catalog, nil+ }, tc.provider, tc.model, level)+ if check.Valid != tc.valid || errors.Is(err, errUnverifiedCatalog) != tc.unknown || (err != nil && !tc.unknown) {+ t.Fatalf("got (%+v, %v), want valid=%v, unknown=%v", check, err, tc.valid, tc.unknown)+ }+ if !strings.Contains(check.Reason, tc.reason) || (tc.reason == "" && check.Reason != "") {+ t.Errorf("reason = %q, want %q", check.Reason, tc.reason)+ }+ wantReads := 1+ if tc.model == "" && ThinkingRequiresExplicitModel(tc.provider) {+ wantReads = 0+ }+ if reads != wantReads {+ t.Errorf("catalog reads = %d, want %d", reads, wantReads)+ }+ })+ }+ }+ t.Run("known unsupported level", func(t *testing.T) {+ check, err := CheckThinkingLevelWith(func() (Catalog, error) { return live, nil }, "claude", "listed", "high")+ if err != nil || check.Valid || !strings.Contains(check.Reason, "does not support this thinking level") {+ t.Fatalf("got (%+v, %v), want a confirmed unsupported-level rejection", check, err)+ }+ })+ t.Run("lookup failure", func(t *testing.T) {+ check, err := CheckThinkingLevelWith(func() (Catalog, error) { return Catalog{}, context.DeadlineExceeded }, "claude", "listed", "medium")+ if !errors.Is(err, context.DeadlineExceeded) || check.Valid || check.Reason != "" {+ t.Fatalf("got (%+v, %v), want lookup failure without a rejection reason", check, err)+ }+ })+}