Skip to content

Commit 0ca17f3

Browse files
lidge-junwtfsayo
andcommitted
fix(devin): publish effective family default effort
Co-authored-by: Sayo <[email protected]>
1 parent ee1fd1c commit 0ca17f3

5 files changed

Lines changed: 23 additions & 7 deletions

File tree

‎src/adapters/devin/live-models.ts‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,6 @@ export async function fetchDevinUsableModels(opts: {
327327
const contextWindows: Record<string, number> = {};
328328
// Effort rungs per base, recovered from the suffixes the collapse strips.
329329
const rungs = new Map<string, Set<string>>();
330-
const defaultRungs = new Map<string, string>();
331330
// supportsImages votes per base; only rows that asserted field #5 vote.
332331
const imageVotes = new Map<string, { sawTrue: boolean; sawFalse: boolean }>();
333332
for (const entry of catalog.byUid.values()) {
@@ -342,7 +341,6 @@ export async function fetchDevinUsableModels(opts: {
342341
const found = family
343342
? (familyRung && REASONING_RUNG_TOKENS.has(familyRung) ? [familyRung] : [])
344343
: devinReasoningRungsOf(entry.modelUid);
345-
if (family && entry.isFamilyDefault && familyRung) defaultRungs.set(base, familyRung);
346344
if (found.length > 0) {
347345
let set = rungs.get(base);
348346
if (!set) { set = new Set(); rungs.set(base, set); }
@@ -376,8 +374,11 @@ export async function fetchDevinUsableModels(opts: {
376374
if (set.size > 1) efforts[base] = sortDevinRungs(set);
377375
}
378376
const defaultEfforts: Record<string, string> = {};
379-
for (const [base, rung] of defaultRungs) {
380-
if (efforts[base]?.includes(rung)) defaultEfforts[base] = rung;
377+
for (const [base, members] of devinFamiliesOf(catalog)) {
378+
if (!members.some((member) => member.isFamilyDefault)) continue;
379+
const selected = selectDevinFamilyMember(members, {});
380+
const rung = selected && devinFamilyEffortOf(selected);
381+
if (rung && efforts[base]?.includes(rung)) defaultEfforts[base] = rung;
381382
}
382383
// supportsImages arrives tri-state per catalog row, so the collapse votes:
383384
// a row that never asserted field #5 abstains, which keeps an unsuffixed

‎src/codex/catalog/provider-models.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ export async function fetchProviderModelsWithAuth(
424424
// away, and every client that keys an effort control off this field —
425425
// the Pi-shaped exports — renders no control at all.
426426
...(liveResult.efforts[id]?.length ? { reasoningEfforts: liveResult.efforts[id] } : {}),
427-
// The family's catalog default member, so an unset picker lands where Cognition does.
427+
// The family's effective enabled default, matching an unset effort at request time.
428428
...(liveResult.defaultEfforts[id] ? { defaultReasoningEffort: liveResult.defaultEfforts[id] } : {}),
429429
// The account catalog's per-base supportsImages vote collapses to one
430430
// modalities value. It spreads before the hints so exact

‎structure/catalog.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ in-flight publication; unrelated unscoped rows require no credential lookup.
226226
A Devin live row spreads its measured `inputModalities` before
227227
`catalogHintsFromProviderConfig`, so exact `modelCapabilities` declarations, the legacy
228228
`modelInputModalities` record and the vision-sidecar rewrite keep precedence and the live
229-
value survives only when none of them applies. Devin live rows collapse by catalog family (so `swe-1-6-fast` stays its own row), read their ladder from the family effort axis (including `minimal`), and carry the family default member's effort as `defaultReasoningEffort`; `swe-1-6` is marked text-only because it drops images without an error.
229+
value survives only when none of them applies. Devin live rows collapse by catalog family (so `swe-1-6-fast` stays its own row), read their ladder from the family effort axis (including `minimal`), and carry the effective enabled default member's effort as `defaultReasoningEffort` when the family marks a default; `swe-1-6` is marked text-only because it drops images without an error.
230230

231231
For `liveModels: false`, a static provider publishes the ordered union of `models` and `retainModels`. When `models` is absent or empty, its configured `defaultModel` seeds that
232232
union before retained ids; a nonempty explicit list does not import a different default.

‎structure/providers-and-adapters.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ rewrite rules and the routed-id settlement.
138138
| `src/adapters/declaration-carrier.ts`, `src/adapters/input-media-guard.ts` | Default-deny allowlists for constraints the normalized request carries but a wire may not be able to express: `tools[*].allowed_callers`, which fences a tool off from callers, and inline document bytes. Both are refused with a 400 at the single guard every registered adapter passes through, rather than left to each adapter, because an adapter that never learned about the carrier rebuilds without it and answers normally. `allowed_callers` reaches the `anthropic` wire; document bytes reach `anthropic`, `openai-chat` and `google`; the `openai-responses` wire is exempt from the whole guard because it forwards the original body. Adding an `AdapterWire` member makes the omission visible in these lists instead of at a customer's upstream. The unrestricted `["direct"]` caller default is not a restriction. |
139139
| `src/adapters/azure.ts` | Azure OpenAI bridge. |
140140
| `src/adapters/cursor.ts`, `src/adapters/cursor/` | Cursor protobuf transport: discovery, request builder, event decoding, MCP, thread continuity, native-exec policy. |
141-
| `src/adapters/devin.ts`, `src/adapters/devin/cloud-direct/` | Devin runTurn transport over Cognition Connect-RPC. `GetChatMessage` uses the Responses provider executor and shared physical-send budget; catalog, JWT, and `src/web-search/devin-executor.ts` native search support RPCs remain outside inference-send accounting. Provider-stated pre-output 429 reset delays are surfaced immediately by default, releasing shared active-turn capacity. A positive `OPENCODEX_DEVIN_STATED_RESET_WAIT_MS` explicitly enables bounded waiting and up to two replays on standalone turns, which hold that capacity until completion or cancellation. Combo children bypass that wait and surface a pre-output 429 so the next target can run. During an opted-in standalone wait, safe heartbeats commit the response preflight and keep the stream's stall watchdog fed. Invalid values fail closed to the immediate-refusal behavior. A recorded tenant host is used only for the stored account whose credential owns the transmitted key, searched in the configured provider id and then its deprecated alias; a configured, forwarded, or unmatched key uses the configured base URL or the US default. Native search previews the current route by effective adapter without mutating combo selection state, pins one admitted active-account snapshot for the request, and calls `GetWebSearchResults`, so it starts no CLI or second model. The wire model UID comes from the catalog's family metadata (`ClientModelConfig` #23/#30/#31): a family id with no effort selects the family's default member, an effort moves only the effort axis, to the lowest rung at or above it (else the highest below) while Fast Mode, 1M Context and the other axes stay at the anchor's values unless the caller asked for `fast` or a `1m` value; not lowering a requested effort outranks keeping those axes (an unranked member counts as lower), a disabled row the caller named is kept when the request still selects it so the preflight names that refusal, and resolution never leaves the family. Rows without family metadata fall back to suffix resolution, whose variant scan matches the collapsed base rather than a string prefix. With no caller or configured output cap, the selected row's catalog `maxOutputTokens` fills CompletionConfiguration #2; #3 is `max_newlines` and is sent at a fixed value, never a context window. |
141+
| `src/adapters/devin.ts`, `src/adapters/devin/cloud-direct/` | Devin runTurn transport over Cognition Connect-RPC. `GetChatMessage` uses the Responses provider executor and shared physical-send budget; catalog, JWT, and `src/web-search/devin-executor.ts` native search support RPCs remain outside inference-send accounting. Provider-stated pre-output 429 reset delays are surfaced immediately by default, releasing shared active-turn capacity. A positive `OPENCODEX_DEVIN_STATED_RESET_WAIT_MS` explicitly enables bounded waiting and up to two replays on standalone turns, which hold that capacity until completion or cancellation. Combo children bypass that wait and surface a pre-output 429 so the next target can run. During an opted-in standalone wait, safe heartbeats commit the response preflight and keep the stream's stall watchdog fed. Invalid values fail closed to the immediate-refusal behavior. A recorded tenant host is used only for the stored account whose credential owns the transmitted key, searched in the configured provider id and then its deprecated alias; a configured, forwarded, or unmatched key uses the configured base URL or the US default. Native search previews the current route by effective adapter without mutating combo selection state, pins one admitted active-account snapshot for the request, and calls `GetWebSearchResults`, so it starts no CLI or second model. The wire model UID comes from the catalog's family metadata (`ClientModelConfig` #23/#30/#31): a family id with no effort anchors on the family's default member and selects the nearest enabled rung, rounding up first; an effort moves only the effort axis, to the lowest rung at or above it (else the highest below) while Fast Mode, 1M Context and the other axes stay at the anchor's values unless the caller asked for `fast` or a `1m` value; not lowering a requested effort outranks keeping those axes (an unranked member counts as lower), a disabled row the caller named is kept when the request still selects it so the preflight names that refusal, and resolution never leaves the family. Rows without family metadata fall back to suffix resolution, whose variant scan matches the collapsed base rather than a string prefix. With no caller or configured output cap, the selected row's catalog `maxOutputTokens` fills CompletionConfiguration #2; #3 is `max_newlines` and is sent at a fixed value, never a context window. |
142142
| `src/adapters/kiro.ts` and `src/adapters/kiro/` | Kiro event/tool/thinking/truncation/retry handling, including an egress-aware completion fallback, fixed public HTTP 5xx text, and closed-set status/code diagnostics. The original path is a facade over leaves for wire identity, reasoning, conversation state, token estimation, payload assembly, streaming, and the adapter. |
143143
| `src/adapters/mimo-free.ts` | Mimo Free transport (client identity + JWT). Concurrent requests share one JWT bootstrap bound only to its timeout; each request stops waiting on its own abort without cancelling the others. |
144144
| `src/adapters/command-code.ts`, `src/adapters/command-code-tool-text.ts`, `src/adapters/command-code-restored-schema.ts` | Command Code OAuth NDJSON translation. For every `xiaomi/mimo-` model, text, native calls, reasoning, and terminal decisions share one byte-bounded queue with linear queue visits. Markup is deduplicated against matching native calls; text-only restoration requires one contiguous text run, a clean finish, a declared tool, and arguments validated against supported schema constraints. A parameter-free (freeform) block may omit `</function>` but must end with `</tool_call>`; parameter blocks keep the canonical close. Markup appended after prose in the same delta is split off at the marker and held like a block that opens with `<tool_call>`; a marker split across deltas after prose is still released as text. Native, reasoning, and other intervening events interrupt a still-probing block but leave a held block held in arrival order, and the queued byte bound still flushes an unresolved envelope as text. An envelope the strict parser rejects but that opens with `<tool_call>`, closes with `</tool_call>`, and names a declared function is dropped when a native call for that same function arrives and on a clean finish; markup that parses but fits no supported schema is still released as text. Regex patterns, other unsupported constraints, and abnormal finishes fail closed. `tests/providers/command-code-tool-text-prose-split.test.ts` covers the split, the interleaved-event hold, and both drop paths. |

‎tests/providers/devin-family-resolution.test.ts‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,4 +319,19 @@ describe("family-aware picker", () => {
319319
expect(result.inputModalities["swe-1-6"]).toEqual(["text"]);
320320
expect(result.inputModalities["swe-1-6-fast"]).toEqual(["text", "image"]);
321321
});
322+
323+
test("publishes the enabled default when the marked default is disabled", async () => {
324+
const family = "devin-test-default";
325+
const catalog = catalogOf([
326+
{ uid: "default-low", family, axes: [["Reasoning Effort", 0, "Low"]] },
327+
{ uid: "default-high", family, axes: [["Reasoning Effort", 1, "High"]], isDefault: true, disabled: true },
328+
{ uid: "default-max", family, axes: [["Reasoning Effort", 2, "Max"]] },
329+
]);
330+
setCachedCatalogForTests(catalog);
331+
const result = await fetchDevinUsableModels({ apiKey: KEY, baseUrl: HOST });
332+
if (!result.ok) throw new Error(`expected ok, got ${result.error}`);
333+
expect(result.efforts[family]).toEqual(["low", "max"]);
334+
expect(result.defaultEfforts[family]).toBe("max");
335+
expect(await resolve(catalog, family)).toBe("default-max");
336+
});
322337
});

0 commit comments

Comments
 (0)