Skip to content

Commit 7f94c52

Browse files
committed
fix(devin): preserve the catalog image-support flag as a tri-state
parseCatalogBuffer had arms for ClientModelConfig fields 1, 4, 18 and 22 and no default, so field 5 (supports_images) was dropped by omission. Carry it on ModelCatalogEntry as an optional boolean: a present true asserts text+image support, a present false asserts text-only, and an omitted field stays unknown. It deliberately does not copy the disabled pattern, which defaults to false — collapsing unknown into text-only was the #1796 regression, and antigravity-models.ts already implements the same tri-state for its discovered catalog. The header schema comment gains the #5 row and the #18 row it never listed, and its verification claim now says which fields came from the bundled extension.js, which from a live catalog dump, and which from the public WindsurfAPI documentation. The owning structure doc records the catalog pre-flight contract. Propagation of the flag to the client catalog is a separate change.
1 parent a84e6e8 commit 7f94c52

3 files changed

Lines changed: 60 additions & 2 deletions

File tree

‎src/adapters/devin/cloud-direct/catalog.ts‎

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,19 @@
2121
* drift) we silently fall back to the chat path so a transient catalog
2222
* outage can't take chat down with it.
2323
*
24-
* Schema (verified against the bundled `extension.js`,
25-
* `exa.codeium_common_pb.ClientModelConfig`):
24+
* Schema (#1/#4/#22 verified against the bundled `extension.js`,
25+
* `exa.codeium_common_pb.ClientModelConfig`; #18 identified from a live
26+
* catalog dump against vendor-known windows; #5 corroborated against the
27+
* public WindsurfAPI `ClientModelConfig` documentation):
2628
*
2729
* GetCascadeModelConfigsResponse {
2830
* #1 client_model_configs: repeated ClientModelConfig
2931
* }
3032
* ClientModelConfig {
3133
* #1 label string
3234
* #4 disabled bool ← the gate this module reads
35+
* #5 supports_images bool ← tri-state: absent stays unknown
36+
* #18 max_input_tokens varint ← per-account context window
3337
* #22 model_uid string ← what `GetChatMessage` accepts
3438
* }
3539
*
@@ -78,6 +82,15 @@ export interface ModelCatalogEntry {
7882
* degrades: the caller keeps its static fallback instead of reporting zero.
7983
*/
8084
contextWindow?: number;
85+
/**
86+
* Image-input support from `ClientModelConfig` field #5, kept as a
87+
* tri-state: a present `true` asserts text+image support, a present
88+
* `false` asserts text-only, and an OMITTED field stays `undefined`
89+
* (unknown). Deliberately unlike `disabled`, which defaults to false —
90+
* collapsing "never asserted" into "text-only" was the #1796 regression
91+
* (see src/providers/antigravity-models.ts).
92+
*/
93+
supportsImages?: boolean;
8194
}
8295

8396
export interface CacheEntry {
@@ -113,12 +126,17 @@ export function parseCatalogBuffer(buf: Buffer, apiKey: string, host: string): C
113126
let modelUid = '';
114127
let disabled = false;
115128
let contextWindow = 0;
129+
let supportsImages: boolean | undefined;
116130
for (const sf of iterFields(f.value as Buffer)) {
117131
if (sf.num === 1 && sf.wire === 2 && Buffer.isBuffer(sf.value)) {
118132
label = (sf.value as Buffer).toString('utf8');
119133
} else if (sf.num === 4 && sf.wire === 0) {
120134
// #4 = disabled (bool, varint 0/1)
121135
disabled = sf.value === 1n;
136+
} else if (sf.num === 5 && sf.wire === 0) {
137+
// #5 = supportsImages (bool, varint 0/1). Absent stays unknown — see
138+
// ModelCatalogEntry; do not default it like disabled.
139+
supportsImages = sf.value === 1n;
122140
} else if (sf.num === 18 && sf.wire === 0) {
123141
// #18 = max input tokens. Identified by dumping a live catalog and
124142
// reading the varints back against models whose windows are known from
@@ -135,6 +153,7 @@ export function parseCatalogBuffer(buf: Buffer, apiKey: string, host: string): C
135153
label: label || modelUid,
136154
disabled,
137155
...(contextWindow > 0 ? { contextWindow } : {}),
156+
...(supportsImages !== undefined ? { supportsImages } : {}),
138157
});
139158
}
140159
}

‎structure/adapters/registry.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,13 @@ Some adapters share another adapter's routed-tool semantics while retaining inde
5151
`projectDevinCliAuthMode` rewrites any saved row that still names the retired adapter id,
5252
alongside the merge migration that retires the `devin-cli` provider id itself.
5353

54+
Before spending a chat roundtrip the adapter runs a catalog pre-flight:
55+
`src/adapters/devin/cloud-direct/catalog.ts` fetches `GetCascadeModelConfigs` and preserves
56+
`ClientModelConfig` field #4 as the per-account disabled gate, field #18 as the per-account
57+
context window, and field #5 as an optional `supportsImages` tri-state — a present value
58+
asserts image support or its absence, while an omitted field stays unknown (the #1796
59+
precedent).
60+
5461
The registry records those relationships with `contractParent`. A parent relationship does **not** mean the registry recursively constructs a parent adapter and injects it into the child. Azure and MiMo keep owning their existing internal composition. This avoids making production constructors depend on test/conformance needs and keeps this authority refactor behavior-neutral.
5562

5663
Codex Spark retirement removes model-specific exceptions from the Responses adapter, without

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

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,38 @@ describe("devin adapter", () => {
322322
expect(catalog.byUid.get("mystery-model")?.contextWindow).toBeUndefined();
323323
});
324324

325+
test("the catalog parser preserves image support as a tri-state", () => {
326+
// ClientModelConfig #5 is supports_images. encodeVarintField(5, 0) emits
327+
// real bytes ([0x28, 0x00]), so the false case is not an omission case —
328+
// and a genuinely absent field must stay unknown rather than collapse to
329+
// text-only (#1796).
330+
const vision = Buffer.concat([
331+
encodeString(1, "Vision Model"),
332+
encodeVarintField(5, 1),
333+
encodeString(22, "vision-model"),
334+
]);
335+
const textOnly = Buffer.concat([
336+
encodeString(1, "Text Model"),
337+
encodeVarintField(5, 0),
338+
encodeString(22, "text-model"),
339+
]);
340+
const unknown = Buffer.concat([
341+
encodeString(1, "Unknown Model"),
342+
encodeString(22, "unknown-model"),
343+
]);
344+
const catalog = parseCatalogBuffer(
345+
Buffer.concat([encodeMessage(1, vision), encodeMessage(1, textOnly), encodeMessage(1, unknown)]),
346+
"key",
347+
"https://server.codeium.com",
348+
);
349+
expect(catalog.byUid.get("vision-model")?.supportsImages).toBe(true);
350+
// toBe(false), not toBeFalsy: a present 0 asserts text-only.
351+
expect(catalog.byUid.get("text-model")?.supportsImages).toBe(false);
352+
// The entry must exist before its field can be asserted absent.
353+
expect(catalog.byUid.get("unknown-model")).toBeDefined();
354+
expect(catalog.byUid.get("unknown-model")?.supportsImages).toBeUndefined();
355+
});
356+
325357
test("the degraded-mode windows match what Cognition serves", () => {
326358
// This table was wrong for nine of its eleven rows because it had been
327359
// copied from each model's ORIGINAL vendor rather than measured against

0 commit comments

Comments
 (0)