From 07b1f5ef97ba68542d3c1d5397b62baa968ee2b1 Mon Sep 17 00:00:00 2001 From: Alex Tabisz Date: Thu, 14 May 2026 21:37:28 +1000 Subject: [PATCH 1/3] fix(pulse-docs): show error state instead of infinite Loading when /api/wiki fails The /docs page rendered "Loading..." forever when the wiki API returned an error (e.g. when the Pulse wiki module failed to load minisearch and all /api/wiki/* routes 404'd). The useQuery hooks ignored isError, so a failed fetch was indistinguishable from a pending fetch. Surface isError + error from both queries and render a WikiErrorState component with the HTTP status, a hint, and a Retry button. The doc-detail query gets the same treatment. No behavioural change on the success path. --- .../PULSE/Observability/src/app/docs/page.tsx | 77 ++++++++++++++++++- 1 file changed, 73 insertions(+), 4 deletions(-) diff --git a/Releases/v5.0.0/.claude/PAI/PULSE/Observability/src/app/docs/page.tsx b/Releases/v5.0.0/.claude/PAI/PULSE/Observability/src/app/docs/page.tsx index f2ab6a9eca..f11dfe5b7b 100644 --- a/Releases/v5.0.0/.claude/PAI/PULSE/Observability/src/app/docs/page.tsx +++ b/Releases/v5.0.0/.claude/PAI/PULSE/Observability/src/app/docs/page.tsx @@ -312,32 +312,101 @@ function DocsLanding({ data }: { data: WikiIndex }) { ); } +function WikiErrorState({ + title, + message, + hint, + onRetry, +}: { + title: string; + message: string; + hint?: string; + onRetry: () => void; +}) { + return ( +
+
+
+ {title} +
+
+ {message} +
+ {hint && ( +
+ {hint} +
+ )} + +
+
+ ); +} + function DocsPageInner() { const searchParams = useSearchParams(); const docSlug = searchParams.get("doc"); const isViewing = !!docSlug; - const { data: indexData } = useQuery({ + const { + data: indexData, + isError: indexIsError, + error: indexError, + refetch: refetchIndex, + } = useQuery({ queryKey: ["wiki-index"], queryFn: async () => { const res = await fetch("/api/wiki"); - if (!res.ok) throw new Error("Failed to fetch wiki index"); + if (!res.ok) throw new Error(`Failed to fetch wiki index (HTTP ${res.status})`); return res.json(); }, staleTime: 30_000, enabled: !isViewing, }); - const { data: docDetail } = useQuery({ + const { + data: docDetail, + isError: docIsError, + error: docError, + refetch: refetchDoc, + } = useQuery({ queryKey: ["wiki-doc", docSlug], queryFn: async () => { const res = await fetch(`/api/wiki/doc/${docSlug}`); - if (!res.ok) throw new Error("Failed to fetch doc"); + if (!res.ok) throw new Error(`Failed to fetch doc (HTTP ${res.status})`); return res.json(); }, enabled: isViewing, }); + if (isViewing && docIsError) { + return ( + refetchDoc()} + /> + ); + } + + if (!isViewing && indexIsError) { + return ( + refetchIndex()} + hint="The Pulse wiki module may not be running. Check pulse.log for details." + /> + ); + } + if (isViewing && docDetail) { return (
From 598945f3250d15f2bd3a8b4c10cb979663675b04 Mon Sep 17 00:00:00 2001 From: Alex Tabisz Date: Thu, 14 May 2026 21:43:22 +1000 Subject: [PATCH 2/3] fix(pulse): declare minisearch dependency for wiki module modules/wiki.ts imports minisearch but the dep was never declared anywhere in the release. Fresh installs of PAI 5.0.0 silently fail to load the wiki module, which makes /api/wiki return 404 and (combined with the missing React Query error branch) leaves the /docs page stuck on Loading... forever. Add a PULSE-local package.json so 'bun install' in PAI/PULSE/ resolves the dep alongside the daemon that uses it. Installer wiring (running bun install during PAI bootstrap) is left to a follow-up PR. --- Releases/v5.0.0/.claude/PAI/PULSE/package.json | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 Releases/v5.0.0/.claude/PAI/PULSE/package.json diff --git a/Releases/v5.0.0/.claude/PAI/PULSE/package.json b/Releases/v5.0.0/.claude/PAI/PULSE/package.json new file mode 100644 index 0000000000..7e519dfc30 --- /dev/null +++ b/Releases/v5.0.0/.claude/PAI/PULSE/package.json @@ -0,0 +1,9 @@ +{ + "name": "pai-pulse", + "private": true, + "type": "module", + "description": "PAI Pulse daemon — runtime dependencies for pulse.ts and its modules.", + "dependencies": { + "minisearch": "^7.2.0" + } +} From cb12f9f758e8073f13401cf42ee4b1cd71921080 Mon Sep 17 00:00:00 2001 From: Alex Tabisz Date: Thu, 14 May 2026 21:47:49 +1000 Subject: [PATCH 3/3] fix(pulse): add smol-toml to declared deps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit pulse.ts, lib.ts, pulse-unified.ts, and checks/github-work.ts all import smol-toml to parse PULSE.toml. Same defect class as minisearch: not declared anywhere in the release, so a fresh install would crash on startup before the wiki module even loads. Optional module deps (grammy, jose, @anthropic-ai/claude-agent-sdk) are deliberately deferred to a follow-up PR — they need an optionalDependencies design discussion, not a blanket addition. --- Releases/v5.0.0/.claude/PAI/PULSE/package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Releases/v5.0.0/.claude/PAI/PULSE/package.json b/Releases/v5.0.0/.claude/PAI/PULSE/package.json index 7e519dfc30..66e5104215 100644 --- a/Releases/v5.0.0/.claude/PAI/PULSE/package.json +++ b/Releases/v5.0.0/.claude/PAI/PULSE/package.json @@ -4,6 +4,7 @@ "type": "module", "description": "PAI Pulse daemon — runtime dependencies for pulse.ts and its modules.", "dependencies": { - "minisearch": "^7.2.0" + "minisearch": "^7.2.0", + "smol-toml": "^1.6.1" } }