d7e2a0e7b0
The deterministic resolver from #5076 silently rebucketed every user who hadn't set MEM0_USER_ID. With MEM0_API_KEY present (the normal case — hooks early-exit without it), the resolver picked "mem0-<sha256(api_key)[:12]>" instead of $USER, so an existing "deshraj" bucket suddenly became "mem0-f34dd1cba657" on update with no migration. The old memories aren't reachable from the plugin anymore, and the user gets a fresh empty bucket without warning. Resolution priority is now back to: 1. MEM0_USER_ID env var 2. \$USER, else "default" The ~/.mem0/identity.json cache is no longer written or read; any existing cache file becomes inert. Users on multiple machines who want a single bucket can still set MEM0_USER_ID explicitly — that's the supported path, not silent derivation. Also dropped the "regardless of which machine you're on" line from the session bootstrap header since it no longer applies.
17 lines
379 B
Bash
17 lines
379 B
Bash
# Source this file. Sets MEM0_RESOLVED_USER_ID.
|
|
#
|
|
# Resolution priority:
|
|
# 1. MEM0_USER_ID env var (explicit override)
|
|
# 2. $USER, else "default"
|
|
|
|
_mem0_resolve_identity() {
|
|
if [ -n "${MEM0_USER_ID:-}" ]; then
|
|
printf '%s' "$MEM0_USER_ID"
|
|
return
|
|
fi
|
|
printf '%s' "${USER:-default}"
|
|
}
|
|
|
|
MEM0_RESOLVED_USER_ID="$(_mem0_resolve_identity)"
|
|
export MEM0_RESOLVED_USER_ID
|