Skip to content

🙌 OpenHands: AI-Driven Development

fix(plugins): say "plugin" on plugin controls and keep busy app switches inert (#18040)

Engel Nyst1539529ae825
diff --git a/__tests__/components/automations/toggle-switch.test.tsx b/__tests__/components/automations/toggle-switch.test.tsx
index a86e0aeddf..f4e590bedf 100644
--- a/__tests__/components/automations/toggle-switch.test.tsx
+++ b/__tests__/components/automations/toggle-switch.test.tsx
@@ -22,6 +22,28 @@ describe("ToggleSwitch", () => {
expect(screen.getByRole("switch")).toHaveAttribute("aria-checked", "true");
});
+ it("ignores pointer and keyboard activation when disabled", async () => {
+ const onToggle = vi.fn();
+ const user = userEvent.setup();
+ render(
+ <ToggleSwitch
+ enabled={false}
+ label="Toggle test"
+ onToggle={onToggle}
+ disabled
+ />,
+ );
+
+ const toggle = screen.getByRole("switch");
+ await user.click(toggle);
+ toggle.focus();
+ await user.keyboard(" ");
+
+ expect(toggle).toBeDisabled();
+ expect(toggle).not.toHaveFocus();
+ expect(onToggle).not.toHaveBeenCalled();
+ });
+
it("stops event propagation on click", async () => {
const parentClick = vi.fn();
const user = userEvent.setup();
diff --git a/__tests__/components/features/launch/plugin-launch-modal.test.tsx b/__tests__/components/features/launch/plugin-launch-modal.test.tsx
index 8b78617fd2..162de572b9 100644
--- a/__tests__/components/features/launch/plugin-launch-modal.test.tsx
+++ b/__tests__/components/features/launch/plugin-launch-modal.test.tsx
@@ -85,9 +85,10 @@ describe("PluginLaunchModal", () => {
{ source: "github:owner/plugin2" },
]);
- // The h2 title contains both LAUNCH$MODAL_TITLE and LAUNCH$MODAL_TITLE_GENERIC
+ // The generic title already contains the verb, so "Launch" is not
+ // prepended again ("Launch Launch Plugin").
const title = screen.getByRole("heading", { level: 2 });
- expect(title.textContent).toContain("LAUNCH$MODAL_TITLE_GENERIC");
+ expect(title.textContent).toBe("LAUNCH$MODAL_TITLE_GENERIC");
});
});
diff --git a/__tests__/routes/canvas-extensions.test.tsx b/__tests__/routes/canvas-extensions.test.tsx
new file mode 100644
index 0000000000..48bf24a921
--- /dev/null
+++ b/__tests__/routes/canvas-extensions.test.tsx
@@ -0,0 +1,144 @@
+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
+import { render, screen, waitFor } from "@testing-library/react";
+import userEvent from "@testing-library/user-event";
+import { beforeEach, describe, expect, it, vi } from "vitest";
+import CanvasExtensionsScreen from "#/routes/canvas-extensions";
+import CanvasExtensionsService from "#/api/canvas-extensions-service";
+import SettingsService from "#/api/settings-service/settings-service.api";
+import {
+ __resetActiveStoreForTests,
+ setActiveSelection,
+ setRegisteredBackends,
+} from "#/api/backend-registry/active-store";
+import type { Backend } from "#/api/backend-registry/types";
+import { MOCK_DEFAULT_USER_SETTINGS } from "#/mocks/handlers";
+import { ActiveBackendProvider } from "#/contexts/active-backend-context";
+import type { InstalledCanvasExtensionInfo } from "#/types/canvas-extension";
+
+vi.mock("#/context/navigation-context", () => ({
+ useNavigation: () => ({
+ navigate: vi.fn(),
+ currentPath: "/apps",
+ conversationId: null,
+ isNavigating: false,
+ }),
+ NavigationProvider: ({ children }: { children: React.ReactNode }) => children,
+}));
+
+const localBackend: Backend = {
+ id: "local",
+ name: "Local",
+ host: "http://127.0.0.1:8001",
+ apiKey: "",
+ kind: "local",
+};
+
+function buildExtension(
+ overrides: Partial<InstalledCanvasExtensionInfo> = {},
+): InstalledCanvasExtensionInfo {
+ return {
+ name: "demo-page",
+ version: "0.1.0",
+ enabled: true,
+ source: "https://github.com/OpenHands/OpenHands",
+ repo_path: "src/fixtures/canvas-extensions/demo-page",
+ installed_at: "2026-10-01T00:00:00Z",
+ install_path: "/home/.openhands/canvas-extensions/installed/demo-page",
+ ...overrides,
+ };
+}
+
+function renderAppsScreen() {
+ return render(<CanvasExtensionsScreen />, {
+ wrapper: ({ children }) => (
+ <QueryClientProvider
+ client={
+ new QueryClient({ defaultOptions: { queries: { retry: false } } })
+ }
+ >
+ <ActiveBackendProvider>{children}</ActiveBackendProvider>
+ </QueryClientProvider>
+ ),
+ });
+}
+
+/** Starts an Update whose install request stays pending until resolved. */
+async function startPendingUpdate(user: ReturnType<typeof userEvent.setup>) {
+ let finishUpdate: () => void = () => {};
+ vi.spyOn(CanvasExtensionsService, "install").mockImplementation(
+ () =>
+ new Promise((resolve) => {
+ finishUpdate = () => resolve(buildExtension());
+ }),
+ );
+ await user.click(
+ await screen.findByTestId("canvas-extension-refresh-demo-page"),
+ );
+ await waitFor(() =>
+ expect(
+ screen.getByTestId("canvas-extension-uninstall-demo-page"),
+ ).toBeDisabled(),
+ );
+ return () => finishUpdate();
+}
+
+describe("CanvasExtensionsScreen", () => {
+ beforeEach(() => {
+ vi.restoreAllMocks();
+ __resetActiveStoreForTests();
+ setRegisteredBackends([localBackend]);
+ setActiveSelection({ backendId: localBackend.id });
+ vi.spyOn(SettingsService, "getSettings").mockResolvedValue(
+ MOCK_DEFAULT_USER_SETTINGS,
+ );
+ });
+
+ // Issue #17956: the switch was only styled inert while busy, so the
+ // keyboard could still disable an app in the middle of an Update.
+ it("keeps an enabled app's switch inert to the keyboard while an Update is pending", async () => {
+ const user = userEvent.setup();
+ vi.spyOn(CanvasExtensionsService, "listInstalled").mockResolvedValue([
+ buildExtension({ enabled: true }),
+ ]);
+ const setEnabledSpy = vi
+ .spyOn(CanvasExtensionsService, "setEnabled")
+ .mockResolvedValue(buildExtension({ enabled: false }));
+ renderAppsScreen();
+
+ const finishUpdate = await startPendingUpdate(user);
+ const appSwitch = screen.getByRole("switch");
+ expect(appSwitch).toBeDisabled();
+ appSwitch.focus();
+ expect(appSwitch).not.toHaveFocus();
+ await user.keyboard(" ");
+ expect(setEnabledSpy).not.toHaveBeenCalled();
+
+ finishUpdate();
+ await waitFor(() => expect(appSwitch).toBeEnabled());
+ appSwitch.focus();
+ await user.keyboard(" ");
+ await waitFor(() =>
+ expect(setEnabledSpy).toHaveBeenCalledWith("demo-page", false),
+ );
+ });
+
+ it("does not open the enable confirmation from a disabled app's switch while an Update is pending", async () => {
+ const user = userEvent.setup();
+ vi.spyOn(CanvasExtensionsService, "listInstalled").mockResolvedValue([
+ buildExtension({ enabled: false }),
+ ]);
+ renderAppsScreen();
+
+ const finishUpdate = await startPendingUpdate(user);
+ const appSwitch = screen.getByRole("switch");
+ appSwitch.focus();
+ await user.keyboard(" ");
+ expect(screen.queryByTestId("confirmation-modal")).not.toBeInTheDocument();
+
+ finishUpdate();
+ await waitFor(() => expect(appSwitch).toBeEnabled());
+ appSwitch.focus();
+ await user.keyboard(" ");
+ expect(screen.getByTestId("confirmation-modal")).toBeInTheDocument();
+ });
+});
diff --git a/__tests__/routes/launch.test.tsx b/__tests__/routes/launch.test.tsx
index 150f90b966..683c5cd751 100644
--- a/__tests__/routes/launch.test.tsx
+++ b/__tests__/routes/launch.test.tsx
@@ -399,7 +399,7 @@ describe("LaunchRoute", () => {
// In test environment, the translation key is shown
const label = document.querySelector('label[for="trust-checkbox"]');
expect(label).toBeInTheDocument();
- expect(label?.textContent).toContain("LAUNCH$TRUST_SKILL_CHECKBOX");
+ expect(label?.textContent).toContain("LAUNCH$TRUST_PLUGIN_CHECKBOX");
});
it("should disable start button when trust checkbox is unchecked", () => {
diff --git a/__tests__/routes/plugins-page.test.tsx b/__tests__/routes/plugins-page.test.tsx
index c471f58acc..246ddb124b 100644
--- a/__tests__/routes/plugins-page.test.tsx
+++ b/__tests__/routes/plugins-page.test.tsx
@@ -123,6 +123,7 @@ describe("SkillsPluginsScreen", () => {
const toggle = await screen.findByTestId("plugin-toggle-demo-plugin");
expect(toggle).toHaveAttribute("aria-checked", "true");
+ expect(toggle).toHaveAccessibleName("SETTINGS$PLUGINS_DISABLE_PLUGIN");
});
it("installs a catalog plugin with its coordinates when Install is clicked", async () => {
diff --git a/docs/CANVAS_EXTENSIONS_TESTING.md b/docs/CANVAS_EXTENSIONS_TESTING.md
index 1d3cd2f7db..8f9030f19e 100644
--- a/docs/CANVAS_EXTENSIONS_TESTING.md
+++ b/docs/CANVAS_EXTENSIONS_TESTING.md
@@ -27,7 +27,7 @@ extension requests in the browser. The mock also covers the settings and server
information probes needed to mark that backend healthy, so the Agent Server
does not need the extension endpoints and does not need to be running.
-Open <http://localhost:3102/extensions>. Do not use the normal ingress URL at
+Open <http://localhost:3102/apps>. Do not use the normal ingress URL at
`http://localhost:8000` for this test because its `/api` traffic goes directly
to the unmodified Agent Server rather than through the mock browser session.
@@ -37,17 +37,18 @@ reload.
## Install and enable the fixture
-1. In **Customize -> Extensions**, select **Add extension**.
-2. Enter this exact source:
+1. In **Customize > Apps**, select **Add app**.
+2. Enter this exact **App source**:
```text
src/fixtures/canvas-extensions/demo-page
```
-3. Leave **Ref** and **Repository path** empty, then select **Install**.
+3. Leave **Ref** and **Path** empty, then select **Install**.
4. Confirm that **Demo page** appears disabled. Installation must not execute
the bundle or add its navigation item.
-5. Turn on the extension and accept the trusted-code confirmation.
+5. Turn on the app and select **Enable trusted app** in the trusted-code
+ confirmation.
6. Confirm that **Extension demo** appears in the main left rail.
7. Open it and verify the page says **Hello from a Canvas Extension**.
8. Visit `/extensions/demo-page/hello/nested` directly and verify the page
@@ -79,7 +80,7 @@ bare package imports or additional output chunks.
## What still requires the Agent Server
-Repeat this flow against `http://localhost:8000/extensions` after the backend
+Repeat this flow against `http://localhost:8000/apps` after the backend
contract lands. That test must additionally verify:
- Git and backend-local-path installation;
diff --git a/specs/canvas-extensions.md b/specs/canvas-extensions.md
index b5c0b9a140..145b9e46ed 100644
--- a/specs/canvas-extensions.md
+++ b/specs/canvas-extensions.md
@@ -13,7 +13,8 @@ panels, renderers, slots, and themes. Skills and plugins change the agent;
Canvas Extensions change the app.
The Customize area remains the single inventory for Skills, Plugins, MCP, and
-Canvas Extensions. The inventory item is named **Extensions**; "addon" is an
+Canvas Extensions. The UI calls Canvas Extensions **Apps**: the inventory item is
+**Customize > Apps** at `/apps`, installed with **Add app**; "addon" is an
informal alias only.
## Decisions
@@ -29,7 +30,7 @@ informal alias only.
as optional style isolation, but never as a security boundary.
3. **Install and enable are separate.** Installation always produces a disabled
extension. An agent may install or update an extension, but the user returns
- to Customize -> Extensions and explicitly enables it. In v1 this is a product
+ to Customize > Apps and explicitly enables it. In v1 this is a product
consent invariant, not proof of human presence against an agent that can call
the same authenticated APIs. A future backend policy may allow agent-driven
enablement.
@@ -47,7 +48,8 @@ informal alias only.
resolved revision. Since v1 is a trusted-code model, there is no misleading
permission-diff approval gate. The staged check/apply flow currently exists
only at the Agent Server service layer; until it is exposed over HTTP, the
- Customize UI offers no Refresh action.
+ app card's **Update** action re-installs from the recorded source, ref, and
+ path with `force: true`, and the Agent Server keeps the enabled state.
## Trust disclosure
@@ -244,9 +246,9 @@ For each enabled installation:
invoke the extension disposer, and remove its registry entries.
The initial route shape is
-`/extensions/{extension-name}/{declared-page-path}`. `/extensions` itself is the
-Customize inventory. All routing goes through React Router so `VITE_BASE_PATH`
-continues to work.
+`/extensions/{extension-name}/{declared-page-path}`. The Customize inventory is
+`/apps`; there is no bare `/extensions` page. All routing goes through React
+Router so `VITE_BASE_PATH` continues to work.
## Delivery plan
@@ -255,7 +257,7 @@ continues to work.
- Land this spec and shared TypeScript manifest/installation types.
- Add a backend-keyed service and query hooks for list, install, enable/disable,
uninstall, and authenticated bundle fetch.
-- Add Customize -> Extensions with an unsupported-backend state, source install
+- Add Customize > Apps with an unsupported-backend state, source install
form, source/revision/contribution review, and explicit enable control.
- Keep the global runtime silent when the active backend returns 404.
diff --git a/src/components/features/canvas-extensions/canvas-extension-card.tsx b/src/components/features/canvas-extensions/canvas-extension-card.tsx
index a7ef6e1ca0..b0e66b83db 100644
--- a/src/components/features/canvas-extensions/canvas-extension-card.tsx
+++ b/src/components/features/canvas-extensions/canvas-extension-card.tsx
@@ -53,6 +53,7 @@ export function CanvasExtensionCard({
extension.enabled ? I18nKey.COMMON$DISABLE : I18nKey.COMMON$ENABLE,
)}
onToggle={onToggle}
+ disabled={isBusy}
className={isBusy ? "pointer-events-none opacity-50" : undefined}
/>
</header>
diff --git a/src/components/features/launch/plugin-launch-modal.tsx b/src/components/features/launch/plugin-launch-modal.tsx
index 8925eaa4a3..25289808a0 100644
--- a/src/components/features/launch/plugin-launch-modal.tsx
+++ b/src/components/features/launch/plugin-launch-modal.tsx
@@ -121,9 +121,11 @@ export function PluginLaunchModal({
onStartConversation(pluginConfigs, message);
};
+ // The generic title already includes the verb ("Launch Plugin"), so only a
+ // single plugin's display name is prefixed with "Launch".
const modalTitle =
pluginConfigs.length === 1
- ? getPluginDisplayName(pluginConfigs[0])
+ ? `${t(I18nKey.LAUNCH$MODAL_TITLE)} ${getPluginDisplayName(pluginConfigs[0])}`
: t(I18nKey.LAUNCH$MODAL_TITLE_GENERIC);
return (
@@ -137,9 +139,7 @@ export function PluginLaunchModal({
)}
>
<ModalCloseButton onClose={onClose} testId="close-button" />
- <Typography.H2 className="pr-6">
- {t(I18nKey.LAUNCH$MODAL_TITLE)} {modalTitle}
- </Typography.H2>
+ <Typography.H2 className="pr-6">{modalTitle}</Typography.H2>
{message && <p className="text-sm text-contrast">{message}</p>}
@@ -203,7 +203,7 @@ export function PluginLaunchModal({
className="mt-1 h-4 w-4 flex-shrink-0"
/>
<label htmlFor="trust-checkbox" className="text-sm text-contrast">
- {t(I18nKey.LAUNCH$TRUST_SKILL_CHECKBOX, {
+ {t(I18nKey.LAUNCH$TRUST_PLUGIN_CHECKBOX, {
sources: getUniqueSources().join(", "),
interpolation: { escapeValue: false },
})}
diff --git a/src/components/features/plugins/plugin-card.tsx b/src/components/features/plugins/plugin-card.tsx
index ff61c1014d..4be6ca3b0c 100644
--- a/src/components/features/plugins/plugin-card.tsx
+++ b/src/components/features/plugins/plugin-card.tsx
@@ -82,6 +82,8 @@ export function PluginCard({
isSelected={plugin.enabled}
isDisabled={isDisabled || isBusy}
onToggle={onToggle}
+ enableLabelKey={I18nKey.SETTINGS$PLUGINS_ENABLE_PLUGIN}
+ disableLabelKey={I18nKey.SETTINGS$PLUGINS_DISABLE_PLUGIN}
disableTooltipKey={I18nKey.COMMON$DISABLE}
/>
) : plugin.isLocal ? (
diff --git a/src/i18n/translation.json b/src/i18n/translation.json
index 98191c341d..db5dc23b5b 100644
--- a/src/i18n/translation.json
+++ b/src/i18n/translation.json
@@ -28627,22 +28627,22 @@
"uk": "path:",
"ca": "path:"
},
- "LAUNCH$TRUST_SKILL_CHECKBOX": {
- "en": "I trust this skill from {{sources}} with the agent secrets defined in my account.",
- "ja": "私は{{sources}}からのこのスキルを、アカウントに定義されたエージェントシークレットとともに信頼します。",
- "zh-CN": "我信任来自 {{sources}} 的此技能,并允许其使用我账户中定义的代理密钥。",
- "zh-TW": "我信任來自 {{sources}} 的此技能,並允許其使用我帳戶中定義的代理密鑰。",
- "ko-KR": "{{sources}}의 이 스킬을 내 계정에 정의된 에이전트 비밀과 함께 신뢰합니다.",
- "no": "Jeg stoler på denne ferdigheten fra {{sources}} med agenthemmelighetene definert i kontoen min.",
- "it": "Mi fido di questa skill da {{sources}} con i segreti dell'agente definiti nel mio account.",
- "pt": "Eu confio nesta habilidade de {{sources}} com os segredos do agente definidos em minha conta.",
- "es": "Confío en esta habilidad de {{sources}} con los secretos del agente definidos en mi cuenta.",
- "ar": "أثق في هذه المهارة من {{sources}} مع أسرار الوكيل المحددة في حسابي.",
- "fr": "Je fais confiance à cette compétence de {{sources}} avec les secrets d'agent définis dans mon compte.",
- "tr": "{{sources}} kaynağından gelen bu beceriye hesabımda tanımlı ajan sırlarıyla güveniyorum.",
- "de": "Ich vertraue dieser Fähigkeit von {{sources}} mit den in meinem Konto definierten Agenten-Geheimnissen.",
- "uk": "Я довіряю цій навичці з {{sources}} із секретами агента, визначеними в моєму обліковому записі.",
- "ca": "Confio en aquesta habilitat de {{sources}} amb els secrets de l'agent definits al meu compte."
+ "LAUNCH$TRUST_PLUGIN_CHECKBOX": {
+ "en": "I trust this plugin from {{sources}} with the agent secrets defined in my account.",
+ "ja": "私は{{sources}}からのこのプラグインを、アカウントに定義されたエージェントシークレットとともに信頼します。",
+ "zh-CN": "我信任来自 {{sources}} 的此插件,并允许其使用我账户中定义的代理密钥。",
+ "zh-TW": "我信任來自 {{sources}} 的此外掛程式,並允許其使用我帳戶中定義的代理密鑰。",
+ "ko-KR": "{{sources}}의 이 플러그인을 내 계정에 정의된 에이전트 비밀과 함께 신뢰합니다.",
+ "no": "Jeg stoler på denne pluginen fra {{sources}} med agenthemmelighetene definert i kontoen min.",
+ "it": "Mi fido di questo plugin da {{sources}} con i segreti dell'agente definiti nel mio account.",
+ "pt": "Eu confio neste plugin de {{sources}} com os segredos do agente definidos em minha conta.",
+ "es": "Confío en este complemento de {{sources}} con los secretos del agente definidos en mi cuenta.",
+ "ar": "أثق في هذه الإضافة من {{sources}} مع أسرار الوكيل المحددة في حسابي.",
+ "fr": "Je fais confiance à ce plugin de {{sources}} avec les secrets d'agent définis dans mon compte.",
+ "tr": "{{sources}} kaynağından gelen bu eklentiye hesabımda tanımlı ajan sırlarıyla güveniyorum.",
+ "de": "Ich vertraue diesem Plugin von {{sources}} mit den in meinem Konto definierten Agenten-Geheimnissen.",
+ "uk": "Я довіряю цьому плагіну з {{sources}} із секретами агента, визначеними в моєму обліковому записі.",
+ "ca": "Confio en aquest connector de {{sources}} amb els secrets de l'agent definits al meu compte."
},
"ONBOARDING$STEP1_TITLE": {
"en": "What's your role?",
@@ -34747,6 +34747,40 @@
"tr": "Eklenti güncellendi.",
"uk": "Плагін оновлено."
},
+ "SETTINGS$PLUGINS_ENABLE_PLUGIN": {
+ "en": "Enable plugin",
+ "ja": "プラグインを有効化",
+ "zh-CN": "启用插件",
+ "zh-TW": "啟用外掛程式",
+ "ko-KR": "플러그인 사용",
+ "no": "Aktiver plugin",
+ "it": "Abilita plugin",
+ "pt": "Ativar plugin",
+ "es": "Activar complemento",
+ "ar": "تفعيل الإضافة",
+ "fr": "Activer le plugin",
+ "tr": "Eklentiyi etkinleştir",
+ "de": "Plugin aktivieren",
+ "uk": "Увімкнути плагін",
+ "ca": "Activa el connector"
+ },
+ "SETTINGS$PLUGINS_DISABLE_PLUGIN": {
+ "en": "Disable plugin",
+ "ja": "プラグインを無効化",
+ "zh-CN": "禁用插件",
+ "zh-TW": "停用外掛程式",
+ "ko-KR": "플러그인 사용 안 함",
+ "no": "Deaktiver plugin",
+ "it": "Disabilita plugin",
+ "pt": "Desativar plugin",
+ "es": "Desactivar complemento",
+ "ar": "تعطيل الإضافة",
+ "fr": "Désactiver le plugin",
+ "tr": "Eklentiyi devre dışı bırak",
+ "de": "Plugin deaktivieren",
+ "uk": "Вимкнути плагін",
+ "ca": "Desactiva el connector"
+ },
"SETTINGS$PLUGINS_SKILLS_IN_BUNDLE": {
"en": "Skills in this plugin bundle",
"ja": "このプラグインバンドルに含まれるスキル",
diff --git a/src/ui/toggle-switch.tsx b/src/ui/toggle-switch.tsx
index b9c570d5d4..64d85a8ce5 100644
--- a/src/ui/toggle-switch.tsx
+++ b/src/ui/toggle-switch.tsx
@@ -55,6 +55,8 @@ interface ToggleSwitchProps {
enabled: boolean;
label: string;
onToggle: () => void;
+ /** Makes the switch inert: not focusable and ignores clicks and keys. */
+ disabled?: boolean;
className?: string;
}
@@ -62,6 +64,7 @@ export function ToggleSwitch({
enabled,
label,
onToggle,
+ disabled = false,
className,
}: ToggleSwitchProps) {
return (
@@ -70,6 +73,7 @@ export function ToggleSwitch({
role="switch"
aria-checked={enabled}
aria-label={label}
+ disabled={disabled}
onClick={(e) => {
e.stopPropagation();
onToggle();