Repository navigation
Conversation
A serviceTier declaration means the model offers the tiers it lists, so `supported: true` must state a usable set: non-empty `options` and a `default` among them. The flow test reads both `provider.refresh` and `provider.management` for a declaration with options, one without any, one with an empty list, one that is unsupported, and one whose default is outside its options, then checks which tiers `provider.preferences.update` accepts. Refs #2248
`ModelServiceTier` now states one of two shapes: a usable set, with non-empty `options` and a `default` among them, or no capability at all. `usable()` resolves a declaration to that shape, and the two entry builders of the catalog read apply it after identification: `project` covers the descriptors a listing or an account catalog supplies, and `effective_models` covers the entries a record serves. Identification still fills a declaration that names no options of its own before the capability is read, so a model whose catalog row enumerates its tiers keeps them. `provider.management` therefore no longer advertises a supported tier set with nothing to offer, and `preferences.update` keeps refusing every tier such a model does not offer. No new state is introduced: an unenumerable declaration simply reads as unsupported. Fixes #2248
An account catalog's model entry reaches the record through the account provider's own reply, not through the descriptor projection, so the capability read had to resolve it as well. `ProviderRecord::effective_models` is the one derivation its catalog, management view and whole-set write read, so the resolution lives there: a stored declaration that lists no options reads as unavailable, and an older record written before this rule stays readable. Refs #2248
zerob13
left a comment
There was a problem hiding this comment.
The ordinary empty-options case is fixed, but three behaviors still prevent treating the advertised tier list as authoritative:
- Reject unusable advertised choices. In isolated read/write fixtures, empty strings from typed options or direct listing still become selectable tiers, and an Anthropic route advertises
priorityalthough its write rejects it. Verify that every advertised option is accepted by the same route and malformed or unrepresentable choices are not advertised. Normalize · Write gate - Do not turn an absent or invalid default into an automatic selection. With only
priorityavailable and no valid declared default, a managed fixture now adoptsprioritywithout a preference. Verify that valid declared defaults and explicit or saved values still apply, and that absent or invalid defaults leave adoption unchanged. Default handling - Keep unresolved declarations distinct from explicit denial in storage. An unmatched
serviceTier: truediscovery is persisted as unsupported. After a subsequent alias identifies a catalog row with options, that stored denial still prevents them from filling in. A disposable catalog round trip reproduced it. Verify that later identification can supply choices to the unresolved declaration while an explicit false still suppresses them. Discovery · Merge
The three new tests and existing static-provider flow passed on the tested merge. The findings are from additional isolated fixtures. Exact CI remains independent. No Desktop requirement is part of this review.
yyhhyyyyyy
left a comment
There was a problem hiding this comment.
The direction is right: a service-tier declaration should be a capability, and ModelServiceTier::usable() plus resolution in the three entry builders gives provider.management, the catalog and the preference write one shape. The blocking problem is that usable() also invents a default.
usable() falls back to the option named default, else the first option, even when the declaration states no default (crates/dim-agent-types/src/model.rs:269-272). declared_service_tier then treats that invented value as the model's declared default (crates/dim-app-server/src/provider/preferences.rs:145-150), and catalog_defaults applies it to every untouched adoption (crates/dim-app-server/src/provider/preferences.rs:11-39). A declaration {supported: true, options: ["priority", "default"]} therefore adopts serviceTier: "default" and context/configured publishes model_preferences.serviceTier, although the user stated no preference. The existing flow test transport_flow::product_protocol::the_configured_view_reads_back_the_adopted_model_preferences fails on exactly this (crates/dim-app-server/tests/transport_flow/product_protocol.rs:2686-2688), and the same invented value comes back when a user clears the tier (crates/dim-app-server/src/provider.rs:2901-2903), so an omitted tier can no longer be restored. This changes how an untouched model is applied, which the issue boundary excludes, and contradicts default, when present, in the new paragraph.
Fix: keep default: None when the declaration states none, and only replace a stated default that is outside options with the option named default, else the first one. None of the new tests depends on an invented default, so that rule keeps them passing; add a case for options without a default and adjust the last sentence of the new paragraph to match.
One optional note on the account record builder is inline.
Verification: cargo test -p dim-app-server --test app_server_flow service_tier -> 3 passed (model_catalog_flow, provider_flow, managed_provider_flow); cargo test -p dim-agent-types -> 48 passed; the failing product_protocol test was reproduced locally at this head, and model_get::a_reloading_active_line_keeps_its_error passes locally (its CI failure is a shutdown Cancelled("prompt adoption")). CI: verify (linux) fails on those two tests, while changes, evaluate-pr, issue-gate, macos-native and windows-cli pass. Cross-PR: #2321 also edits crates/dim-app-server/tests/model_catalog_flow.rs and the two heads conflict there; source files merge cleanly.
| options: Vec::new(), | ||
| }; | ||
| } | ||
| let default = default |
There was a problem hiding this comment.
Blocking: usable() returns a default even when the declaration states none. For {supported: true, options: ["priority", "default"]} the chain at lines 269-272 returns Some("default"). declared_service_tier (crates/dim-app-server/src/provider/preferences.rs:145-150) then seeds catalog_defaults from it, so an untouched adoption sends serviceTier: "default" and context/configured publishes model_preferences.serviceTier, while the existing flow test expects no preference (crates/dim-app-server/tests/transport_flow/product_protocol.rs:2686-2688). Clearing the tier restores the invented value too (crates/dim-app-server/src/provider.rs:2901-2903), so omitting the tier becomes impossible. Fix: keep None when no default is declared; only replace a stated default that is outside options. Add a case for options without a default.
| None => source.entry.clone(), | ||
| }; | ||
| bundled.identify_entry(&projection, &mut entry); | ||
| entry.resolve_service_tier(); |
There was a problem hiding this comment.
Optional (P3): this builder resolves the declaration but never adopts an identified row's options. identify_entry fills only the two limits (crates/dim-app-server/src/model_catalog.rs:676-716), while merge_entry fills serviceTier.options when the declaration lists none (crates/dim-app-server/src/model_catalog.rs:1217-1228). A managed catalog entry declaring supported: true with no options therefore reads as supported: false even when its identified row enumerates options, and the new paragraph (docs/design/appserver/provider-management.md:560-567) says the row it is identified with is consulted. No current managed catalog declares serviceTier, so this is dormant; either adopt the row's options here or scope the sentence to the builders that merge a row.
A supported declaration that names no default does not gain one: the adoption of such a model sends no tier, exactly as before. Only a default the options do not offer is replaced, by the option named `default`, else the first one, so a named default is always one the model offers. The projection still states a default for a catalog declaration by its own rule, so a catalog model keeps adopting the tier it declares. Refs #2248
zerob13
left a comment
There was a problem hiding this comment.
The omitted typed default now stays absent on adoption and clear. The previously failing configured-view transport test passes, and valid declared, saved and explicit tiers still work. The remaining parts of the previous review are:
- Empty strings from typed options and raw listings are still advertised and rejected on write, and an Anthropic route still advertises a tier it cannot write. Verify every advertised option is usable on that route. Read normalization · Write gate
- An invalid typed default still selects a tier on adoption and clear. The listing parser also still assigns a default to options-only raw data. Verify both paths leave the tier unset if no valid default was declared.
- Discovery still persists an unresolved declaration as explicit denial. Verify an upgraded match can supply options later without making an explicitly unsupported model selectable.
All three remaining cases reproduced in isolated fixtures on the exact merge. The three tier tests, configured-view transport test and static-provider lifecycle flow passed. The separate intermittent reload cancellation remains unattributed; hosted CI is a separate gate.
yyhhyyyyyy
left a comment
There was a problem hiding this comment.
The previous blocking point is fixed: usable() now keeps default: None when the declaration states none (crates/dim-agent-types/src/model.rs:269-279), the existing flow test at crates/dim-app-server/tests/transport_flow/product_protocol.rs:2686-2688 passes, and the three new service-tier tests pass.
I agree with the open condition that an absent default must not become an automatic selection; the remaining source is earlier in the pipeline. Listing and descriptor entries are built through service_tier() before usable() runs, and that parser ends with a fallback to the option named default, else the first option (crates/dim-app-server/src/model_catalog.rs:1773-1775). descriptor_entry calls it (:1137), and BundledCatalog::project is the builder for provider listings and temporary Session startup (crates/dim-app-server/src/provider/remote.rs:345, crates/dim-app-server/src/provider/startup.rs:346). At this head, projecting a custom descriptor {"id": "zzzz-private-tier", "serviceTier": {"supported": true, "options": ["priority"]}} returns {supported: true, default: "priority", options: ["priority"]}. The descriptor names no default, yet the reply carries one; an untouched adoption applies priority through declared_service_tier and catalog_defaults (crates/dim-app-server/src/provider/preferences.rs:145-150, :11-39), and clearing the tier restores it (crates/dim-app-server/src/provider.rs:2902). That is the same user-visible behavior the previous round blocked, and it contradicts the sentence added at docs/design/appserver/provider-management.md:566: a declaration that names no default offers none at adoption.
The same parser also admits an empty scalar: serviceTier: "" becomes {supported: true, default: "", options: [""]} (crates/dim-app-server/src/model_catalog.rs:1764), while configure rejects an empty tier (crates/dim-app-server/src/provider/preferences.rs:249), so the advertised set contains a choice the same route refuses.
Fix: drop the final fallback in service_tier() so an object without a stated default keeps None; a scalar's own value still names a tier, and usable() already handles a stated default outside the options. Treat an empty scalar as no declaration, and add an options-only listing case to the provider flow matrix.
The earlier optional note still stands: ProviderRecord::effective_models resolves after identify_entry without adopting an identified row's options (crates/dim-app-server/src/provider.rs:581, crates/dim-app-server/src/model_catalog.rs:778, :1217-1228); no current managed catalog declares serviceTier, so this stays optional.
Verification: cargo test -p dim-app-server --test app_server_flow service_tier -> 3 passed; cargo test -p dim-agent-types -> 48 passed; cargo test -p dim-app-server --test transport_flow the_configured_view_reads_back_the_adopted_model_preferences -> 1 passed. CI: verify (linux) in progress, macos-native and windows-cli pass, web and scripts skipped. Cross-PR: #2321 also edits crates/dim-app-server/tests/model_catalog_flow.rs; GitHub reports this PR mergeable and the source files do not conflict.
| the row it is identified with enumerates is `supported: false` with no | ||
| `default` and no `options`, and the preference patch then refuses every tier. A | ||
| `default` the options do not offer gives way to the option named `default`, else | ||
| the first one; a declaration that names no default offers none at adoption. |
There was a problem hiding this comment.
service_tier() still gives this declaration a default before usable() runs: it falls back to the option named default, else the first one (crates/dim-app-server/src/model_catalog.rs:1773-1775). A descriptor {supported: true, options: ["priority"]} reaches the reply as {supported: true, default: "priority", options: ["priority"]}, and an untouched adoption applies that tier. Removing the fallback and treating an empty scalar as absent makes this sentence true for every builder.
Summary
provider.managementcould reportserviceTier.supported: truewith nooptionswhile
provider.preferences.updaterejected every tier of that model. A client thenhas nothing authoritative to render, and the Desktop invents
['default','priority']in the meantime (arcships/dim-electron#657). That consumer change is out of scope
here and must land separately: this PR only makes the App Server's reply
authoritative, so the fallback has nothing left to work around.
The reply now has exactly one meaning per state:
serviceTierin repliessupported: truewith options and a default among them{supported: true, default, options}supported: truewith options and no default{supported: true, options}supported: true, no options enumerated{supported: false}supported: false{supported: false}defaultoption, else the first optionNo
optionsKnownflag and no second state is introduced.Design material: provider management §3.2
(the invariant is stated once there, mirrored in
docs/zh/).Where the rule applies
ModelServiceTier::usable()states the capability shape, and the three entrybuilders of the catalog read resolve their entries with it:
BundledCatalog::project— a descriptor a listing or an account catalog supplies(this is also the capability a temporary Session startup adopts);
BundledCatalog::effective_models— the entries a static Provider record serves;ProviderRecord::effective_models— the single derivation an account-ownedrecord's catalog, management view and whole-set write read.
The resolution runs after identification, not inside
service_tier(): anidentified catalog row enumerates the options a listing declares without any (for
example an account listing that states
serviceTier: truewhile the bundled rowlists
default/priority), and collapsing the declaration to unavailable at parsetime would discard those options. A declaration that nothing enumerates — the row
included — reads as
supported: false, so the delivered capability still alwayssatisfies the invariant.
preferences.updateis unchanged: it rejects a tier unless the declaration issupported and lists it, which now holds for every model. A declaration that names
no default keeps none, so an adoption of such a model sends no tier — the
projection still states a default for a catalog declaration by its existing rule.
Design rule checklist
Answer each item; write "n/a" with a reason where it does not apply. Rules: design rules §4, ADR 002.
preferences.updatekeeps its existing write and reply.beforecallbacks: n/a — no Timeline callback is touched.ModelServiceTierkeeps its wire shape; an unavailable declaration simply omitsdefault/options, which every current reader already treats as "offer nothing" (web/src/rpc/management.ts, the CLI's/fastfeature flag).Documentation
docs/zh/.Ablation review
The change is one capability rule and one call per entry builder.
usable()is theonly definition of the shape;
ModelEntry::resolve_service_tierapplies it to themetadata field; the three builders are the only places a served entry is assembled,
and each is needed (the startup path consumes
projectdirectly, the static recordserves
BundledCatalog::effective_models, the account record serves its ownderivation).
merge_entry's option fill stays: it is what keeps an identified row'sdeclared tiers usable. Nothing else could be removed without losing one of those
paths.
Verification
Environment:
CARGO_TARGET_DIR=/mnt/data/dim-targets/2248 CARGO_BUILD_JOBS=2.The first CI run also caught
transport_flow::product_protocol::the_configured_view_reads_back_the_adopted_model_preferences:the first cut invented a default for a declaration that named none, which changed
what an adoption sent.
usable()now leaves an unnamed default unnamed; that testand the rest of
transport_flowpass.transport_flow::model_get::a_reloading_active_line_keeps_its_errorfailed in the same run with a plugin cancellation during a reload and passes on every
local run; it does not read a service tier.
New tests:
provider_flow::a_service_tier_declaration_states_only_a_usable_set— a listingdeclaring
serviceTier: true,{supported: true, options: []},{supported: true, default: "priority", options: []},false, and a defaultoutside its options; asserts
provider.refresh,provider.managementand whichtiers
provider.preferences.updateaccepts.model_catalog_flow::a_service_tier_declaration_states_only_a_usable_set— thedescriptor projection and stored-entry paths, including a declaration that the
row it identifies with enumerates.
managed_provider_flow::an_account_catalogs_service_tier_states_only_a_usable_set— an account catalog's declaration, read through
provider.managementandprovider.preferences.update.Fixes #2248