fix: resolve UTF-8 string slicing bugs and feature flag issues

- Fix silent errors in stdio.rs: clients now receive fallback error
  responses instead of hanging when JSON serialization fails
- Fix UTF-8 panics in keyword.rs: use char-aware slicing instead of
  byte offsets for query sanitization and term highlighting
- Fix UTF-8 panics in prospective_memory.rs: replace hard-coded byte
  offsets with char-aware slicing for natural language parsing
- Fix UTF-8 panics in git.rs: convert byte positions to char positions
  before slicing commit messages
- Fix feature flag bug in vestige-mcp: add proper [features] section
  to forward embeddings and vector-search features from vestige-core,
  enabling the #[cfg(feature = "embeddings")] initialization code

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Sam Valladares 2026-01-27 01:14:59 -06:00
parent f10367ecd0
commit bfa91474a6
6 changed files with 70 additions and 44 deletions

View file

@ -52,6 +52,10 @@ impl StdioTransport {
}
Err(e) => {
error!("Failed to serialize error response: {}", e);
// Send a minimal error response so client doesn't hang
let fallback = r#"{"jsonrpc":"2.0","id":null,"error":{"code":-32603,"message":"Internal error"}}"#;
let _ = writeln!(stdout, "{}", fallback);
let _ = stdout.flush();
}
}
continue;
@ -68,6 +72,10 @@ impl StdioTransport {
}
Err(e) => {
error!("Failed to serialize response: {}", e);
// Send a minimal error response so client doesn't hang
let fallback = r#"{"jsonrpc":"2.0","id":null,"error":{"code":-32603,"message":"Internal error"}}"#;
let _ = writeln!(stdout, "{}", fallback);
let _ = stdout.flush();
}
}
}