The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
feat(skills): prompt on scan-blocked registry installs (#7082)
oxoxDev9653b49407ff
diff --git a/app/src/components/skills/SkillsExplorerTab.tsx b/app/src/components/skills/SkillsExplorerTab.tsxindex 99a8558455..282231bf6b 100644--- a/app/src/components/skills/SkillsExplorerTab.tsx+++ b/app/src/components/skills/SkillsExplorerTab.tsx@@ -28,6 +28,7 @@ import {isInstallable,type ParsedRegistryError,parseRegistryError,+ type ScanBlocked,skillRegistryApi,} from '../../services/api/skillRegistryApi';import {@@ -45,6 +46,7 @@ import { TableCell, TableRow } from '../ui/Table';import CreateSkillModal from './CreateSkillModal';import InstallSkillDialog from './InstallSkillDialog';import { RegistryErrorNotice, RegistryStatusNotice } from './RegistryStatusNotice';+import ScanBlockedDialog from './ScanBlockedDialog';import UninstallSkillConfirmDialog from './UninstallSkillConfirmDialog';const log = debug('skills:explorer-tab');@@ -550,6 +552,11 @@ export default function SkillsExplorerTab({ onToast, view }: SkillsExplorerTabPrconst [catalogInitialized, setCatalogInitialized] = useState(false);const catalogRequestRef = useRef(0);const [installingId, setInstallingId] = useState<string | null>(null);+ const [scanBlocked, setScanBlocked] = useState<{+ entry: CatalogEntry;+ scan: ScanBlocked;+ } | null>(null);+ const [scanOverrideError, setScanOverrideError] = useState<string | null>(null);// Catalog entry ids we just installed this session. The "installed" badge is// otherwise derived purely from `isCatalogEntryInstalled`, a heuristic that// maps a refetched installed skill (whose post-install id/location can differ@@ -768,47 +775,55 @@ export default function SkillsExplorerTab({ onToast, view }: SkillsExplorerTabPronToast?.({ type: 'success', title: t('skills.explorer.uninstallSuccess') });}, [fetchSkills, onToast, t]);- const handleRegistryInstall = useCallback(- async (entry: CatalogEntry) => {- log('handleRegistryInstall: id=%s source=%s', entry.id, entry.source);+ const registryInstallErrorMessage = useCallback(+ (entry: CatalogEntry, err: unknown): string => {+ const parsed = parseRegistryError(err);+ log('registryInstall: error kind=%s msg=%s', parsed.kind, parsed.message);+ if (parsed.kind === 'no_direct_download') {+ return entry.source_url+ ? `${t('skills.registry.noDirectDownload')} ${entry.source_url}`+ : t('skills.registry.noDirectDownload');+ }+ if (parsed.kind === 'upstream_ambiguous') return t('skills.registry.upstreamAmbiguous');+ if (parsed.kind === 'rate_limited') {+ return parsed.retryAfterSecs != null+ ? t('skills.registry.rateLimited').replace('{seconds}', String(parsed.retryAfterSecs))+ : t('skills.registry.rateLimitedShortly');+ }+ return parsed.message;+ },+ [t]+ );++ const runRegistryInstall = useCallback(+ async (entry: CatalogEntry, acknowledgeScanFindings: boolean): Promise<boolean> => {+ log(+ 'runRegistryInstall: id=%s source=%s acknowledge=%s',+ entry.id,+ entry.source,+ acknowledgeScanFindings+ );setInstallingId(entry.id);try {- const result = await skillRegistryApi.install(entry.id);- // Authoritatively mark this entry installed so the card flips to- // "Installed" on success regardless of whether the refetched list maps- // back to it via the install-key heuristic (#4150).+ const result = await skillRegistryApi.install(entry.id, { acknowledgeScanFindings });+ if (result.status === 'scan_blocked') {+ log('runRegistryInstall: scan_blocked findings=%d', result.scan.findings.length);+ setScanOverrideError(null);+ setScanBlocked({ entry, scan: result.scan });+ return false;+ }setInstalledEntryIds(prev => {const next = new Set(prev);next.add(entry.id);return next;});- // Await the refetch so `installedKeys` is fresh before the button- // re-renders — otherwise it briefly flips back to "Install" between- // clearing the installing state and the list updating. `fetchSkills`- // swallows its own errors, so this never throws into the catch below.await fetchSkills();onToast?.({type: 'success',title: t('skills.install.installComplete'),message: `Installed ${entry.name}${result.newSkills.length > 0 ? ` (${result.newSkills.join(', ')})` : ''}`,});- } catch (err) {- const parsed = parseRegistryError(err);- log('handleRegistryInstall: error kind=%s msg=%s', parsed.kind, parsed.message);- let message = parsed.message;- if (parsed.kind === 'no_direct_download') {- message = entry.source_url- ? `${t('skills.registry.noDirectDownload')} ${entry.source_url}`- : t('skills.registry.noDirectDownload');- } else if (parsed.kind === 'upstream_ambiguous') {- message = t('skills.registry.upstreamAmbiguous');- } else if (parsed.kind === 'rate_limited') {- message =- parsed.retryAfterSecs != null- ? t('skills.registry.rateLimited').replace('{seconds}', String(parsed.retryAfterSecs))- : t('skills.registry.rateLimitedShortly');- }- onToast?.({ type: 'error', title: t('skills.install.errors.genericTitle'), message });+ return true;} finally {setInstallingId(null);}@@ -816,6 +831,43 @@ export default function SkillsExplorerTab({ onToast, view }: SkillsExplorerTabPr[fetchSkills, onToast, t]);+ const handleRegistryInstall = useCallback(+ async (entry: CatalogEntry) => {+ try {+ await runRegistryInstall(entry, false);+ } catch (err) {+ onToast?.({+ type: 'error',+ title: t('skills.install.errors.genericTitle'),+ message: registryInstallErrorMessage(entry, err),+ });+ }+ },+ [onToast, registryInstallErrorMessage, runRegistryInstall, t]+ );++ const handleScanBlock = useCallback(() => {+ log('scanBlocked: user kept %s uninstalled', scanBlocked?.entry.id);+ setScanBlocked(null);+ setScanOverrideError(null);+ onToast?.({+ type: 'error',+ title: t('skills.scan.declinedTitle'),+ message: t('skills.scan.declinedHint'),+ });+ }, [onToast, scanBlocked, t]);++ const handleScanInstallAnyway = useCallback(async () => {+ if (!scanBlocked) return;+ const { entry } = scanBlocked;+ try {+ const installed = await runRegistryInstall(entry, true);+ if (installed) setScanBlocked(null);+ } catch (err) {+ setScanOverrideError(registryInstallErrorMessage(entry, err));+ }+ }, [registryInstallErrorMessage, runRegistryInstall, scanBlocked]);+const loading = view === 'installed' ? skillsLoading : catalogLoading;const runSkill = (skill: WorkflowSummary) =>@@ -899,6 +951,17 @@ export default function SkillsExplorerTab({ onToast, view }: SkillsExplorerTabPr/>)}+ {scanBlocked && (+ <ScanBlockedDialog+ skillName={scanBlocked.entry.name}+ scan={scanBlocked.scan}+ installing={installingId === scanBlocked.entry.id}+ error={scanOverrideError}+ onBlock={handleScanBlock}+ onInstallAnyway={() => void handleScanInstallAnyway()}+ />+ )}+{uninstallTarget && (<UninstallSkillConfirmDialogskill={uninstallTarget}diff --git a/app/src/components/skills/__tests__/SkillsExplorerTab.test.tsx b/app/src/components/skills/__tests__/SkillsExplorerTab.test.tsxindex e222f94723..fe471bfc83 100644--- a/app/src/components/skills/__tests__/SkillsExplorerTab.test.tsx+++ b/app/src/components/skills/__tests__/SkillsExplorerTab.test.tsx@@ -525,6 +525,7 @@ describe('SkillsExplorerTab', () => {vi.mocked(skillsApi.listWorkflows).mockResolvedValue([]);await serveCatalog([catalogEntry]);vi.mocked(skillRegistryApi.install).mockResolvedValue({+ status: 'installed',url: '',stdout: '',stderr: '',@@ -546,7 +547,9 @@ describe('SkillsExplorerTab', () => {await waitFor(() => {expect(within(tile).getByText('Installed')).toBeInTheDocument();});- expect(skillRegistryApi.install).toHaveBeenCalledWith('built-in/apple-notes');+ expect(skillRegistryApi.install).toHaveBeenCalledWith('built-in/apple-notes', {+ acknowledgeScanFindings: false,+ });expect(within(tile).queryByTestId('registry-install-built-in/apple-notes')).not.toBeInTheDocument();@@ -742,6 +745,7 @@ describe('SkillsExplorerTab', () => {vi.mocked(skillsApi.listWorkflows).mockResolvedValue([]);await serveCatalog([MOCK_CATALOG_ENTRY]);vi.mocked(skillRegistryApi.install).mockResolvedValue({+ status: 'installed',url: 'https://example.com/SKILL.md',stdout: 'ok',stderr: '',@@ -763,13 +767,86 @@ describe('SkillsExplorerTab', () => {});await waitFor(() => {- expect(skillRegistryApi.install).toHaveBeenCalledWith('registry-skill-1');+ expect(skillRegistryApi.install).toHaveBeenCalledWith('registry-skill-1', {+ acknowledgeScanFindings: false,+ });});await waitFor(() => {expect(onToast).toHaveBeenCalledWith(expect.objectContaining({ type: 'success' }));});});+ it('prompts on a scan block, keeps Block as the default and installs only on Install anyway', async () => {+ const { skillsApi } = await import('../../../services/api/skillsApi');+ const { skillRegistryApi } = await import('../../../services/api/skillRegistryApi');+ const onToast = vi.fn();+ vi.mocked(skillsApi.listWorkflows).mockResolvedValue([]);+ await serveCatalog([MOCK_CATALOG_ENTRY]);+ const scan = {+ target: 'registry-skill-1',+ fetchedFrom: 'https://example.com/SKILL.md',+ slug: 'registry-skill-1',+ findings: [+ {+ check: 'invisible_code_points',+ verdict: 'block' as const,+ field: 'the document body',+ message: 'an invisible character in the document body',+ },+ ],+ message: 'blocked',+ };+ vi.mocked(skillRegistryApi.install).mockResolvedValue({ status: 'scan_blocked', scan });++ render(+ <MemoryRouter>+ <SkillsPage initialTab="registry" onToast={onToast} />+ </MemoryRouter>+ );+ await waitFor(() => {+ expect(screen.getByTestId('registry-install-registry-skill-1')).toBeInTheDocument();+ });++ await act(async () => {+ fireEvent.click(screen.getByTestId('registry-install-registry-skill-1'));+ });+ const dialog = await screen.findByTestId('scan-blocked-dialog');+ expect(within(dialog).getByText(/invisible character/)).toBeInTheDocument();+ expect(screen.getByTestId('scan-blocked-block')).toHaveFocus();++ await act(async () => {+ fireEvent.click(screen.getByTestId('scan-blocked-block'));+ });+ expect(screen.queryByTestId('scan-blocked-dialog')).not.toBeInTheDocument();+ expect(skillRegistryApi.install).toHaveBeenCalledTimes(1);+ expect(onToast).not.toHaveBeenCalledWith(expect.objectContaining({ type: 'success' }));++ await act(async () => {+ fireEvent.click(screen.getByTestId('registry-install-registry-skill-1'));+ });+ await screen.findByTestId('scan-blocked-dialog');+ vi.mocked(skillRegistryApi.install).mockResolvedValueOnce({+ status: 'installed',+ url: 'https://example.com/SKILL.md',+ stdout: 'ok',+ stderr: '',+ newSkills: ['registry-skill-1'],+ });+ await act(async () => {+ fireEvent.click(screen.getByTestId('scan-blocked-install-anyway'));+ });++ await waitFor(() => {+ expect(skillRegistryApi.install).toHaveBeenLastCalledWith('registry-skill-1', {+ acknowledgeScanFindings: true,+ });+ });+ await waitFor(() => {+ expect(screen.queryByTestId('scan-blocked-dialog')).not.toBeInTheDocument();+ });+ expect(onToast).toHaveBeenCalledWith(expect.objectContaining({ type: 'success' }));+ });+it('marks an entry with no SKILL.md download as not installable instead of offering Install', async () => {const { skillsApi } = await import('../../../services/api/skillsApi');vi.mocked(skillsApi.listWorkflows).mockResolvedValue([]);@@ -1115,6 +1192,7 @@ describe('SkillsExplorerTab', () => {// Override the beforeEach mock so browse returns an entryawait serveCatalog([MOCK_CATALOG_ENTRY]);vi.mocked(skillRegistryApi.install).mockResolvedValue({+ status: 'installed',url: 'https://example.com/SKILL.md',stdout: 'ok',stderr: '',@@ -1146,7 +1224,9 @@ describe('SkillsExplorerTab', () => {});await waitFor(() => {- expect(skillRegistryApi.install).toHaveBeenCalledWith('registry-skill-1');+ expect(skillRegistryApi.install).toHaveBeenCalledWith('registry-skill-1', {+ acknowledgeScanFindings: false,+ });});});});