Commit graph

6 commits

Author SHA1 Message Date
xlrrrr
67e83260bf fix(search): harden SkillRanker embedding cache
Avoid promoting unverifiable legacy embeddings into content-addressed cache entries, persist empty invalidations, and make cache writes safer for shared search usage.
2026-05-13 03:06:25 +08:00
Fabio Scarsi
fc9534876f fix(search): wire search_skills to SkillRanker embedding cache
Both paths in search_skills/hybrid_search_skills now go through a
shared SkillRanker singleton:

- SkillSearchEngine._bm25_phase: previously instantiated a fresh
  SkillRanker per call, reloading the pickle cache each time.
- hybrid_search_skills candidate loop: previously generated
  embeddings via generate_embedding on every query, ignoring the
  persistent cache entirely.

The persistent pickle at
.openspace/skill_embedding_cache/skill_embeddings_v1.pkl is
reused across invocations and survives process restarts.
Candidates without a stable skill_id are skipped to avoid cache
key collisions.

On a 28-skill local registry with text-embedding-3-small via
OpenRouter, query latency drops from 8-14s to ~300ms after
warm-up. Top-1 match identity is preserved on all test queries
(score drift <0.001).

Cloud candidates that already carry _embedding from the
server-side search endpoint are skipped and unchanged.
2026-04-18 11:52:15 +02:00
Dennis-yxchen
c49696ed7d Fix cloud visibility compatibility 2026-04-09 22:36:09 +08:00
spidercatfly
e1a8524475 feat: migrate cloud search to server-side embedding endpoint 2026-04-02 23:17:44 +08:00
Dennis-yxchen
f845c5f7fb fix(security): harden zip extraction and import_skill against path traversal
- Add resolve() + is_relative_to() check in _extract_zip() to block
  nested traversal entries like nested/../../escape.txt
- Sanitize server-provided skill name in import_skill() to prevent
  directory escape via malicious record metadata
- Add 6 regression tests covering both attack vectors

Closes #17

Co-authored-by: LeftX <xzq-xu@users.noreply.github.com>
2026-03-31 16:23:56 +08:00
spidercatfly
6ff4861f88 initial commit 2026-03-24 16:03:22 +08:00