fix(telemetry): only stitch oss identities with evidence of real oss usage

MemoryClient init fired PostHog $identify for anon ids the SDKs had minted
themselves (Python: setup_config() at import time; TS: getOrCreateMem0UserId()
inside the alias path), so ~90% of stitches merged event-less anon persons
into platform users, worst in ephemeral containers.

- never create the anon id from platform client paths; Python mints lazily in
  Memory/AsyncMemory init, gated on MEM0_TELEMETRY
- record telemetry.oss_used_at when OSS Memory genuinely initializes (both
  SDKs, shared ~/.mem0/config.json key) and only stitch the oss user_id when
  the marker is present; cli anon id stays presence-based
- stamp client_version on $identify so fixed-SDK stitches are separable from
  old-SDK noise in PostHog
This commit is contained in:
Younes Slaoui
2026-06-11 12:55:57 -07:00
parent c676c2c458
commit f34e42eef3
11 changed files with 434 additions and 41 deletions
+1
View File
@@ -85,6 +85,7 @@ class UnifiedTelemetry implements TelemetryClient {
properties: {
$anon_distinct_id: anonId,
client_source: "typescript",
client_version: version,
$lib: "posthog-node",
},
};