Skip to content

fix(plugin:codebase-memory): prefix plugin API routes + drop var-h shadow in ProjectList#6

Open
SirMinionBot wants to merge 1 commit into
mainfrom
fix/codebase-memory-routes
Open

fix(plugin:codebase-memory): prefix plugin API routes + drop var-h shadow in ProjectList#6
SirMinionBot wants to merge 1 commit into
mainfrom
fix/codebase-memory-routes

Conversation

@SirMinionBot

Copy link
Copy Markdown
Owner

Diagnosed after the iBit dashboard stopped loading the /codebase-memory tab. Two showstoppers in the bundle that ships in this plugin:

  1. fetchJSON("/health"), /projects, /iframe-url and /project/.../health were all hardcoded leading-slash paths — but the host mounts each plugin's Python router under /api/plugins/<name>/* (web_server.py:13835). The calls 404'd, and the SDK's loopback-mode auto-reload (api.ts:158) reloaded on the domain-level 4xx, dragging the dashboard into a reload loop every time someone clicked CODEBASE MEMORY in the sidebar.

  2. ProjectList shadowed the React.createElement alias with var h = healthByName[p.name] on every project button render. The first iteration of .map crashed with "h is not a function" and React unmounted the whole plugin.

The bundle now defines a top-level API = '/api/plugins/codebase-memory' and all four calls use API + '/...' with { allowUnauthorized: true } so the SDK's loopback-token-rotation reload trick doesn't fire on a 4xx from a freshly-mounted plugin endpoint.

Validated on the iBit dashboard (/:9119) after deploy: clicking CODEBASE MEMORY from the sidebar now renders the iframe shell, the project list populates from /api/plugins/codebase-memory/projects, and per-project health lazy-loads on selection.

…adow in ProjectList

The bundle that ships in plugins/codebase-memory/dist/index.js had two
showstoppers after the v0.1.0 release:

1. fetchJSON("/health"), fetchJSON("/projects"), fetchJSON("/iframe-url"),
   and fetchJSON("/project/.../health") all bypassed the host's
   /api/plugins/<name>/ prefix because they hardcoded leading
   slashes without the plugin name. The host mounts the Python router
   at /api/plugins/codebase-memory/* (see web_server.py:13835), so
   those calls 404'd — and the SDK's loopback-mode auto-reload kicked
   in on the domain-level 4xx, dragging the page into a reload storm
   that looked like 'dashboard doesn't load'.

2. ProjectList shadowed the React.createElement alias (var h = ...)
   with var h = healthByName[p.name];. When the project map iterated,
   every button crashed with 'h is not a function' and React unmounted
   the whole plugin.

Now both call sites use a top-level API = '/api/plugins/codebase-memory'
prefix and the project rendering reads per-project health inline
without shadowing. Also pass { allowUnauthorized: true } on all plugin
calls so the SDK's loopback-token-rotation reload trick doesn't trigger
on a domain-level 404 (the SDK never had a chance to get a valid token
for a plugin endpoint that hasn't been mounted yet).

Validated by visual smoke test on the iBit dashboard after deploy:
the iframe renders, the project list renders, and /api/projects
returns the JSON list of indexed repos from the local
codebase-memory-mcp binary.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant