diff --git a/webui/src/components/remote/QuickPairSetup.tsx b/webui/src/components/remote/QuickPairSetup.tsx
index 3e734f105..455735f9c 100644
--- a/webui/src/components/remote/QuickPairSetup.tsx
+++ b/webui/src/components/remote/QuickPairSetup.tsx
@@ -8,6 +8,7 @@ import { Textarea } from "@/components/ui/textarea";
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from "@/components/ui/dropdown-menu";
import { useClient } from "@/providers/ClientProvider";
import { copyTextToClipboard } from "@/lib/clipboard";
+import { CodeBlock } from "@/components/CodeBlock";
import { remoteAction } from "@/lib/remote-instances";
import { pairingReturnOrigin, type PairReturn } from "@/lib/remote-pair-return";
import type { ConnectionStatus } from "@/lib/types";
@@ -164,7 +165,7 @@ export function QuickPairSetup({ returned, onSSH, onClose }: { returned?: PairRe
{t("remote.pair.security")}>}>
{t("remote.pair.fingerprint")}
{preview.fingerprint}
- {t("remote.pair.revoke")}
{preview.revoke_command}
+ {t("remote.pair.revoke")}
{saved && error &&
{t("remote.pair.retryHint")}
{ if (!value && !busy) setRemoving(null); }}>
{t(removalIsShared ? "remote.sameInstance.forgetTitle" : "remote.forgetTitle", { name: removalProfile?.name })}{t(removalIsShared ? "remote.sameInstance.forgetHint" : "remote.forgetDescription")}
{removalProfile && (removalProfile.connected || connections.openHostIds.includes(removalProfile.id)) && {t("remote.activeForgetWarning")}
}
- {removalProfile?.paired && {t("remote.pair.forgetHint")}
{removalProfile.revoke_command} }
+ {removalProfile?.paired && {t("remote.pair.forgetHint")}
{removalProfile.revoke_command &&
}
}
{error && {error}
}
diff --git a/webui/src/tests/quick-pair.test.tsx b/webui/src/tests/quick-pair.test.tsx
index b437f9acc..0afe9ddb9 100644
--- a/webui/src/tests/quick-pair.test.tsx
+++ b/webui/src/tests/quick-pair.test.tsx
@@ -65,6 +65,17 @@ async function reviewed() {
}
describe("quick pairing", () => {
+ it("uses the same copyable revocation code block in pairing details", async () => {
+ returnedView();
+ await screen.findByRole("heading", { name: "Open this nanobot?" });
+ fireEvent.click(screen.getByRole("button", { name: "Connection details & revocation" }));
+ expect(screen.getByText(preview.revoke_command).closest("pre")).not.toBeNull();
+ fireEvent.click(screen.getByRole("button", { name: "Copy code" }));
+ expect(await screen.findByRole("button", { name: "Copied" })).toBeVisible();
+ expect(mocks.copy).toHaveBeenCalledWith(preview.revoke_command);
+ expect(mocks.connect).not.toHaveBeenCalled();
+ expect(mocks.action.mock.calls.some(([action]) => action === "remote.pair_finish")).toBe(false);
+ });
it("explains an existing instance and saves its additional authorization only on confirmation", async () => {
mocks.action.mockImplementation(async (action: string) => {
if (action === "remote.pair_preview") return { ...preview, existing_connection: { id: "saved-server", name: "My team", connected: true } };
diff --git a/webui/src/tests/remote-instances.test.tsx b/webui/src/tests/remote-instances.test.tsx
index 00f079755..64ae85828 100644
--- a/webui/src/tests/remote-instances.test.tsx
+++ b/webui/src/tests/remote-instances.test.tsx
@@ -7,6 +7,7 @@ import { Sidebar } from "@/components/Sidebar";
import { HOST_BRIDGE } from "@/components/remote/host-bridge";
import { readSelectedRemote, readRecentRemotes, rememberSelectedRemote, validateRemoteConnection, type RemoteConnection } from "@/lib/remote-instances";
import i18n from "@/i18n";
+import * as clipboard from "@/lib/clipboard";
import { clearPairReturn, initializePairReturn } from "@/lib/remote-pair-return";
import type { Window as HappyWindow } from "happy-dom";
@@ -91,6 +92,24 @@ function chooseExistingSSH() {
}
describe("remote instance UX", () => {
+ it("shows revocation as a shared copyable code block without executing it or forgetting the connection", async () => {
+ const command = "nanobot remote revoke 0dec816f-55e8-47ab-a8ad-13251e2a4f30 --ssh-user ubuntu";
+ const copy = vi.spyOn(clipboard, "copyTextToClipboard").mockResolvedValue(true);
+ mocks.read.mockResolvedValue({ available: true, profiles: [{ ...profile, paired: true, revoke_command: command }] });
+ view(); await openDirectory();
+ fireEvent.pointerDown(screen.getByRole("button", { name: "Manage Team server" }), { button: 0, ctrlKey: false });
+ fireEvent.click(screen.getByRole("menuitem", { name: "Forget server" }));
+ const dialog = await screen.findByRole("dialog", { name: "Forget Team server?" });
+ const code = within(dialog).getByText(command);
+ expect(code.closest("pre")).not.toBeNull();
+ expect(code.closest(".not-prose")).toHaveClass("rounded-floating", "bg-secondary/70", "[&_pre]:[overflow-wrap:anywhere]");
+ fireEvent.click(within(dialog).getByRole("button", { name: "Copy code" }));
+ expect(await within(dialog).findByRole("button", { name: "Copied" })).toBeVisible();
+ expect(copy).toHaveBeenCalledWith(command);
+ expect(mocks.request).not.toHaveBeenCalled();
+ fireEvent.click(within(dialog).getByRole("button", { name: "Cancel", exact: true }));
+ expect(mocks.request).not.toHaveBeenCalled();
+ });
it("shows one verified instance in management and the switcher while retaining both grants in details", async () => {
const second = { ...profile, id: "f1b18099-61d5-41d7-9c1d-6f647f7000e5", paired: true, instance_id: profile.id };
mocks.read.mockResolvedValue({ available: true, profiles: [{ ...profile, paired: true, instance_id: profile.id }, second] });