|
1 | 1 | import { describe, expect, test } from "bun:test"; |
2 | | -import { createDevinAdapter, mapOcxMessagesToDevin, mapOcxToolsToDevin } from "../../src/adapters/devin"; |
| 2 | +import { createDevinAdapter, mapOcxMessagesToDevin, mapOcxToolsToDevin, resolveWireModelUidForTests } from "../../src/adapters/devin"; |
3 | 3 | import { sanitizeToolDescriptionForCognitionForTests } from "../../src/adapters/devin/cloud-direct/chat"; |
4 | 4 | import { DEVIN_MODEL_CONTEXT_WINDOWS, DEVIN_STATIC_MODELS, collapseDevinModelUid } from "../../src/adapters/devin/live-models"; |
5 | 5 | import { parseCatalogBuffer } from "../../src/adapters/devin/cloud-direct/catalog"; |
@@ -201,3 +201,38 @@ describe("devin adapter", () => { |
201 | 201 | } |
202 | 202 | }); |
203 | 203 | }); |
| 204 | + |
| 205 | +describe("SWE-2 wire effort selection", () => { |
| 206 | + // Cognition spells SWE-2 effort as the model id, so an explicit effort has to |
| 207 | + // beat a suffix the picker already chose. Before this, swe-2-high asked for at |
| 208 | + // medium stayed high and the caller was silently ignored. |
| 209 | + test.each(["medium", "high", "max"])("an explicit %s effort overrides every SWE-2 variant", async (effort) => { |
| 210 | + for (const model of ["swe-2", "swe-2-medium", "swe-2-high", "swe-2-max", "swe-2.high"]) { |
| 211 | + expect(await resolveWireModelUidForTests(model, "unused", "unused", effort)).toBe(`swe-2-${effort}`); |
| 212 | + } |
| 213 | + }); |
| 214 | + |
| 215 | + test.each([ |
| 216 | + ["none", "medium"], ["off", "medium"], ["minimal", "medium"], |
| 217 | + ["low", "medium"], ["xhigh", "max"], ["ultra", "max"], |
| 218 | + ])("maps %s to the supported SWE-2 %s lane", async (effort, expected) => { |
| 219 | + expect(await resolveWireModelUidForTests("swe-2-high", "unused", "unused", effort)).toBe(`swe-2-${expected}`); |
| 220 | + }); |
| 221 | + |
| 222 | + // Case is normalised, which the source contribution did not do: a caller that |
| 223 | + // sends HIGH means the same lane as high. |
| 224 | + test("effort matching is case-insensitive", async () => { |
| 225 | + expect(await resolveWireModelUidForTests("swe-2-medium", "unused", "unused", "HIGH")).toBe("swe-2-high"); |
| 226 | + }); |
| 227 | + |
| 228 | + test("omitted or unknown effort preserves an explicit variant", async () => { |
| 229 | + expect(await resolveWireModelUidForTests("swe-2-high", "unused", "unused")).toBe("swe-2-high"); |
| 230 | + expect(await resolveWireModelUidForTests("swe-2-max", "unused", "unused", "future-effort")).toBe("swe-2-max"); |
| 231 | + }); |
| 232 | + |
| 233 | + test("other model families keep their existing suffix precedence", async () => { |
| 234 | + for (const model of ["claude-opus-5-medium", "gpt-5-6-sol-high", "swe-1-7-high", "swe-20-high"]) { |
| 235 | + expect(await resolveWireModelUidForTests(model, "unused", "unused", "max")).toBe(model); |
| 236 | + } |
| 237 | + }); |
| 238 | +}); |
0 commit comments