Skip to content

Bug: removing a provider leaves its models in rules and pins, and the delete dialog does not say settings will change #5340

Closed

Description

@yannickmonney

Summary

Removing a provider credential does not touch the settings that name that provider's models, and the delete dialog does not say that those settings will change. Only the embedding model is checked. Governance rules (default models, model access), and the other pins that store a provider and model (vision, image generation, standard agent), keep pointing at models that are no longer offered. The editors then show these entries in a degraded way, or not at all, while the stored rule keeps them. The report was that the UI "seems to break" after a provider was removed; the exact symptoms were not captured, so everything below is read from the code, not observed.

What the code does today (main at 2741e5b)

The delete.

  • services/platform/backend/domains/provider_credentials/service.ts:1076-1113 (deleteCredential) deletes the row and writes an audit entry. Before that it calls assertCredentialUnused (:958-965), which asks credentialDependents (:906-937).
  • CredentialDependent is the single value 'embedding' (:893). Nothing else is looked up, so no rule, pin or agent can make the delete refuse or warn.
  • The dialog side mirrors it: useDeleteWarning in services/platform/app/features/settings/providers/credential-adapter.tsx:550-557 warns only for the embedding model (providers.credential.deleteEmbeddingWarning), and deleteWarning (:542-545) only for the last credential of a custom provider.

What stores a provider and model, and survives the delete (schemas in packages/shared/src/schemas/governance.ts):

Setting Stored Lines
Default models, per scope providerName + modelId :479-485
Model access, allow / block lists bare model ids :746-751
Vision model providerSlug + modelId :508-512
Image generation providerSlug + modelId :542-547
Standard agent providerSlug + modelId :600-607
Project agents model (+ modelProvider) packages/shared/src/schemas/projects.ts:173, managed-configuration.ts:71

What the editors do with an entry whose provider is gone. The provider list they read (hooks/model-catalog.ts, useListProviders) holds only providers with an active credential, so a removed provider is simply absent:

  • Default models (services/platform/app/features/settings/governance/components/default-model-editor.tsx). The table falls back to the raw slug and raw id (resolveProviderName / resolveModelName, :588-606), so the row reads like a working one. The edit dialog's provider and model selects are fed from the same list (:225-238), so the stored value has no matching option. Whether the select renders blank or the raw value was not examined.
  • Model access (components/model-access-editor.tsx). Options come only from live providers (:422-440), and MultiSelect builds its chips by looking each stored value up among the options and dropping the misses (packages/ui/src/components/forms/multi-select.tsx:225-231). A rule allowing only a removed provider's models therefore shows no chips, yet still stores them, and the rules table names them by raw id (resolveModelNames, :704-715). In allowlist mode such a rule allows nothing that exists, with nothing on screen saying why.
  • The backend tolerates some of it on purpose: a pinned default that is no longer servable degrades to automatic selection with a log warning (services/platform/backend/core/lib/providers/resolve_chat_model.ts, "falling back to automatic selection"), and the vision lane warns and falls back (resolve_vision_model.ts:186-211, :288). The admin sees neither; the warnings are in the server log.

A second credential for the same provider keeps the provider alive, so this concerns the last active credential of a provider (or a disabled one: useListProviders also drops providers without an active credential).

Observed vs. not examined

  • Not examined in a browser: what each editor renders for a stale entry, whether any of it throws, and what the UI does on the next save of a rule whose entries are stale (does the save keep, drop or reject them).
  • Not examined: the other places a model is chosen (automations, tasks, project agents, spend or routing rules): whether they validate a stored model against the live catalog, and what an admin sees when one no longer resolves.
  • Not examined: what happens to a thread, task or automation currently running on the removed provider's model.
  • Disabling a credential (status disabled) and a catalog that fails to load both make a provider disappear from the same list; whether they should be treated like removal was not examined.

Constraints

  • Org configuration is files, not tables; the dependents live in several config files and in project agent rows, so one lookup would span both.
  • The embedding guard exists because indexing and search go down org-wide; it refuses outright. The other pins degrade (Auto, vision), so a refusal may be the wrong strength for them.
  • Credential deletes are audited (provider_credential.deleted); a cleanup that rewrites rules would need an audit entry of its own.
  • The admin's rules are the admin's data; rewriting them silently is the kind of change that has to be visible.
  • User-visible strings go to every locale.

Options (no preference stated)

  1. Warn in the delete dialog. Extend credentialDependents beyond 'embedding' to list the settings that name this provider's models (rules, pins, project agents) and show them in the dialog before the delete, as the embedding warning already does. The delete still goes through.
  2. Refuse like embedding. The same lookup, but the server answers 409 CREDENTIAL_IN_USE for some or all of them, naming what to move first.
  3. Clean up on delete. Remove the rules and pins that name the provider (or reset them to automatic) in the same transaction, listing what changed in the audit entry and in the dialog.
  4. Make stale entries visible. Leave the delete as it is and have the editors show an entry whose provider is gone ("provider removed"), keep its chip in the Model access field, and offer to remove it.
  5. A settings health surface. A list of settings that point at something no longer served, reachable from Settings, independent of what removed it.

These combine: 1 + 4 changes no stored data; 3 changes data and wants 1 first.

Questions

Related

Activity

  1. added
    agent-ready
    on Nov 3, 2026
  2. added a commit that references this issue on Nov 3, 2026
    552c353
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-readybugservice: platform

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions