Skip to content

fix(skill-store): fix broken embed calls and dedup threshold - #1001

Merged
lightzt99 merged 1 commit into
oceanbase:mainfrom
jfeng18:fix/skill-store-embed-and-threshold
Jun 11, 2026
Merged

fix(skill-store): fix broken embed calls and dedup threshold#1001
lightzt99 merged 1 commit into
oceanbase:mainfrom
jfeng18:fix/skill-store-embed-and-threshold

Conversation

@jfeng18

@jfeng18 jfeng18 commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Summary

The skill distillation storage pipeline (add_skill(), search_skills()) was non-functional due to two compounding bugs:

  • self._embed() was never defined on Memory — all calls raised AttributeError at runtime. Replaced with self.embedding.embed() at 5 call sites.
  • Dedup similarity_threshold defaulted to 0.75, but the skill store's RRF fusion score maxes out at 4*(1/60) = 0.0667. The dedup condition could never trigger, making the merge path dead code. Changed default to 0.03.

Details

Bug 1: _embed undefined

# Before (crashes):
title_emb = self._embed(title)        # AttributeError

# After (works):
title_emb = self.embedding.embed(title)  # uses the initialized embedder

Bug 2: threshold/score-space mismatch

Max RRF score: 4 * 1/(60+0) = 0.0667
Old threshold: 0.75  →  0.0667 > 0.75 = False (always)
New threshold: 0.03  →  0.0667 > 0.03 = True  (when 2+ lanes match)

Test plan

  • Verified self.embedding is unconditionally set in __init__ (line 268)
  • Verified embed() signature is compatible across all 16 embedder implementations
  • Verified no remaining self._embed( calls in codebase
  • Verified no test mocks _embed (no breakage)
  • No existing tests assert on old threshold value 0.75
  • CI tests pass
  • Note: add_skill() and search_skills() have no dedicated test coverage (pre-existing gap)

🤖 Generated with Claude Code

Two bugs made the skill distillation storage pipeline non-functional:

1. self._embed() was never defined on Memory — all add_skill() and
   search_skills() calls raised AttributeError at runtime. Fixed by
   replacing with self.embedding.embed() (5 call sites).

2. Dedup similarity_threshold defaulted to 0.75, but skill search uses
   RRF fusion whose max possible score is 4*(1/60) = 0.0667. The dedup
   condition could never trigger, making merge dead code. Changed default
   to 0.03 (fires when ~2+ search lanes match at rank 0).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

@lightzt99 lightzt99 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@lightzt99
lightzt99 merged commit 0d41da2 into oceanbase:main Jun 11, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants