fix(viewer): show explicit error banner when dashboard endpoints fail
ο»Ώ## Summary
Dashboard silently shows 0 memories when worker is down.
This fix refactors loadDashboard() to detect endpoint failures and show an explicit error banner instead of presenting an empty-memory state.
Complementary to PR-A. Related to #303.
Summary by CodeRabbit
-
Bug Fixes
- Improved dashboard error handling to track/report failing endpoints; shows a styled "Dashboard data unavailable" banner when all endpoints fail.
-
New Features
- Added a config helper to control dropping stale indexes.
- Memory tool calls now accept format and token budget parameters.
-
Chores
- Hook command entries updated to ensure script paths are quoted.
-
Tests
- Added/updated tests for hooks, env loading, and memory-call proxy behavior.
@jonathanzhan1975 is attempting to deploy a commit to the rohitg00's projects Team on Vercel.
A member of the Team first needs to authorize it.
This PR quotes plugin hook script paths, adds a config helper for AGENTMEMORY_DROP_STALE_INDEX and wires it into startup, extends MCP Plugin hook command quoting Config helper and startup wiring MCP standalone: proxy and arg parsing Viewer: dashboard error banner & safe HTML Tests and validation π― 3 (Moderate) | β±οΈ ~20 minutes π° I hopped through code to mend a seam, βοΈ Tip: You can configure your own custom pre-merge checks in the settings.π Walkthrough
Walkthrough
memory_recall argument parsing and proxy routing, improves the viewer with safe HTML escaping and a dashboard error banner for failed endpoints, and updates/adds tests for these behaviors.Changes
Layer / File(s)
Summary
Codex hook manifest updates
plugin/hooks/hooks.codex.jsonQuote script paths in specific codex hook
command entries.
Generic hook manifest updates
plugin/hooks/hooks.jsonQuote
${CLAUDE_PLUGIN_ROOT} path segments in many hook command entries so node invocations preserve paths with spaces.
Layer / File(s)
Summary
Add config helper
src/config.tsExport
isDropStaleIndexEnabled() that returns true only when merged env AGENTMEMORY_DROP_STALE_INDEX === "true".
Use config helper in startup
src/index.tsImport and call
isDropStaleIndexEnabled() when initializing dropStale for persisted-index handling.
Layer / File(s)
Summary
Tool-arg types and validation
src/mcp/standalone.tsExtend
Validated args with optional format and tokenBudget; parse/normalize format and numeric token_budget in validate().
Proxy dispatch for memory_recall vs smart_search
src/mcp/standalone.tsImplement
memory_recall proxy to POST /agentmemory/search (default format: "full", optional token_budget) and keep memory_smart_search calling /agentmemory/smart-search with optional format/token_budget.
Layer / File(s)
Summary
Escape and banner utilities
src/viewer/index.htmlAdd
escapeHtml(value) and dashboardErrorBanner(error) to safely render endpoint names inside a styled error banner.
Dashboard loading with failure tracking
src/viewer/index.htmlRefactor
loadDashboard() to fetch an endpoints array, collect failed endpoint names into state.dashboard.loadError, and early-return with an error banner when all endpoints fail.
Include error banner in render path
src/viewer/index.htmlInitialize
renderDashboard() HTML with the error banner output so error UI appears at the top of dashboard content.
Layer / File(s)
Summary
Hook manifest tests
test/codex-plugin.test.tsAdd types/helper and test asserting hook
command strings use quoted node "${CLAUDE_PLUGIN_ROOT}/scripts/....mjs" invocations; tighten script-path extraction regex.
Env loader tests
test/env-loader.test.tsClear
AGENTMEMORY_DROP_STALE_INDEX in beforeEach and add test that reads the var from .env enabling isDropStaleIndexEnabled().
MCP proxy tests
test/mcp-standalone-proxy.test.tsAdd tests verifying
memory_recall proxies to /agentmemory/search, forwards format/token_budget, defaults format: "full", and does not call /agentmemory/smart-search.Estimated code review effort
Possibly related PRs
isDropStaleIndexEnabled() and startup wiring.memory_recall / memory_smart_search proxy and arg normalization work.Poem
Quoted paths and envs and dashboard gleam,
If memory calls or endpoints fail,
A banner shows the honest taleβ
Safe HTML keeps rabbits calm and keen.π₯ Pre-merge checks | β
4 | β 1
β Failed checks (1 warning)
Check name
Status
Explanation
Resolution
Docstring Coverage
β οΈ Warning
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%.
Write docstrings for the functions missing them to satisfy the coverage threshold.
β
Passed checks (4 passed)
Check name
Status
Explanation
Description Check
β
Passed
Check skipped - CodeRabbitβs high-level summary is enabled.
Title check
β
Passed
The PR title directly and clearly summarizes the main objective: showing an explicit error banner when dashboard endpoints fail, which aligns with the primary change detailed in the raw summary.
Linked Issues check
β
Passed
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
β
Passed
Check skipped because no linked issues were found for this pull request.
β¨ Finishing Touches
π§ͺ Generate unit tests (beta)
[!WARNING] There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.
π§ ESLint
If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add
eslintto devDependencies.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands and usage tips.
Thanks @jonathanzhan1975 β the viewer error-banner part of this is exactly what #466 needs. The PR bundles a few unrelated changes that overlap with other in-flight work though, and that's going to cause merge friction:
- dropStaleIndex refactor (
src/config.ts,src/index.ts) β collides with #575 which I just opened to fully fix #469/#455 (better error message + one-shot drop persistence). memory_recallformat / token_budget (src/mcp/standalone.ts) β this is #440's surface and is being addressed in #532 (currently CONFLICTING).- Hook manifest reshuffle (
plugin/hooks/hooks.json,plugin/hooks/hooks.codex.json) β touches all 12 hook entries; would like to understand the motivation separately since it's not load-bearing for the banner fix. - Viewer banner (
src/viewer/index.html) β the headline fix, lands cleanly on its own.
Would you be willing to split? A focused PR that only touches src/viewer/index.html (plus a banner-only test) would close #466 and land immediately. The other three pieces would each fit naturally into the PRs already in flight.
Thanks. Just to make sure I'm splitting the right PR β I checked all three of my open PRs against the file list:
#529 (fix/viewer-dashboard-diagnostic):
src/viewer/index.html | 62 ++++++++++++++++++++++++++++++++++++++++-----------
1 file changed, 49 insertions(+), 13 deletions(-)
#528 (fix/cli-iii-lifecycle) and #538 (fix/graph-backfill) also don't touch src/config.ts, src/index.ts, src/mcp/standalone.ts, plugin/hooks/hooks.json, or plugin/hooks/hooks.codex.json.
So #529 already seems isolated to the viewer banner, and the dropStaleIndex / memory_recall / hook reshuffle changes don't appear in any of my open PRs. Was the split request meant for someone else's PR, or am I reading the wrong branch state?
Separate question on the banner-only test: I don't see an existing JSDOM / happy-dom test pattern under test/. Would you prefer I (a) introduce JSDOM for this one test, (b) do a lighter file-content assertion against src/viewer/index.html, or (c) leave the PR test-less for now?