Skip to content

Fix recall-shape false warning + nudge to reconnect a stale MCP server#42

Merged
Kashkovsky merged 2 commits into
mainfrom
feat/mcp-stale-version-nudge
Jun 19, 2026
Merged

Fix recall-shape false warning + nudge to reconnect a stale MCP server#42
Kashkovsky merged 2 commits into
mainfrom
feat/mcp-stale-version-nudge

Conversation

@Kashkovsky

Copy link
Copy Markdown
Owner

Two OpenViking 0.4.4 diagnostics fixes that surfaced after the 1.4.x pin.

Fix — recall shape doctor probe false-warned on a healthy OpenViking 0.4.4

ov find/search --output json prints a cmd: ... preamble line before the JSON, and the buckets live under the result envelope ({ok, result: {memories, resources, skills}}). recallShapeCheck did a naive JSON.parse(stdout) and checked top-level buckets, so on a perfectly working 0.4.4 it always warned:

WARN recall shape: search output is not JSON; recall may silently return nothing

It now mirrors parseRecallHits exactly — start at the first line beginning with {, read result.{memories,resources,skills}. Verified: doctor now reports OK recall shape: memories/resources/skills buckets present against ov 0.4.4.

Feature — reconnect nudge when threadnote was updated under a running MCP server

threadnote update overwrites the package on disk, but the MCP server is a long-lived stdio process owned by the client (Claude Code, etc.), which does not respawn it mid-session. So after an update the caller silently keeps hitting the old resident code — exactly what made the 0.4.4 --agent-id break persist until a manual reconnect.

The MCP server now captures its startup version and, when a newer threadnote is found on disk, appends a one-line reconnect notice to recall_context/search, remember_context/store, and health results (cached 60s):

⚠ threadnote 1.4.2 is installed but this MCP server is still running 1.4.1. Reconnect the threadnote MCP server (e.g. /mcp) to load the update.

The pure decision lives in utils.formatStaleVersionNotice (unit-tested); currentPackageVersion moved to utils (re-exported from update.ts) so the MCP bundle doesn't pull in update.ts.

This is a nudge, not a forced restart — threadnote can't make a client respawn its own stdio child; surfacing the staleness is the robust option.

Test plan

  • npm run typecheck, npm run lint, npm test (287 tests / 24 files) green on each commit.
  • New tests: formatStaleVersionNotice (newer/older/equal/unknown). Recall-shape fix verified against a live ov 0.4.4 via npm run doctor.

`ov find/search --output json` prints a `cmd: ...` preamble line before the
JSON, and the buckets live under the `result` envelope. recallShapeCheck did a
naive JSON.parse of the whole stdout and checked top-level buckets, so it
always warned ("search output is not JSON; recall may silently return
nothing") on a perfectly working server. It now mirrors parseRecallHits:
start at the first line beginning with `{` and read result.{memories,
resources,skills}.
A `threadnote update` overwrites the package on disk, but the MCP server is a
long-lived stdio process owned by the client (Claude Code, etc.), which does
not respawn it mid-session — so callers silently keep hitting the old code
(e.g. the 0.4.x --agent-id break) until they reconnect.

The MCP server captures its startup version and, when a newer threadnote is
found on disk, appends a one-line reconnect notice to recall_context/search,
remember_context/store, and health results (cached 60s). The pure decision
lives in utils.formatStaleVersionNotice; currentPackageVersion moved to utils
(re-exported from update.ts) so the MCP bundle doesn't pull in update.ts.
@Kashkovsky Kashkovsky merged commit 89054ca into main Jun 19, 2026
7 checks passed
@Kashkovsky Kashkovsky deleted the feat/mcp-stale-version-nudge branch June 19, 2026 14:33
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