Repository navigation
Conversation
Both boundaries that read a live provider descriptor - the bundled catalog projection and the account catalog's relay projection - keep an empty `modalities` array today and let it overwrite the row's set. The cases fail against the current projection: the identified row's set, the `vision` fallback, an explicit non-empty array and the shipped deepseek-v4.1-flash declaration are each asserted through the boundary that reads them.
A live provider descriptor that writes `modalities: []` overwrote the set the identified catalog row declares, so the account relay's `deepseek-v4.1-flash` listing turned the shipped `["text", "image"]` into `[]`: the snapshot read `vision: true` with no input modality, and a model whose modalities hold no `text` is refused for conversation. The bundled-catalog projection and the account catalog's relay projection now read a descriptor's modalities through one boundary function and resolve them with one rule: an explicit non-empty array stays, an empty array is undeclared and takes the identified row's non-empty set, and a model no row declares falls back to `["text", "image"]` under `vision: true` and `["text"]` otherwise. A remote listing's empty `modalities.input` states no `vision` flag either.
A malformed top-level `modalities` value is not a statement about the model, so it must not shadow the nested `capabilities.modalities` array a user model or an edit supplies. The reader takes each shape only when it is an array and falls through otherwise (#1980).
zerob13
left a comment
There was a problem hiding this comment.
The new projection covers a fresh listing with an empty array and a matching vision-enabled catalog row. Two gaps remain for #1980:
- An undeclared field can still override live capability data. The shared parser chooses the top-level array before checking whether it is nonempty, so
modalities: []can hide a nested nonempty declaration. The relay supplies only top-level vision to fallback, even when nested vision is published. The shared helper also returns bundled image modalities before considering explicitvision: false. Verify that both projections preserve nonempty declarations, use the same effective vision value for the snapshot and inferred fallback, and do not infer image support from a bundled row when a live descriptor explicitly denies vision and declares no modalities. - Existing saved entries still return the original empty array until refresh. The fix is on fresh projection; normal managed reads and static reads still serve saved modalities. Verify an existing pre-upgrade catalog with an empty array serves the corrected capabilities and selection for a fresh request without waiting for a successful network refresh. This does not require changing previously adopted session snapshots.
These are source findings; no live provider calls. Exact CI had macOS native green and Linux workspace verification pending at the evidence snapshot.
yyhhyyyyyy
left a comment
There was a problem hiding this comment.
Round 1 at 1f0b2173. The PR fixes #1980: a live descriptor that writes modalities: [] must read as undeclared, so the identified row's non-empty set, or the descriptor's vision flag when no row matches, decides. The bundled projection and the account relay share declared_modalities and effective_modalities, and an empty remote modalities.input no longer infers vision: false.
I agree with the existing review that non-empty nested declarations and stored entries still need coverage. Two P2s remain.
-
An empty top-level
modalitiesarray hides a non-empty nestedcapabilities.modalitiesarray.declared_modalities(crates/dim-app-server/src/model_catalog.rs:1315-1327) takes the top-level value whenever it is an array and only otherwise reads the nested one, somodalities: []becomesNonebefore nested is considered. Failure scenario: a descriptor{"modalities": [], "capabilities": {"modalities": ["text", "image"]}}for a model no row declares and with no top-levelvisionresolves to["text"]; the nested image declaration disappears. The contract at docs/design/appserver/provider-management.md section 3.5 says an empty array states nothing and the rule covers the nested array. Fix: take the first non-empty array, top-level when non-empty and nested otherwise. -
Existing saved catalogs still serve the empty array until a refresh replaces the record. The fix runs at projection time (model_catalog.rs:589-593 and :1070-1074, crates/dim-oauth/src/models.rs:446-453). Reads that clone a stored entry (crates/dim-app-server/src/provider.rs:559-581 and :1138-1171; crates/dim-app-server/src/provider/query.rs:296; provider.rs:2016) still return the persisted capabilities because
identify_entry(model_catalog.rs:767-800) fills only limits. A static remote listing or aManagedModel.entrysaved before this fix keepsmodalities: [](provider.rs:286-291; crates/dim-app-server/src/managed_provider.rs:59-62). Failure scenario: a user upgrades with such a catalog and the provider cannot refresh;provider.catalogfor a static provider and the target/query reads for a managed account still reportvision: true, modalities: [], andchat_only_unavailable(provider.rs:1280) marks the model unavailable for conversation, which is the state #1980 accepts must stop. Fix: resolve empty stored modalities on read with the identified row and the effective vision, or normalize stored records on load; adopted Session snapshots can stay as the PR states.
Optional P3: the fallback reads only the top-level vision flag. A descriptor with capabilities: {"vision": true}, no top-level vision or modalities, and no row gets caps.vision = true from apply_capabilities (model_catalog.rs:1828) while effective_modalities receives None (model_catalog.rs:1070-1074) and returns ["text"]; the relay has the same split (crates/dim-oauth/src/models.rs:436-445 versus :446-453). Passing the effective vision (top-level when declared, otherwise nested) would make the boundaries agree with the rule that a descriptor stating vision: true and no modalities takes ["text", "image"].
The fresh paths check out: an identified row keeps its set for an empty top-level or nested array, a model no row declares follows the top-level vision flag, an explicit non-empty array stays authoritative, an empty remote modalities.input writes neither the set nor a flag, and the EN/ZH section 3.5 text matches those cases. I ran the three new focused tests at this head; all pass:
- model_catalog_flow::an_empty_modalities_array_is_the_undeclared_value
- provider_flow::an_empty_listing_modalities_input_keeps_the_identified_rows_declaration
- dim_oauth_flow::an_empty_relay_modalities_array_is_the_undeclared_value
CI at review time is green, including verify (linux) and ci-ok. No old comments need withdrawal; there are no inline threads.
| let declared = input | ||
| .get("modalities") | ||
| .and_then(Value::as_array) | ||
| .or_else(|| { |
There was a problem hiding this comment.
Problem: an empty top-level modalities array is taken as the declaration before the nested one is considered, so it hides a non-empty capabilities.modalities array. Failure scenario: {"modalities": [], "capabilities": {"modalities": ["text", "image"]}} for a model no row declares and with no top-level vision resolves to ["text"], losing the nested image declaration. Evidence: crates/dim-app-server/src/model_catalog.rs:1315-1327; the contract says an empty array states nothing and the rule covers the nested array (docs/design/appserver/provider-management.md section 3.5). Fix: take the first non-empty array, top-level when non-empty and nested otherwise.
Summary
Fixes #1980.
A live provider descriptor that writes
"modalities": []overwrote the set theidentified catalog row declares. The shipped
deepseek-v4.1-flashrows declare["text", "image"]; the account relay reports[], so the runtime snapshotbecame
{"vision": true, "modalities": []}. Besides the UI andmodality.capabilitiesreading the model as accepting no image, a model whosemodalities hold no
textis refused for conversation, so the empty array couldtake a shipped vision model out of use.
An empty array is the undeclared value, not a statement that the model reads
nothing. Both boundaries that read a live descriptor — the bundled-catalog
projection (
crates/dim-app-server/src/model_catalog.rs) and the accountcatalog's relay projection (
crates/dim-oauth/src/models.rs) — now share onereading of a descriptor's modalities (
declared_modalities) and one resolution(
effective_modalities):modalitiesarray stays authoritative;modalities: []never overwrites a declaration the row makes;
["text", "image"]when it statesvision: true, and["text"]otherwise.The same reading covers the nested
capabilities.modalitiesarray. The remotelisting's
modalities.inputarray also states novisionflag when it is empty(
crates/dim-app-server/src/provider/remote.rs), instead of inferringvision: falsefrom it and then keeping a row's image modality beside it.An explicit
vision: falsedoes not add the image fallback; it does not erase aset the identified row declares either, which is the existing rule for a
descriptor that states no modalities.
The projection rule is stated in
docs/design/appserver/provider-management.md
(§3.5) beside the other effective-catalog rules, with the
docs/zh/mirror.The PR starts with the failing boundary tests (
64ae6a6); the fix and thedesign statement follow in
1e96df6, and1f0b217keeps a malformed top-levelmodalitiesvalue from shadowing the nestedcapabilities.modalitiesarray.Design rule checklist
projection of its own descriptors.
external descriptors and change no state.
before: n/a — no Timeline event is written or transformed.is about the external descriptor boundary, not a provider or model name.
capabilities.modalitiesstays a string array and the management reads keep their shape.
semantics, not configuration.
Documentation
(
docs/design/appserver/provider-management.md§3.5, with thedocs/zh/mirror); no other module's design is changed.Verification
Red step (
64ae6a6, before the fix):After the fix (
1e96df6,1f0b217), withCARGO_TARGET_DIR=/mnt/data/dim-targets/1980 CARGO_BUILD_JOBS=2:The whole
cargo test --locked -p dim-app-serverrun reported 705 passed and 2failed in
transport_flow; neither is a modalities case, and each passes alone: