GH-30: debug runmode — doctor subcommand and live diagnostics - #33
Merged
Merged
Conversation
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.
Summary
Adds a debug runmode for knowledge-mcp (design + plan:
./tmp/docs/session docs):knowledge-mcp debug— one-shot startup diagnosis reusing the real startup path (projects.BuildWithStore→search.Location→ lazy index open). Three report sections (Resolution, Startup trail with a watchdog-bounded index self-query, Environment) followed byok/warn/failfindings; exit 1 iff anyfail. Distinctfail index.lockedvsfail index.open;--no-index-on-startupblocked queries warn instead of fail; zero-entry stores are healthy/fresh.--debug/--log-file <path>(implies--debug) log startup phases and tool calls to stderr with sanitized arguments (entry bodies never written; sizes only).ok=derives from botherrandres.IsError.KNM_DEBUG=1enables the same logging for the Grep/Globhook-augmentplugin hook.search.Location(character-identical move + tests) so the doctor cannot drift from server behavior.### Debuggingsection, knowledge-file example corrected to theproject:/version:/entries:wrapper form;knowledge.Loadfailures now warn (missing optional category files stay silent).Default behavior is unchanged (no flags ⇒ no new output); no new dependencies.
Test plan
go build ./.../gofmt -l ./go vet ./...cleango test ./...— 9/9 packages (includes warm-index race regression under-race)KNM_BIN=./knowledge-mcp prove evals/t/— 175/175make eval-mock— 18/18knowledge-mcp debug --root ...renders three sections, exit 0;KNM_DEBUG=1 hook-augmentlogshook.skipTask-scoped reviews passed for all 6 plan tasks plus fix rounds; final whole-branch review (b63a5f9..a55ede2) passed after one fix round (7ed72ae).
closes #30