ADR 333 · Accepted

A configuration in criteria mode stores no model of its own

Context

A configuration selects its model in one of two modes (ADR-066): fixed names a model through model_uid, criteria selects one per call and, as ADR-066 put it, has model_uid = 0. Nothing kept that true. The backend form only hides the model field in criteria mode (displayCond on model_uid), and LlmConfiguration::setModelSelectionMode() did not touch the relation. A configuration switched from fixed to criteria mode therefore kept the model it had, and getLlmModel() and getModelId() returned it.

Every reader that takes that relation for the configuration's model then names a model the criteria did not select (#1505): usage cost and model id in UsageMiddleware and the streaming dispatcher, telemetry rows, the configuration test button, cost estimates and governance rows. Two readers are already fixed on their own: the document probe selects the model of a criteria-mode configuration (ADR-332), and criteria-mode embeddings are keyed and run by the selected model (#1504). The issue listed three ways to fix the rest: clear the relation where the mode changes, make the getters return no model in criteria mode, or let every reader branch on the mode. The product owner decided on 2026-12-01 to clear the relation at the source.

Decision

1. Saving a configuration in criteria mode clears its model. CriteriaModeModelClearHook, a DataHandler hook on processDatamap_postProcessFieldArray, sets model_uid to 0 when the record is in criteria mode after the save: the mode being written, else the stored one. A new record carries its defaults at that point, a TCAdefaults line in TSconfig included, which DataHandler applies only after the earlier preProcessFieldArray hooks. The form submits no model_uid in criteria mode, so the hook clears a stored relation itself. It runs before DataHandler writes, so the reference index and the record history show the cleared relation like any other change.

2. Switching the domain object to criteria mode drops the relation. Configurations are also written through Extbase (the setup wizard, the task wizard, the preset import, LlmConfigurationService). setModelSelectionMode('criteria') now sets the model to null, and Extbase writes 0 for the emptied relation. The signature stays as it is; the API snapshot does not change. A model set after the mode stays set: the setter clears, it does not refuse.

3. An upgrade wizard clears the relation on existing records. CriteriaModeModelUidUpdateWizard (nrLlm_clearCriteriaModeModelUid) sets model_uid = 0 on every configuration whose model_selection_mode is criteria and whose model_uid is greater than 0, hidden and deleted rows included. Fixed-mode records keep their model. The update bypasses DataHandler, so the wizard indexes each cleared record again (ReferenceIndex::updateRefIndexTable()) and the reference index drops the old relation.

4. The getters keep their contract. getLlmModel() still returns the stored relation in any mode. With the relation cleared, a criteria-mode configuration returns null there, as one created in criteria mode always did.

5. A criteria-mode installation default is served without a model. ConfigurationResolver::resolveDefaultConfiguration() requires a model only of a fixed-mode default, as resolveDefaultForActor() already did. A call that names no configuration and pins no provider then runs on the criteria-mode default, and the call path selects its model as for any criteria-mode configuration. The product owner decided this on 2026-12-01 in #1507; without it, clearing the relation would have taken the default away from every installation whose criteria-mode default had kept a model.

Consequences

  • ●● Usage cost, telemetry, estimates, governance rows and the configuration test of a criteria-mode configuration no longer name a model it did not select. One change covers every reader of the relation, present and future.

  • ● The tool gate of a criteria-mode configuration no longer takes its trust zone from the retained model's provider. TrustZoneResolver::zoneFor() without a serving model then answers EXTERNAL_GLOBAL (ADR-149), as for a configuration created in criteria mode. A run that was offered a tool only because the retained model's provider sat in a more trusted zone is offered it no longer.

  • ◐ The setter change is a behaviour change of an @api method, and no consumer has to handle anything new: a criteria-mode configuration could always have no model, and every consumer already had to accept null there. The change raises only the last version number.

  • ● A criteria-mode installation default serves calls that name no configuration: chat(), complete(), streamChat(), embed() and vision() hand it to the configuration path, which selects the model for the operation. Before this record such a default was used only while it kept a model, and then ran on the criteria anyway.

  • ◐ DocumentAnalysisService serves a criteria-mode default too: its probe selects the model when the configuration is in criteria mode or names no model (ADR-332, decision 1). ADR-331 and ADR-332 stated that the resolver returns a default only when it has a model; this record amends that statement.

  • ◑ The translation cache key of a call on the default names the configuration's getModelId(), which is empty for a criteria-mode default, so answers are not keyed by the selected model. The same holds for a criteria-mode configuration a site names.

  • ◑ RunPrivacyLevelResolver joins the configuration's model_uid to the provider's privacy level. A retained model's provider no longer takes part in a criteria-mode run's level. It was the provider of the run only when the criteria happened to select that same model; the join could not tell.

  • ◑ A configuration switched back to fixed mode is saved with no model unless the editor picks one again: the model field offers an empty choice, and the criteria-mode save had cleared it. If that configuration is the installation default, calls that name no configuration fail until a model is chosen, because a fixed-mode default without a model is not used.

  • ◑ Stored data changes. An administrator must run the wizard; until then only records saved in the record editor, or switched to criteria mode through the setter, are cleared.

Net Score: +4.0

Alternatives considered

Make getLlmModel() and getModelId() return no model in criteria mode. Rejected: it changes the documented result of two @api getters, and the stored relation would still be wrong for every reader that queries model_uid directly, such as RunPrivacyLevelResolver.

Fix each reader to branch on usesCriteriaSelection(). Rejected: no contract changes, but each new reader can repeat the defect, and the issue already lists readers across usage, telemetry, estimates and governance.

← All ADRs