Skip to content

Commit 6a456fb

Browse files
committed
fix(devin): apply explicit SWE-2 effort before model suffix
1 parent 2d3c05f commit 6a456fb

10 files changed

Lines changed: 65 additions & 3 deletions

File tree

‎docs-site/src/content/docs/reference/adapters.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,13 @@ Login opens Auth0 browser sign-in, then exchanges the Firebase ID token via
451451
- Experimental unofficial bridge; not shown in the dashboard preset by default. See the
452452
[provider guide](/guides/providers/) for login instructions.
453453

454+
For SWE-2, an explicit reasoning effort overrides an effort suffix in the model
455+
id. For example, `swe-2-high` with `medium` selects the native `swe-2-medium` UID;
456+
`xhigh`, `ultra`, and `max` select `swe-2-max`. Values below Medium select Medium
457+
and do not disable SWE-2 reasoning. Without an explicit effort, a suffixed model
458+
id is preserved. This applies to both Devin account providers through their
459+
shared adapter; other model families keep their existing suffix precedence.
460+
454461
## `devin-cli`
455462

456463
**Targets:** Cognition's `exa.api_server_pb.ApiServerService/GetChatMessage`, the same Connect

‎src/adapters/devin.ts‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,23 @@ function hasEffortSuffix(modelId: string): boolean {
4545
* If the catalog is unavailable (degraded mode): append the effort suffix
4646
* for any base id that doesn't already carry one, mirroring the catalog shape.
4747
*/
48-
async function resolveWireModelUid(
48+
export async function resolveWireModelUid(
4949
rawModelId: string,
5050
apiKey: string,
5151
host: string,
5252
reasoningEffort?: string,
5353
): Promise<string> {
54-
const modelId = normalizeDevinModelId(rawModelId);
54+
let modelId = normalizeDevinModelId(rawModelId);
55+
// SWE-2's native UIDs encode the effort. A suffix on a picker model must
56+
// not silently discard the caller's explicit reasoning selection.
57+
if (/^swe-2(?:-(?:medium|high|max))?$/.test(modelId)) {
58+
const efforts: Record<string, string> = {
59+
none: "medium", off: "medium", minimal: "medium", low: "medium",
60+
medium: "medium", high: "high", xhigh: "max", ultra: "max", max: "max",
61+
};
62+
const effort = reasoningEffort ? efforts[reasoningEffort] : undefined;
63+
if (effort) modelId = `swe-2-${effort}`;
64+
}
5565
if (hasEffortSuffix(modelId)) return modelId;
5666
const catalog = await getCachedCatalog(apiKey, host);
5767
if (catalog) {

‎structure/adapters/registry.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,10 @@ see [Combo editor routing quota](../gui-and-management-api.md#combo-editor-routi
7373
Claude replay carries [Go conversation affinity](../data-planes/inbound-compat.md#claude-affinity-at-final-go-dispatch)
7474
privately to final dispatch; preliminary route selection does not inject Go-only headers.
7575
Native Chat applies qualifying effort ceilings independently of model pins; pin selection precedes the cap and only pins or cap rewrites enter wire mapping. The [catalog effort contract](../catalog.md#ultra-reasoning-level) records the V1/compaction exemptions and caller-preservation boundary.
76+
77+
## SWE-2 model effort selection
78+
79+
`src/adapters/devin.ts` resolves an explicit SWE-2 reasoning effort to the native
80+
medium/high/max UID before accepting a suffix already present in the model id.
81+
Both Devin provider rows share this resolver. Omitted effort preserves an explicit
82+
variant; unrelated model families retain their existing suffix precedence.

‎structure/data-planes/inbound-compat.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,3 +138,5 @@ Instruction notice extraction scans fence ranges once and walks original lines b
138138
a decreasing cursor. It accepts exactly one ASCII space inside the token notice, preserves
139139
unmatched prefix bytes, and does not repeatedly scan or copy shrinking prompt prefixes.
140140
Native Chat applies qualifying effort ceilings independently of model pins; pin selection precedes the cap and only pins or cap rewrites enter wire mapping. The [catalog effort contract](../catalog.md#ultra-reasoning-level) records the V1/compaction exemptions and caller-preservation boundary.
141+
142+
The shared Devin adapter owns [SWE-2 model effort selection](../adapters/registry.md#swe-2-model-effort-selection); this UID rewrite is not a shared routing rule for other models.

‎structure/providers/chat-compat.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,3 +264,5 @@ fragments are not guessed onto pending ID-only calls.
264264
parallel/colliding identities, distinct unsafe raw JSON index literals, the maximum
265265
safe-integer boundary, invalid index types, missing/null continuations and UTF-8
266266
byte-limit boundaries.
267+
268+
The shared Devin adapter owns [SWE-2 model effort selection](../adapters/registry.md#swe-2-model-effort-selection); this UID rewrite is not a shared routing rule for other models.

‎structure/providers/cursor.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,5 @@ constraints cannot widen the canonical shape. Bare shell bridge names are reject
8282
on the freeform path.
8383
Namespaced tools do not acquire bare-shell behavior. Regression coverage lives in
8484
`tests/providers/cursor/cursor-tool-definitions.test.ts`.
85+
86+
The shared Devin adapter owns [SWE-2 model effort selection](../adapters/registry.md#swe-2-model-effort-selection); this UID rewrite is not a shared routing rule for other models.

‎structure/runtime.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,3 +237,5 @@ The lightweight top-level CLI help counts Cline CLI among the fifteen registered
237237
Devin CLI credential path composition in `src/oauth/devin-cli.ts` follows the selected platform: Windows uses Win32 APPDATA paths, other platforms use POSIX XDG-data paths. The explicit absolute override remains verbatim; credential parsing and login behavior are unchanged.
238238

239239
Native Chat applies qualifying effort ceilings independently of model pins; pin selection precedes the cap and only pins or cap rewrites enter wire mapping. The [catalog effort contract](catalog.md#ultra-reasoning-level) records the V1/compaction exemptions and caller-preservation boundary.
240+
241+
The shared Devin adapter owns [SWE-2 model effort selection](adapters/registry.md#swe-2-model-effort-selection); this UID rewrite is not a shared routing rule for other models.

‎structure/transports/inventory.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,5 @@ privately to final dispatch; preliminary route selection does not inject Go-only
7474
Devin CLI credential path composition in `src/oauth/devin-cli.ts` follows the selected platform: Windows uses Win32 APPDATA paths, other platforms use POSIX XDG-data paths. The explicit absolute override remains verbatim; credential parsing and login behavior are unchanged.
7575

7676
Native Chat applies qualifying effort ceilings independently of model pins; pin selection precedes the cap and only pins or cap rewrites enter wire mapping. The [catalog effort contract](../catalog.md#ultra-reasoning-level) records the V1/compaction exemptions and caller-preservation boundary.
77+
78+
The shared Devin adapter owns [SWE-2 model effort selection](../adapters/registry.md#swe-2-model-effort-selection); this UID rewrite is not a shared routing rule for other models.

‎structure/transports/responses.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,3 +524,5 @@ see [Combo editor routing quota](../gui-and-management-api.md#combo-editor-routi
524524
Claude replay carries [Go conversation affinity](../data-planes/inbound-compat.md#claude-affinity-at-final-go-dispatch)
525525
privately to final dispatch; preliminary route selection does not inject Go-only headers.
526526
Native Chat applies qualifying effort ceilings independently of model pins; pin selection precedes the cap and only pins or cap rewrites enter wire mapping. The [catalog effort contract](../catalog.md#ultra-reasoning-level) records the V1/compaction exemptions and caller-preservation boundary.
527+
528+
The shared Devin adapter owns [SWE-2 model effort selection](../adapters/registry.md#swe-2-model-effort-selection); this UID rewrite is not a shared routing rule for other models.

‎tests/providers/devin-adapter.test.ts‎

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { describe, expect, test } from "bun:test";
2-
import { createDevinAdapter, mapOcxMessagesToDevin, mapOcxToolsToDevin } from "../../src/adapters/devin";
2+
import { createDevinAdapter, mapOcxMessagesToDevin, mapOcxToolsToDevin, resolveWireModelUid } from "../../src/adapters/devin";
33
import { sanitizeToolDescriptionForCognitionForTests } from "../../src/adapters/devin/cloud-direct/chat";
44
import { DEVIN_MODEL_CONTEXT_WINDOWS, DEVIN_STATIC_MODELS, collapseDevinModelUid } from "../../src/adapters/devin/live-models";
55
import { parseCatalogBuffer } from "../../src/adapters/devin/cloud-direct/catalog";
@@ -201,3 +201,29 @@ describe("devin adapter", () => {
201201
}
202202
});
203203
});
204+
205+
describe("SWE-2 wire effort selection", () => {
206+
test.each(["medium", "high", "max"])("an explicit %s effort overrides every SWE-2 variant", async (effort) => {
207+
for (const model of ["swe-2", "swe-2-medium", "swe-2-high", "swe-2-max", "swe-2.high"]) {
208+
expect(await resolveWireModelUid(model, "unused", "unused", effort)).toBe(`swe-2-${effort}`);
209+
}
210+
});
211+
212+
test.each([
213+
["none", "medium"], ["off", "medium"], ["minimal", "medium"],
214+
["low", "medium"], ["xhigh", "max"], ["ultra", "max"],
215+
])("maps %s to the supported SWE-2 %s lane", async (effort, expected) => {
216+
expect(await resolveWireModelUid("swe-2-high", "unused", "unused", effort)).toBe(`swe-2-${expected}`);
217+
});
218+
219+
test("omitted or unknown effort preserves an explicit variant", async () => {
220+
expect(await resolveWireModelUid("swe-2-high", "unused", "unused")).toBe("swe-2-high");
221+
expect(await resolveWireModelUid("swe-2-max", "unused", "unused", "future-effort")).toBe("swe-2-max");
222+
});
223+
224+
test("other model families keep their existing suffix precedence", async () => {
225+
for (const model of ["claude-opus-5-medium", "gpt-5-6-sol-high", "swe-1-7-high", "swe-20-high"]) {
226+
expect(await resolveWireModelUid(model, "unused", "unused", "max")).toBe(model);
227+
}
228+
});
229+
});

0 commit comments

Comments
 (0)