Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(app): disable Test connection for a custom embeddings endpoint, with a reason

M3gA-Mind1fcd2127617f
diff --git a/app/src/components/settings/panels/EmbeddingsSetupModal.tsx b/app/src/components/settings/panels/EmbeddingsSetupModal.tsx
index c653fab30b..bf54d486a7 100644
--- a/app/src/components/settings/panels/EmbeddingsSetupModal.tsx
+++ b/app/src/components/settings/panels/EmbeddingsSetupModal.tsx
@@ -68,13 +68,28 @@ const EmbeddingsSetupModal = ({
contentClassName="px-5 py-4 space-y-4"
footer={
<div className="flex justify-between pt-1">
+ {/* Disabled for a custom endpoint, deliberately, and with a reason
+ the user can read. `setupTest` calls
+ `openhuman.embeddings_test_connection` with only
+ `{ provider, model, dimensions }` — there is no parameter for an
+ endpoint URL — so a custom provider has nothing to test against.
+ Previously the button stayed enabled and its handler opened with
+ `if (!isCustom)`, so a click did nothing at all: no request, no
+ result, no error. A dead control that looks live is worse than an
+ absent one, and worse still than an honest explanation. */}
<Button
variant="secondary"
size="xs"
- onClick={() => {
- if (!isCustom) onTest();
- }}
- disabled={setupTesting || setupSaving || (!isCustom && !setupKey.trim())}>
+ onClick={onTest}
+ title={
+ isCustom
+ ? t(
+ 'settings.embeddings.testUnavailableCustom',
+ 'Testing a custom endpoint is not supported yet — save it and check the status on the Embeddings panel.'
+ )
+ : undefined
+ }
+ disabled={setupTesting || setupSaving || isCustom || !setupKey.trim()}>
{setupTesting
? t('settings.embeddings.testing')
: t('settings.embeddings.testConnection')}
diff --git a/app/src/components/settings/panels/__tests__/EmbeddingsSetupModal.test.tsx b/app/src/components/settings/panels/__tests__/EmbeddingsSetupModal.test.tsx
index 52553fc120..e518b689b3 100644
--- a/app/src/components/settings/panels/__tests__/EmbeddingsSetupModal.test.tsx
+++ b/app/src/components/settings/panels/__tests__/EmbeddingsSetupModal.test.tsx
@@ -149,17 +149,35 @@ describe('EmbeddingsSetupModal — custom-endpoint branch', () => {
expect(saveButton()).toBeEnabled();
});
- // The Test button is rendered enabled for a custom provider (the disabled
- // predicate short-circuits on `!isCustom`), but its handler is wrapped in
- // `if (!isCustom)`. So it looks actionable and does nothing. Pinned as the
- // current behaviour — see the bug list; it is a UX defect, not a crash.
- it('renders Test as enabled for a custom provider but does not call onTest', () => {
+ // Was: "renders Test as enabled for a custom provider but does not call
+ // onTest" — the button looked actionable and its handler opened with
+ // `if (!isCustom)`, so a click produced no request, no result and no error
+ // (#5909). It is now disabled instead, because `embeddings_test_connection`
+ // takes only `{ provider, model, dimensions }` and cannot express a custom
+ // endpoint, so there is genuinely nothing to test against.
+ it('disables Test for a custom provider rather than rendering a dead control', () => {
const { onTest } = renderModal({ setupProvider: custom, customEndpoint: 'https://host/v1' });
- expect(testButton()).toBeEnabled();
+ expect(testButton()).toBeDisabled();
fireEvent.click(testButton());
expect(onTest).not.toHaveBeenCalled();
});
+
+ it('explains on hover why Test is unavailable for a custom endpoint', () => {
+ // A silently disabled control is only marginally better than a dead one;
+ // the reason is what makes it honest.
+ renderModal({ setupProvider: custom, customEndpoint: 'https://host/v1' });
+
+ expect(testButton().getAttribute('title') ?? '').toContain('custom endpoint');
+ });
+
+ it('leaves Save reachable for a custom endpoint', () => {
+ // Disabling Test must not disable the path that still works: a custom
+ // endpoint is saved and then checked from the Embeddings panel.
+ renderModal({ setupProvider: custom, customEndpoint: 'https://host/v1' });
+
+ expect(saveButton()).toBeEnabled();
+ });
});
describe('EmbeddingsSetupModal — feedback', () => {