Skip to content

fix(mcp): centroid drift resistance and trust score decay persistence (#2311, #2312)#2325

Merged
bug-ops merged 1 commit intomainfrom
fix/2311-mcp-centroid-drift
Mar 28, 2026
Merged

fix(mcp): centroid drift resistance and trust score decay persistence (#2311, #2312)#2325
bug-ops merged 1 commit intomainfrom
fix/2311-mcp-centroid-drift

Conversation

@bug-ops
Copy link
Copy Markdown
Owner

@bug-ops bug-ops commented Mar 28, 2026

Summary

Changes

  • crates/zeph-mcp/src/embedding_guard.rs: adaptive EMA in record_clean(), ema_floor field + constructor parameter
  • crates/zeph-mcp/src/trust_score.rs: decay write-back in load(), decay applied in load_all() without persisting
  • crates/zeph-config/src/sanitizer.rs: ema_floor: f32 field on EmbeddingGuardConfig with serde default 0.01
  • CHANGELOG.md: entries under [Unreleased]

Test plan

  • cargo nextest run -p zeph-mcp --lib — 283 tests pass (includes 6 new tests)
  • cargo nextest run --workspace --features full --lib --bins — 6915/6915 pass
  • cargo +nightly fmt --check — clean
  • cargo clippy --workspace --features full -- -D warnings — zero warnings

Follow-up issues filed

Closes #2311
Closes #2312

@github-actions github-actions bot added documentation Improvements or additions to documentation rust Rust code changes bug Something isn't working size/L Large PR (201-500 lines) labels Mar 28, 2026
@bug-ops bug-ops enabled auto-merge (squash) March 28, 2026 08:12
…#2311, #2312)

EmbeddingAnomalyGuard: switch record_clean() to adaptive EMA. During
cold-start (n < min_samples) the existing running mean is preserved for
fast convergence. After stabilization, alpha is clamped to ema_floor
(default 0.01) so each adversarial clean sample can shift the centroid
by at most 1%, bounding the boiling-frog attack surface.

TrustScoreStore: persist the decayed score back to SQLite in load() when
decay > epsilon. Prevents apply_delta() from operating on the stale
pre-decay value. load_all() applies decay without persisting (display
path; documented trade-off). Consecutive load() calls within the same
second skip the UPDATE.

Follow-up: #2322 (ema_floor config validation), #2323 (load-before-delta
in probe paths).
@bug-ops bug-ops force-pushed the fix/2311-mcp-centroid-drift branch from a0fdd7c to 39b92c7 Compare March 28, 2026 08:26
@bug-ops bug-ops merged commit d994661 into main Mar 28, 2026
25 checks passed
@bug-ops bug-ops deleted the fix/2311-mcp-centroid-drift branch March 28, 2026 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working documentation Improvements or additions to documentation rust Rust code changes size/L Large PR (201-500 lines)

Projects

None yet

1 participant