Skip to content

bug(platform): Embedding model Save is on with empty fields after a provider change, and off without a reason once a model is picked #5182

Closed

Description

@yannickmonney

Summary

In Settings › Data residency › Embedding model, an admin moves a saved embedding model to another provider, and the Save button behaves backwards:

  • After the provider change, Save is on, although the model and the vector width are now empty. Clicking it only shows the toast "Fix the highlighted fields and try again."
  • After a model is picked from the new provider's list, Save turns off and Discard stays on. Nothing on the page says why. The blocker is the empty vector width: its error is not shown, and the field's placeholder 1536 reads like a value.
  • Typing the width turns Save back on.

Most embedding models in the gateway catalogs state no width. In a local listing, OpenRouter states a width for 1 of 42 and Vercel AI Gateway for 0 of 28. So this is the usual outcome when the provider changes.

The report

When changing the data residency settings from one embedding model to another the save button does not recognize the dirty state once the model is selected

What happens (main at 49ce42fdd, local run on 2026-10-31)

Setup:

  • Two OpenAI-compatible gateways defined by the organization, "Gateway A" (embed-a) and "Gateway B" (embed-b).
  • Each one's /v1/models lists two embedding models with no width: emb-alpha and emb-beta.
  • Saved configuration: embed-a, emb-alpha, 1536.
  • The page was reloaded before the steps; each "Discard" returns to the saved state.
Step Save Discard Model Vector width Shown on the page
Pick emb-beta from the same provider on on emb-beta 1536 (kept) nothing
Discard, then pick provider embed-b on on "Choose a model" empty nothing
Click Save at that point stays on on "Choose a model" empty toast "Fix the highlighted fields and try again."; "Enter the model tag." under Model; "Enter a supported vector width: 256, …, 4096." under Vector width
Discard, then pick embed-b, then emb-beta off on emb-beta empty, placeholder 1536 nothing
Focus the width field and leave it off on emb-beta empty "Enter a supported vector width: 256, …, 4096."
Type 1536 on on emb-beta 1536 nothing

A component test against the same code gave the same states. It used catalogs of shipped origin, one entry with a stated width and one without:

  • Save on with empty fields after the provider change.
  • Save off after a pick without a width.
  • Save on after a pick with a width.

"Other model…" is not affected. The tag field it opens re-runs the check when it mounts, so Save goes off while the tag is empty, as intended.

Why (main at 49ce42fdd)

Line numbers without a path refer to services/platform/app/features/settings/data-residency/components/org-embedding-section.tsx.

  • Provider change (:933-951).
    • field.onChange(v) makes react-hook-form 7.72.1 run the schema on the form as it is at that moment. The old model and width are still in place, so it stores isValid: true.
    • The four setValue calls that then clear the credential, model, model source and width (:938-950) pass shouldDirty only. A setValue without shouldValidate never runs the schema again.
    • Save reads that stored value (packages/ui/src/components/editor/use-form-editor.ts:230), so it is on while the model and width are empty.
    • A failed submit does not update isValid either, so Save stays on after the toast.
  • Model pick (onPickModel, :616-642).
    • setValue('model', …, { shouldValidate: true }) (:627) runs trigger('model'). That recomputes isValid over the whole form, but writes only the model field's error.
    • The width is filled only when the catalog entry states one (:631-639). Otherwise it stays empty and the schema's width rule fails (:451-460). Save turns off, and the width error is not written.
    • With the shared useForm default mode onTouched (packages/ui/src/components/forms/use-form.ts:33), that error appears only after the field is focused and left.
  • No reason on Save.
    • The header's Save shows an invalidReason when the controller supplies one (packages/ui/src/components/editor/editor-actions.tsx:183-190). The contract (packages/ui/src/components/editor/types.ts:20-25) says this is so the reader learns what blocks the save "instead of meeting a dead button".
    • Neither useFormEditor nor the group composer (packages/ui/src/components/editor/compose-editors.ts:46-54) supplies one. Only the automation editor does (services/platform/app/features/automations/components/automation-editor.tsx:2081-2101).
  • What the Model row says.
    • For a pick from a list, the hint is "Embedding models this provider's listing carries; …" or "Embedding models the provider's catalog lists." (:650-662).
    • The hint saying Tale knows no width for the provider and asking for it, modelUncuratedHint, appears only when the Model row is a typed tag (:652-656).
    • The width input's placeholder is 1536 (:1053).
  • Since when.
    • Until ba3f848 (2026-10-09, feat(platform): store knowledge vectors in a table per width #4445, first released in v0.5.79), a provider change cleared the model only. That commit added setValue('dimensions', '', …) (:950) and changed the test's expected width from 1536 to empty.
    • The test kept its old name, "clears the model pick when the provider changes and keeps the width" (services/platform/app/features/settings/data-residency/components/data-residency-settings.test.tsx:1630; assertion at :1687-1689).
    • Before that commit, a pick without a width kept the previous width. That is read from the code; no older build was run.

Who meets it

Embedding-tagged entries in the catalog listing of the local stack (GET /api/app/providers/catalogs, 2026-10-31):

Provider (catalog source) Embedding models listed With a stated width
OpenRouter (openrouter-api) 42 1 (qwen/qwen3-embedding-8b, 1536)
Vercel AI Gateway (models-endpoint) 28 0
OpenAI (static) 1 1
Z.ai (static) 1 1
The two local gateways (models-endpoint) 2 each 0

OpenRouter's embeddings listing publishes no width (services/platform/backend/core/lib/providers/catalog_fetch.ts:60-65). Widths come only from the shipped files (:425-451 there), and OpenRouter's file states one (configs/platform/system/models/openrouter/models.yml:381-399). So after moving to a gateway, picking almost any model leaves Save off.

Tests

  • data-residency-settings.test.tsx:1630-1690 and :1692-1725 check the field values after a provider change and after a pick without a width. Neither checks Save (isValid).
  • No test changes the provider of a saved configuration.

Constraints a change must respect

  • The width is stated, never guessed. The field's hint says so, and a pick that states no width leaves the admin's own figure alone (:628-639).
  • Refusals keep Save off. That covers a provider that cannot embed and one whose declarations or shipped catalog could not be read (:131-177, :428-443).
  • An empty section stays valid. An untouched, empty section is valid while nothing is configured (:396-420).
  • Decision: switching the embedding model to another model of the same width keeps the vectors the old model made #4935. A width kept across a provider change can mix vectors from two models of the same width. The decision there bears on whether the width should survive a provider change.

Options (no preference stated)

  1. Run validation again after the provider handler's clears, for example one trigger() at the end or shouldValidate on the clears. Save would then be off right after a provider change.
  2. Validate the whole form on a model pick (trigger() without a field name). The width error would then appear beside the empty field when Save turns off.
  3. Let useFormEditor and the group composer supply an invalidReason, so the header's Save says what blocks it. Every grouped settings page would get this.
  4. Have useFormEditor recompute isValid on every value change, or use mode onChange or all for this form. A setValue without shouldValidate could then no longer leave Save stale. Other editors use the same pattern (see "Not examined").
  5. Keep the width across a provider change, as the test's name says, with Decision: switching the embedding model to another model of the same width keeps the vectors the old model made #4935 in mind. Or, when a pick states no width, show the "Tale knows no vector width" hint and drop the 1536 placeholder.

Questions

  • Should a provider change keep the previous width, or is clearing it, as ba3f848 does, the intended behavior?
  • Should every grouped settings page say why Save is off, or only this section?

Not examined

  • Other editors with the same pattern. These call setValue with shouldDirty and without shouldValidate; whether those fields change validity was not checked. All are under services/platform/app/features/:
    • settings/sandboxes/workspace-cleanup-editor.tsx
    • settings/enterprise-sso/components/enterprise-sso-form.tsx
    • settings/governance/components/chat-tools-policy-editor.tsx
    • settings/governance/components/vision-model-editor.tsx
    • settings/governance/components/skill-sharing-policy-editor.tsx
    • settings/data-residency/components/org-storage-section.tsx
    • projects/components/project-task-reviewer-section.tsx
    • projects/components/project-overview.tsx
  • A shipped gateway in the browser. OpenRouter and Vercel AI Gateway were not driven there; only the component test covered catalogs of shipped origin.
  • Builds before v0.5.79.

Related

Activity

  1. added
    priority: medium
    bug
    service: platform
    on Oct 31, 2026
  2. added
    agent-ready
    on Nov 1, 2026
  3. tale-code-bot commented on Nov 1, 2026

    @tale-code-bot
    Collaborator

    Parts split off this issue, from task TALE-342:

    • fix(ui): keep a form editor's Save current when code sets a field #5260 fix(ui): a form editor's Save goes stale when code sets a field, or when a save fails.
      • We audited the eight editors this issue lists under "Not examined" by reading their code. No test or browser run was made.
      • Two of them show a wrong Save state today:
        • Object storage: Save is on while Region and Bucket are blank, when Force path style is the first edit.
        • Enterprise SSO: Save stays off over valid values after a protocol switch fills the default name.
      • The other six cannot show a wrong Save state.
    • feat(ui): say why a form editor's Save is off #5261 feat(ui): say why a form editor's Save is off. This is option 3 here.

    The two questions, as TALE-342 settles them:

    The fix for this section:

    • Branch: fix/embedding-save-validity, head b7bfb50.
    • Status: in review for the stable line's train.
    • What it does:
      • Save stays off right after a provider change.
      • A pick that states no width shows the width's error.
      • The width field no longer carries the 1536 placeholder.
    • Its commit closes this issue when it reaches main.
  4. added a commit that references this issue on Nov 1, 2026
    c27a219
  5. added a commit that references this issue on Nov 1, 2026
    e8b6e52
  6. tale-code-bot commented on Nov 1, 2026

    @tale-code-bot
    Collaborator

    Reopened: GitHub closed this issue by mistake. The body of merge train pull request #5262 named it with a closing keyword where it listed commits that wait for the next train, so GitHub closed it when #5262 merged into main at 16:00 UTC. #5262 did not carry the change.

    The change that closes this issue is commit e8b6e52 (fix(platform): keep embedding Save in step with provider and model picks, task TALE-342). It sits on the stable merge train train: it is not in main and not in v0.5.95. It reaches main with the next stable merge train, which departs at about 23:54 UTC today, and the merge of that train closes this issue.

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-readybugpriority: mediumservice: platform

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions