aaronsb_obsidian-mcp-plugin/mcpb
Aaron Bockelie add60a43ef fix(bridge): self-heal on session expiry — reinitialize + replay (#238)
The .mcpb stdio bridge cleared its session on a 404 and emitted
-32000 "please reinitialize", relying on the client to send a fresh
initialize. Clients that ignore that signal (Claude Desktop) then
sent the next tool call with no session → HTTP 400, and the
connection dead-ended until a manual restart. This is the #221/#238
"worked yesterday, broke this morning, tools time out" symptom: a
server restart (Obsidian reload / plugin update) or the 1-hour idle
session GC orphans the bridge's in-memory session.

The bridge now caches the initialize handshake and, on a 404 for a
non-initialize call, transparently re-initializes (fresh synthetic
id, result discarded) + completes the handshake with
notifications/initialized + replays the original message once, then
emits that real result. Recovery is invisible to the client and no
client-side fix is required. An isReplay flag caps it at a single
attempt so a session that dies again can't spin a reinit loop; the
existing `initializing` gate serializes concurrent 404s onto one
re-init.

Made the bridge require()-able (bootstrap guarded by
require.main === module, dispatch/state exported) so the self-heal
path is unit-testable without spawning a process. Adds
tests/bridge-self-heal.test.ts covering reinit+replay success, the
give-up path when re-init fails (no loop), and initialize caching.

Closes #238. Addresses #221 for users on the bundled .mcpb bridge
(third-party bridges like supergateway are unaffected; the server's
404 signal remains spec-compliant per ADR-106).

Claude-Session: https://claude.ai/code/session_011yowKCMFCBp61DRBu5xQm4
2026-06-24 01:11:20 -05:00
..
manifest.json chore: Bump version to 0.11.33 2026-06-09 11:16:22 -05:00
server.js fix(bridge): self-heal on session expiry — reinitialize + replay (#238) 2026-06-24 01:11:20 -05:00