The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): fall back the Skills Hub picker to GitHub Pages when Vercel refuses
Brooklyn Nicholson42357423819b
diff --git a/apps/desktop/src/plugins/hermes-bots/skills-hub-picker.test.tsx b/apps/desktop/src/plugins/hermes-bots/skills-hub-picker.test.tsxindex acefa3821a1..ae5927e43db 100644--- a/apps/desktop/src/plugins/hermes-bots/skills-hub-picker.test.tsx+++ b/apps/desktop/src/plugins/hermes-bots/skills-hub-picker.test.tsx@@ -10,12 +10,13 @@*/import type * as HermesSdk from '@hermes/plugin-sdk'-import { cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react'+import { act, cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react'import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'import { translateBots } from './i18n-test-helper'const HUB_ORIGIN = 'https://hermes-agent.nousresearch.com'+const FALLBACK_HUB_ORIGIN = 'https://nousresearch.github.io'const mocks = vi.hoisted(() => ({notify: vi.fn(),@@ -81,13 +82,89 @@ function routedInstallCalls() {beforeEach(() => {vi.clearAllMocks()+ // Opening the hub browser now HEAD-probes the primary picker URL; default to+ // a healthy probe so every non-fallback test stays hermetic and offline.+ vi.stubGlobal('fetch', vi.fn().mockResolvedValue({ ok: true }))})afterEach(() => {cleanup()+ vi.unstubAllGlobals()})describe('hub pick messages', () => {+ it('uses GitHub Pages when the Vercel hub probe is unavailable', async () => {+ vi.stubGlobal('fetch', vi.fn().mockResolvedValue({ ok: false }))++ const frame = openHubBrowser()++ await waitFor(() =>+ expect(frame.getAttribute('src')).toBe(`${FALLBACK_HUB_ORIGIN}/hermes-agent/docs/skills?embed=picker`)+ )+ })++ it('uses GitHub Pages when the probe request fails', async () => {+ vi.stubGlobal('fetch', vi.fn().mockRejectedValue(new TypeError('network error')))++ const frame = openHubBrowser()++ await waitFor(() =>+ expect(frame.getAttribute('src')).toBe(`${FALLBACK_HUB_ORIGIN}/hermes-agent/docs/skills?embed=picker`)+ )+ })++ it('uses GitHub Pages when the probe hangs past its deadline', async () => {+ vi.useFakeTimers()+ // AbortSignal.timeout's internal timer bypasses vi's fake clock — route it+ // through setTimeout so the deadline is deterministic here.+ vi.spyOn(AbortSignal, 'timeout').mockImplementation(ms => {+ const controller = new AbortController()+ setTimeout(() => controller.abort(new DOMException('Timed out', 'TimeoutError')), ms)+ return controller.signal+ })+ vi.stubGlobal(+ 'fetch',+ vi.fn(+ (_url: string, options: RequestInit) =>+ new Promise((_resolve, reject) => {+ options.signal?.addEventListener('abort', () =>+ reject(new DOMException('The user aborted a request.', 'AbortError'))+ )+ })+ )+ )++ try {+ const frame = openHubBrowser()++ await act(async () => {+ await vi.advanceTimersByTimeAsync(8_000)+ })++ expect(frame.getAttribute('src')).toBe(`${FALLBACK_HUB_ORIGIN}/hermes-agent/docs/skills?embed=picker`)+ } finally {+ vi.restoreAllMocks()+ vi.useRealTimers()+ }+ })++ it('keeps the Vercel picker when the probe succeeds', async () => {+ const frame = openHubBrowser()++ await waitFor(() => expect(frame.getAttribute('src')).toBe(`${HUB_ORIGIN}/docs/skills?embed=picker`))+ })++ it('accepts an install message from the fallback picker frame', () => {+ const frame = openHubBrowser()++ postPick(+ { identifier: 'nous/web-research', name: 'Web Research', type: 'hermes-skill-pick' },+ { origin: FALLBACK_HUB_ORIGIN, source: frame.contentWindow }+ )++ expect(installCalls()).toEqual([['skills.manage', { action: 'install', query: 'nous/web-research' }]])+ })+it('installs the picked skill when it comes from our own frame', () => {const frame = openHubBrowser()diff --git a/apps/desktop/src/plugins/hermes-bots/skills-hub.tsx b/apps/desktop/src/plugins/hermes-bots/skills-hub.tsxindex 4c09bc0ec97..8b9b26b0f27 100644--- a/apps/desktop/src/plugins/hermes-bots/skills-hub.tsx+++ b/apps/desktop/src/plugins/hermes-bots/skills-hub.tsx@@ -21,7 +21,17 @@ import type { RosterRow } from './types'// checklist above gains the row. Search-box fallback kept for offline use.const HUB_ORIGIN = 'https://hermes-agent.nousresearch.com'+const FALLBACK_HUB_ORIGIN = 'https://nousresearch.github.io'const HUB_PICKER_URL = HUB_ORIGIN + '/docs/skills?embed=picker'+const FALLBACK_HUB_PICKER_URL = FALLBACK_HUB_ORIGIN + '/hermes-agent/docs/skills?embed=picker'+// A WAF-blocked or unreachable docs host must not delay the fallback longer+// than this — the probe only decides which origin to embed, never blocks it.+const HUB_PROBE_TIMEOUT_MS = 8_000++function isHubOrigin(origin: string) {+ return origin === HUB_ORIGIN || origin === FALLBACK_HUB_ORIGIN+}+/** One `skills.manage action=search` hit. */interface HubSkillResult {description?: string@@ -43,9 +53,43 @@ export function HubSkillsSection({ bot, onInstalled }: HubSkillsSectionProps) {const [installing, setInstalling] = useState<null | string>(null)const [installed, setInstalled] = useState<Record<string, boolean>>({})const [browseHub, setBrowseHub] = useState(false)+ const [hubPickerUrl, setHubPickerUrl] = useState(HUB_PICKER_URL)const installRef = useRef<((name: string, displayName?: string) => Promise<void>) | null>(null)const frameRef = useRef<HTMLIFrameElement | null>(null)+ // Vercel's WAF denies some residential IP ranges for the whole docs domain,+ // leaving the pane on a block page (#118203). The equivalent GitHub Pages+ // deployment serves the same picker, so probe the primary before each+ // browse session and fall back when it is unreachable or refuses us. The+ // probe carries its own deadline — a hanging connection must not stall the+ // fallback.+ useEffect(() => {+ if (!browseHub) {+ return undefined+ }++ let mounted = true++ void fetch(HUB_PICKER_URL, {+ method: 'HEAD',+ signal: AbortSignal.timeout(HUB_PROBE_TIMEOUT_MS)+ })+ .then(response => {+ if (mounted && !response.ok) {+ setHubPickerUrl(FALLBACK_HUB_PICKER_URL)+ }+ })+ .catch(() => {+ if (mounted) {+ setHubPickerUrl(FALLBACK_HUB_PICKER_URL)+ }+ })++ return () => {+ mounted = false+ }+ }, [browseHub])+// Picker messages from the embedded hub page. Origin- AND source-checked —// only OUR frame may ask for an install (the hub origin alone would let any// other window on it, e.g. an OAuth popup, trigger installs too); installs@@ -56,7 +100,7 @@ export function HubSkillsSection({ bot, onInstalled }: HubSkillsSectionProps) {}const onMessage = (event: MessageEvent) => {- if (event.origin !== HUB_ORIGIN) {+ if (!isHubOrigin(event.origin)) {return}@@ -185,7 +229,7 @@ export function HubSkillsSection({ bot, onInstalled }: HubSkillsSectionProps) {<iframeref={frameRef}sandbox="allow-scripts allow-same-origin"- src={HUB_PICKER_URL}+ src={hubPickerUrl}style={{width: '133.34%',height: '133.34%',diff --git a/website/docs/reference/faq.md b/website/docs/reference/faq.mdindex 3cd01e00d6b..a0d1d67d7a7 100644--- a/website/docs/reference/faq.md+++ b/website/docs/reference/faq.md@@ -649,6 +649,16 @@ If an MCP server crashes mid-request, Hermes will report a timeout. Check the se---+### Skills Issues++#### The Skills Hub page won't load in the desktop app (403 / blocked)++**Cause:** The docs site (`hermes-agent.nousresearch.com`) is served through Vercel, whose WAF denies some residential IP ranges it considers flagged. If your network is on such a range, every request to the domain returns a 403 block page.++**Solution:** The Skills Hub picker probes the primary domain and automatically falls back to the equivalent GitHub Pages deployment (`nousresearch.github.io/hermes-agent`), which serves the same catalog. If the page still fails on both origins, check whether a proxy, DNS filter, or firewall is blocking both hosts — and report the affected range to the maintainers so it can be reviewed on the deployment side.++---+## Profiles### How do profiles differ from just setting HERMES_HOME?