knolo-core icon indicating copy to clipboard operation
knolo-core copied to clipboard

Bug: knolo-box mcp serves a stale image after rebuild; knolo_verify reports pin mismatch instead of stale

Open HiveForensicsAI opened this issue 1 month ago • 0 comments

For human review. This is a bug report, not a ready fix. A human maintainer will review it and implement it manually. No code or PRs come with this issue. No version bump or npm publish is requested.

Summary

A running knolo-box mcp server keeps serving the image it loaded at startup after knolo-box build writes a new one. Search keeps returning content from the old image, including content deleted from the sources. knolo_verify then reports IMAGE_INVALID: Image skills does not match its SHA-256 pin., which reads like tampering rather than "rebuilt since start". This affects any knolo-box install where the MCP host keeps a long-lived stdio process.

Steps to reproduce (main at 434b58a)

  1. An MCP host starts the connector over stdio: node packages/box/bin/knolo-box.mjs mcp --config <config>.
  2. Change a skills root, for example by deleting a skill folder. Then run knolo-box build --config <config>. The build writes a new skills.v5, pins.json and knolo-mcp.json, and knolo-box status shows the new stateRoot with pinMatches: true.
  3. Leave the same mcp process running. knolo_search still returns hits from the deleted file, and each hit and receipt carries the old stateRoot. knolo_verify returns IMAGE_INVALID: Image skills does not match its SHA-256 pin.
  4. The host's normal reconnect or restart didn't replace the stdio process. Search used the new stateRoot and knolo_verify returned valid: true only after the process was killed and a new one started.

Expected behavior

One of these, in order of preference:

  1. Reload. The server notices the rebuilt image and reloads it. It could compare the pin, size or mtime of the pinned files on each request, or watch them. It would check the new image against the new pin before serving it, and fail closed if that check fails.
  2. Clear error. If reloading isn't supported, knolo_search, knolo_get and knolo_verify return a distinct error code and message, such as IMAGE_REBUILT: image rebuilt since server start; restart the server. That error must not be a pin mismatch that looks like tampering, and search must not return hits from the stale image.

knolo_status should also show both the loaded stateRoot and the on-disk pinned stateRoot when they differ.

Why it matters

Content removed from the sources, which can include sensitive material, stays searchable through the running server until a full process restart. A real tamper case and a routine rebuild currently produce the same error, so users can't tell them apart.

Docs

docs/box/README.md already says a build "does not reload a server that is already running" and that "the new pin loads on the next start". Please make this more prominent, and add it to packages/box/README.md and the knolo-box skill. State that a full process restart is needed, since a host-level reconnect may not replace a stdio process. Add a note on how to confirm the change, for example by matching knolo_status stateRoot with knolo-box status.

Acceptance criteria

  • A test starts the server, rebuilds with a removed source file, and then confirms one of two outcomes. Either search no longer returns the removed content and verify is valid against the new pin (reload), or every tool returns the distinct rebuilt error with no stale hits (no reload).
  • A test with a truly tampered image still returns the existing IMAGE_INVALID error, separate from the rebuilt case.
  • Pins are still checked before any query is served, and the server stays read-only.
  • The docs and the skill describe the restart requirement or the reload behavior.

Related

  • #111 @knolo/box 0.1.0
  • #113 / #114 knolo-box layout discovery
  • #79 / #87 @knolo/mcp

HiveForensicsAI avatar Nov 04 '26 14:11 HiveForensicsAI