logs.gokuls.in

2 pull requests merged across 1 repo

bahdotsh/indxr

  • Replace sh -c invocation in src/llm/command.rs with shlex::split() + direct execution to prevent shell metacharacter injection via --exec flag and INDXR_LLM_COMMAND env var
  • Add shlex as a direct dependency (already a transitive dep)
  • Commands with arguments (e.g. my-llm --model gpt4) still work correctly via shlex tokenization

Closes #23

Test plan

  • cargo clippy --features wiki — clean
  • cargo fmt — clean
  • cargo test — all 358 tests pass
  • Manual: indxr wiki generate --exec 'echo test; echo injected' fails to find binary instead of executing injection
  • Adds FailurePattern struct to wiki page frontmatter for recording failed fix attempts (symptom, attempted_fix, diagnosis, actual_fix, source_files, timestamps)
  • New wiki_record_failure MCP tool with auto-routing to best matching wiki page via existing score_pages(), or creates a new topic page
  • Extends wiki_contribute with failures and resolve_failures params (mirrors existing contradiction resolution pattern)
  • Enhances wiki_search to score against failure symptoms and surface failure counts in results (+ include_failures: true for full details)
  • Enhances wiki_read and wiki_status to display failure data

Motivation

When AI agents fail at fixing issues, that failure context is lost when the conversation ends. The next agent starts from scratch and may repeat the same mistakes. This feature lets agents record structured failure patterns into the wiki so future agents can learn from past failures before attempting similar fixes.

Changes

FileChanges
src/wiki/page.rsFailurePattern struct, failures field on Frontmatter, 2 new tests
src/wiki/mod.rsPreserve failures in compound_into_wiki
src/wiki/generate.rsAdd failures field to 3 Frontmatter constructions
src/mcp/tools.rswiki_record_failure tool def + impl, wiki_contribute extension, wiki_search/wiki_read/wiki_status enhancements
src/mcp/mod.rsDispatch + import for wiki_record_failure
src/mcp/tests.rs12 new tests, fixture updates, tool count assertion
CLAUDE.mdDocument new tool (#34), update tool count

Test plan

  • cargo build --features wiki compiles cleanly
  • cargo build (without wiki) compiles cleanly
  • cargo test --features wiki — all 432 unit + 7 integration = 439 tests pass
  • New tests cover: auto-routing, explicit page targeting, new page creation, missing params, contribute with failures, failure resolution, search counts/symptoms/include_failures flag, read display
  • Manual MCP test: start server, call wiki_record_failure, verify via wiki_search/wiki_read/wiki_status