Commit Graph

142 Commits

Author SHA1 Message Date
lukaszraczylo dbe89f37c8 fix: remove duplicate else block in workflow-prepare.sh v0.13.3 2026-05-26 18:51:02 +01:00
lukaszraczylo 1a4fea5c17 refactor: replace Git LFS with runtime model download from Hugging Face
Remove ~170MB of model files from the repository (LFS + committed).
Models are now downloaded at runtime from Hugging Face on first use
and cached to the OS cache directory with progress reporting and retries.

- Add internal/models/download.go: runtime downloader with retry, progress bar, checksums
- Remove go:embed for ONNX models (keep tokenizers embedded)
- Use file-based ONNX session loading instead of byte-slice
- Add scripts/download-models.sh for dev/CI model setup
- Update Makefile with setup-models target
- Update workflow-prepare.sh to download models in CI
- Set lfs: false in all CI workflows
- SHA256: bge=828e14..., cross-encoder=5d3e70...
2026-05-26 17:53:30 +01:00
github-actions[bot] c8b462aaec chore: update marketplace for v0.12.21 2026-05-26 13:53:19 +00:00
lukaszraczylo a5b18140d3 fix: use build tags for Setpgid (Unix-only) to fix Windows build v0.12.21 2026-05-26 14:46:36 +01:00
lukaszraczylo a81482d06a fix: address 15 additional hang vectors found during deep audit (#45)
MCP server (5 fixes):
- Move semaphore acquisition inside goroutine so main loop stays
  responsive when all slots are taken
- Add 10s write timeout to sendResponse to prevent pipe deadlock
  when Claude Code pauses reading stdout
- Send fallback JSON-RPC error when json.Marshal fails instead of
  silently swallowing the error and leaving caller waiting forever
- Silence unknown notification methods (req.ID == nil) instead of
  sending unsolicited error responses that may desync the host
- Return MCP isError content for tool failures instead of top-level
  JSON-RPC error, matching the MCP specification

Vector/embedding (3 fixes):
- Move EmbedBatchWithContext call before writeMu.Lock in AddDocuments
  so ONNX inference runs outside the write lock
- Replace singleflight.Do with DoChan + ctx select in both
  getOrComputeEmbedding and UnifiedSearch so callers can bail out
  independently when their context expires
- Add activeQueries atomic counter; skip cache warming when user
  queries are in-flight; reduce warming timeout from 5s to 2s

Hooks (4 fixes):
- Cap EnsureWorkerRunning to 15s hard deadline with context; reduce
  StartupTimeout from 30s to 10s; reduce port-in-use retries
- Fix nil dereference panic in user-prompt hook when initResult is
  nil (non-JSON worker response); use comma-ok assertions
- Use package-level hookClient/healthClient with DisableKeepAlives
  to prevent FD leaks in short-lived hook processes
- Set SysProcAttr{Setpgid: true} to detach worker from hook process
  group, preventing kill-cascade from Claude Code

Worker/DB (3 fixes):
- Replace os.Exit(0) in MCP config watcher with context cancellation
  for clean protocol shutdown
- Add 60s context.WithTimeout around ProcessObservation calls in
  processAllSessions to prevent hung CLI subprocesses from blocking
  the queue processor forever
- Set explicit PRAGMA wal_autocheckpoint=1000 and add PASSIVE WAL
  checkpoint to Optimize() to prevent checkpoint stalls

Adds 20+ regression tests across all fix areas.
2026-05-26 14:29:34 +01:00
lukaszraczylo de5796bbe6 test: add regression tests for #45 hang fixes
- MCP server: 4 tests verifying concurrent dispatch, slow-request
  isolation, semaphore limiting, and graceful drain on cancel
- Embedding: 4 tests verifying context-aware mutex cancellation,
  uncontended success, batch cancellation, and cleanup after cancel
- Vector client: 3 tests for acquireRLockWithContext cancel, success,
  and cleanup goroutine correctness
- Worker handlers: 1 test verifying handleSearchByPrompt inherits
  request context cancellation (skips without FTS5)

12 regression tests total covering the four fix areas.
2026-05-26 14:29:34 +01:00
lukaszraczylo 29d57857ff fix: prevent MCP server hanging by adding concurrency, timeouts, and context propagation (#45)
Root cause: synchronous MCP request processing combined with missing
context propagation to the embedding layer caused indefinite hangs when
ONNX inference was slow or the database was contended.

Changes:
- MCP server: dispatch each request in its own goroutine with semaphore
  (cap 10) and WaitGroup for clean shutdown drain
- Embedding: add context-aware mutex acquisition (acquireMutex) so
  callers can bail out instead of blocking forever on a stuck ONNX model
- Vector client: propagate context through getOrComputeEmbedding and
  replace bare RLock() calls with context-aware acquireRLockWithContext
- Worker handlers: add 15s request-scoped timeouts to all search/context
  handlers (handleSearchByPrompt, handleContextInject, handleFileContext,
  handleContextCount, handleGetObservations/Summaries/Prompts)
- Worker HTTP server: set WriteTimeout=60s (was 0); SSE endpoint extends
  deadline per-request via http.ResponseController

Fixes #45
2026-05-26 14:29:34 +01:00
github-actions[bot] 56616d0616 chore: update marketplace for v0.12.11 2026-05-24 04:39:28 +00:00
lukaszraczylo 90803a4885 Update go.mod and go.sum (#44) v0.12.11 2026-05-24 05:30:05 +01:00
github-actions[bot] e2dd736e38 chore: update marketplace for v0.12.3 2026-05-24 02:13:16 +00:00
github-actions[bot] a9677881df chore: update marketplace for v0.12.1 2026-05-24 02:11:59 +00:00
github-actions[bot] 620d538f23 chore: update marketplace for v0.11.118 2026-05-24 02:07:29 +00:00
lukaszraczylo a59b9b1622 chore: remove hand-rolled telemetry pkg; ignore build binaries
- delete internal/telemetry (replaced by oss-telemetry library in prev commit)
- gitignore root /mcp and /worker build artifacts
v0.12.3
2026-05-24 03:03:57 +01:00
lukaszraczylo 00d8871f5e refactor: use oss-telemetry library instead of hand-rolled ping v0.12.1 2026-05-24 03:02:16 +01:00
lukaszraczylo 28b6582dac feat: add OSS analytics ping on MCP server startup v0.11.118 2026-05-24 03:01:15 +01:00
github-actions[bot] dc010fe57d chore: update marketplace for v0.11.113 2026-05-24 01:10:04 +00:00
github-actions[bot] 7e1f6efe3c chore: update marketplace for v0.11.109 2026-05-24 01:05:29 +00:00
lukaszraczylo eab3b58e0f fix: data race in maintenance totalOptimizeRun counter v0.11.113 2026-05-24 02:04:53 +01:00
lukaszraczylo 720a14cd65 chore: fix npm audit vulnerabilities (rollup, vite, uuid, postcss) 2026-05-24 01:58:20 +01:00
lukaszraczylo f07875ee82 fix: plugin no longer vanishes after Claude Code updates
Root cause: plugin registered as directory source in known_marketplaces.json,
which gets wiped on CLI updates. Now registers in extraKnownMarketplaces
(settings.json) as a GitHub source — same mechanism caveman/context-mode use.

Binaries install to ~/.claude-mnemonic/bin/ instead of the Claude-managed
plugins directory. Thin wrapper scripts in the repo let the marketplace
clone find them. Nothing gets cleaned up when Claude refreshes its cache.

Also fixed along the way:
- ONNX Runtime 1.24.3 → 1.26.0 (API v25 mismatch broke all embedding tests)
- Vector client leaked on DB reinit, processQueue had a race on sessionManager
- reloadConfig called os.Exit(0) bypassing graceful shutdown
- Removed dead QueryRowWithTimeout that leaked contexts
- Added tests for graph/watcher/maintenance/update (all were at 0%)
v0.11.109
2026-05-24 01:56:54 +01:00
github-actions[bot] cfc95c9ce4 chore: update marketplace for v0.11.105 2026-04-21 04:14:53 +00:00
lukaszraczylo 62da8e5315 Update go.mod and go.sum (#43) v0.11.105 2026-04-21 05:03:47 +01:00
github-actions[bot] d0200ff9ee chore: update marketplace for v0.11.101 2026-04-10 04:13:01 +00:00
lukaszraczylo c14dbc6877 Update go.mod and go.sum (#42) v0.11.101 2026-04-10 05:03:55 +01:00
github-actions[bot] 9316c7ac8d chore: update marketplace for v0.11.97 2026-04-09 04:08:30 +00:00
lukaszraczylo 73c42c9f55 Update go.mod and go.sum (#41) v0.11.97 2026-04-09 04:59:04 +01:00
github-actions[bot] c258c0c845 chore: update marketplace for v0.11.93 2026-04-07 04:12:24 +00:00
lukaszraczylo be536e56d5 Update go.mod and go.sum (#40) v0.11.93 2026-04-07 04:59:43 +01:00
github-actions[bot] 6b575b92d6 chore: update marketplace for v0.11.89 2026-04-04 03:58:54 +00:00
lukaszraczylo c572408ab4 Update go.mod and go.sum (#39) v0.11.89 2026-04-04 04:50:08 +01:00
github-actions[bot] fae538c169 chore: update marketplace for v0.11.85 2026-04-03 04:06:58 +00:00
lukaszraczylo 9e333a7de1 Update go.mod and go.sum (#38) v0.11.85 2026-04-03 04:58:18 +01:00
github-actions[bot] 458f607b80 chore: update marketplace for v0.11.81 2026-03-30 04:15:50 +00:00
lukaszraczylo 9c0083c24c Update go.mod and go.sum (#37) v0.11.81 2026-03-30 05:03:46 +01:00
github-actions[bot] a0fecab186 chore: update marketplace for v0.11.77 2026-03-28 03:59:53 +00:00
lukaszraczylo 96e64a5796 Update go.mod and go.sum (#36) v0.11.77 2026-03-28 03:50:55 +00:00
github-actions[bot] ef92d710b8 chore: update marketplace for v0.11.73 2026-03-17 03:59:52 +00:00
lukaszraczylo f8702cb0c2 Update go.mod and go.sum (#35) v0.11.73 2026-03-17 03:51:16 +00:00
github-actions[bot] c52bab1e95 chore: update marketplace for v0.11.69 2026-03-13 03:59:45 +00:00
lukaszraczylo 1eec436746 Update go.mod and go.sum (#34) v0.11.69 2026-03-13 03:49:54 +00:00
github-actions[bot] 3ccb20df63 chore: update marketplace for v0.11.65 2026-03-09 03:58:43 +00:00
lukaszraczylo 5fbba6bace Update go.mod and go.sum (#33) v0.11.65 2026-03-09 03:50:24 +00:00
github-actions[bot] de422c0de0 chore: update marketplace for v0.11.61 2026-03-07 03:51:29 +00:00
lukaszraczylo db2a552eb8 Update go.mod and go.sum (#32) v0.11.61 2026-03-07 03:42:12 +00:00
github-actions[bot] 195caffc59 chore: update marketplace for v0.11.57 2026-03-07 01:34:33 +00:00
lukaszraczylo 7b979a3f95 fix: prevent internal prompts and duplicates in memory database
- Add server-side detection of SDK processor's internal system prompt
  in handleSessionInit, since CLAUDE_MNEMONIC_INTERNAL env var is not
  propagated by Claude Code to hook subprocesses
- Add cross-session duplicate detection (FindRecentPromptByTextGlobal)
  to catch same prompt text arriving from different session IDs
- Add hooks, mcpServers, and commands references to plugin.json per
  Claude Code plugin spec
- Remove MCP server injection from register-plugin.sh (now in plugin.json)
- Use ${CLAUDE_PLUGIN_ROOT} for statusline path instead of hardcoded path
- Add python3 fallback for plugin registration when jq is unavailable
- Replace hardcoded 1.0.0 version in findWorkerBinary with glob lookup
- Add cache copy verification in register-plugin.sh
- Add update-version Makefile target to keep metadata in sync
v0.11.57
2026-03-07 01:28:04 +00:00
github-actions[bot] 49e7efd27d chore: update marketplace for v0.11.53 2026-03-07 00:36:01 +00:00
lukaszraczylo fcab3ebef4 fixup! fixup! fixup! fixup! fixup! chore: update marketplace for v0.11.37 v0.11.53 2026-03-07 00:25:52 +00:00
lukaszraczylo a1d4459329 fixup! fixup! fixup! fixup! chore: update marketplace for v0.11.37
march-improvements
2026-03-07 00:12:13 +00:00
github-actions[bot] 5a81f37779 chore: update marketplace for v0.11.47 2026-03-06 23:53:50 +00:00