EverOS/tests/unit/test_memory
zhanghui 0cbfb9f854 fix(observability): address OTel review findings
Adversarial review of the merged OTel instrumentation (#352) surfaced
four issues, all on the enabled path (default-off, so no impact until
tracing is turned on):

- search LLM client was unwrapped, so hybrid/agentic token usage — the
  heaviest LLM spend — never reached Langfuse. Wrap it with
  UsageRecordingClient when observability is enabled, mirroring
  get_llm_client(); graceful keyword-only degradation is preserved.
- set_generation_usage overwrote token counts, undercounting any span
  that wraps more than one chat call (the now-wrapped agentic path).
  Accumulate instead of replacing.
- recall_hit was emitted for uncalibrated methods (unbounded BM25 /
  single-route vector), a near-constant always-hit signal that inflates
  dashboards. Gate hit on calibrated methods (HYBRID/AGENTIC); keyword
  and vector emit only the raw top_score.
- init_tracing / init_score_sink were not idempotent — a re-init without
  an intervening shutdown orphaned the export thread + OTLP socket +
  worker task. Tear down the previous instance first (init_score_sink is
  now async).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-24 15:29:54 +08:00
..
test_cascade chore(release): update EverOS to 1.1.4 (#348) 2026-07-23 13:18:19 +08:00
test_extract feat(observability): instrument memory ops + OME trace linking 2026-07-23 20:47:39 +08:00
test_get feat(observability): instrument memory ops + OME trace linking 2026-07-23 20:47:39 +08:00
test_prompt_slots chore: initialize EverOS 1.0.0 2026-06-06 07:33:17 +08:00
test_reflection feat(observability): instrument memory ops + OME trace linking 2026-07-23 20:47:39 +08:00
test_search fix(observability): address OTel review findings 2026-07-24 15:29:54 +08:00
test_strategies chore(release): update EverOS to 1.1.1 (#327) 2026-07-07 18:30:03 +08:00
__init__.py chore: initialize EverOS 1.0.0 2026-06-06 07:33:17 +08:00
test_events.py chore: initialize EverOS 1.0.0 2026-06-06 07:33:17 +08:00
test_models.py chore: initialize EverOS 1.0.0 2026-06-06 07:33:17 +08:00