Fix recall-shape false warning + nudge to reconnect a stale MCP server#42
Merged
Conversation
`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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two OpenViking 0.4.4 diagnostics fixes that surfaced after the 1.4.x pin.
Fix —
recall shapedoctor probe false-warned on a healthy OpenViking 0.4.4ov find/search --output jsonprints acmd: ...preamble line before the JSON, and the buckets live under theresultenvelope ({ok, result: {memories, resources, skills}}).recallShapeCheckdid a naiveJSON.parse(stdout)and checked top-level buckets, so on a perfectly working 0.4.4 it always warned:It now mirrors
parseRecallHitsexactly — start at the first line beginning with{, readresult.{memories,resources,skills}. Verified:doctornow reportsOK recall shape: memories/resources/skills buckets presentagainst ov 0.4.4.Feature — reconnect nudge when threadnote was updated under a running MCP server
threadnote updateoverwrites 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-idbreak 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, andhealthresults (cached 60s):The pure decision lives in
utils.formatStaleVersionNotice(unit-tested);currentPackageVersionmoved toutils(re-exported fromupdate.ts) so the MCP bundle doesn't pull inupdate.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.formatStaleVersionNotice(newer/older/equal/unknown). Recall-shape fix verified against a live ov 0.4.4 vianpm run doctor.