Skip to content

Claude Code. Any Model. The most powerful AI coding agent now speaks every language.

test(adapters): stub the reasoning STATUS wherever the capability is stubbed

Jack Rudenkoe49688db4113
diff --git a/packages/cli/src/adapters/effort-mapping.test.ts b/packages/cli/src/adapters/effort-mapping.test.ts
index 825e7759..4707fab4 100644
--- a/packages/cli/src/adapters/effort-mapping.test.ts
+++ b/packages/cli/src/adapters/effort-mapping.test.ts
@@ -442,6 +442,24 @@ class StubbedGLM extends GLMModelDialect {
protected override lookupReasoningCapability(): any {
return this.stub;
}
+
+ /**
+ * The stub stands in for the WHOLE catalog answer, status included.
+ *
+ * Overriding only `lookupReasoningCapability` used to be enough, because the
+ * dispatch read nothing else. It now reads the status FIRST and emits no
+ * reasoning parameter at all when the control is not known — so a stub that
+ * leaves the status unstubbed falls through to the real cache on disk, and
+ * the test's answer depends on whether the developer's machine happens to
+ * have a warm catalog. That is green locally and red in CI, which is exactly
+ * how this surfaced.
+ *
+ * A supplied stub means "the catalog describes this model"; `undefined` means
+ * "the catalog has no entry", which the two no-entry callers below rely on.
+ */
+ protected override lookupReasoningStatus(): "known" | "unknown" | undefined {
+ return this.stub ? "known" : undefined;
+ }
}
const CATALOG = {
diff --git a/packages/cli/src/adapters/effort-override.test.ts b/packages/cli/src/adapters/effort-override.test.ts
index cc1900bd..994c5dcd 100644
--- a/packages/cli/src/adapters/effort-override.test.ts
+++ b/packages/cli/src/adapters/effort-override.test.ts
@@ -4,7 +4,11 @@ import { tmpdir } from "node:os";
import { join } from "node:path";
import { type DiskCacheV2, writeAllModelsCache } from "../providers/all-models-cache.js";
import { GLMModelDialect } from "./glm-model-dialect.js";
-import { type ReasoningCapability, lookupModelReasoning } from "./model-catalog.js";
+import {
+ type ReasoningCapability,
+ lookupModelReasoning,
+ lookupModelReasoningStatus,
+} from "./model-catalog.js";
const MODEL_ID = "glm-effort-override-test";
@@ -19,6 +23,17 @@ class CatalogBackedGLMFormat extends GLMModelDialect {
protected override lookupReasoningCapability(): ReasoningCapability | undefined {
return lookupModelReasoning(this.getModelId(), this.cachePath);
}
+
+ /**
+ * Redirected alongside the capability, and for the same reason: the dispatch
+ * now reads the status first and emits nothing when the control is unknown.
+ * Leaving this one pointed at the default would read the REAL cache on disk
+ * while the capability came from this test's temp file — green on a machine
+ * with a warm catalog, red on a clean one.
+ */
+ protected override lookupReasoningStatus(): "known" | "unknown" | undefined {
+ return lookupModelReasoningStatus(this.getModelId(), this.cachePath);
+ }
}
let tempDir = "";