Bug: knolo-box mcp serves a stale image after rebuild; knolo_verify reports pin mismatch instead of stale
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)
- An MCP host starts the connector over stdio:
node packages/box/bin/knolo-box.mjs mcp --config <config>. - Change a skills root, for example by deleting a skill folder. Then run
knolo-box build --config <config>. The build writes a newskills.v5,pins.jsonandknolo-mcp.json, andknolo-box statusshows the newstateRootwithpinMatches: true. - Leave the same
mcpprocess running.knolo_searchstill returns hits from the deleted file, and each hit and receipt carries the oldstateRoot.knolo_verifyreturnsIMAGE_INVALID: Image skills does not match its SHA-256 pin. - The host's normal reconnect or restart didn't replace the stdio process. Search used the new
stateRootandknolo_verifyreturnedvalid: trueonly after the process was killed and a new one started.
Expected behavior
One of these, in order of preference:
- 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.
- Clear error. If reloading isn't supported,
knolo_search,knolo_getandknolo_verifyreturn a distinct error code and message, such asIMAGE_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_INVALIDerror, 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/box0.1.0 - #113 / #114 knolo-box layout discovery
- #79 / #87
@knolo/mcp