Agent Memory Errors Handbook: Cases 71–75
This installment is part of the Agent Memory Errors: 100 Cases Handbook series.
Case 71: Cross-session & User Identity Errors — Session Isolation Memory Leak
Scenario
The Agent uses a process pool to handle requests. After user A’s session ends, the process does not fully clean working memory such as global variables and static caches. The next request assigned to that process comes from user B, who accesses user A’s residual data.
Error Manifestation
User B asks, “What are my preference settings?” and the Agent returns user A’s preferences (e.g., “You like dark mode”), making user B feel their privacy is violated.
Solution
- Use independent processes or containers per session and forcibly destroy them after the session ends
- Run a memory-cleanup checklist on session switch: clear session variables, caches, and temp files
- Bind all session data to a session-context object whose lifecycle matches the session
Principle
Process pools improve resource utilization but challenge state isolation. Without strict cleanup, the previous session’s memory leaks to the next, which is a serious privacy issue.
Case 72: Cross-session & User Identity Errors — User Id Aliasing Identity Merging
Scenario
The system supports email, phone, and WeChat login. User A registered with alice@example.com; user B registered with phone 13800138000. Later user B binds alice@example.com—user A’s email—because the system fails to enforce uniqueness. The system merges the two identities based on email.
Error Manifestation
User B sees all of user A’s conversations and memories, including sensitive information. User A’s later conversations are mixed with user B’s preferences.
Solution
- Build a unified identity graph that distinguishes login credentials from user identity; multiple credentials may link to one identity but require explicit confirmation
- Verify similarity before merging: check historical behavior and device fingerprints, and require human review for anomalies
- Prefer identity isolation: it is safer to mistakenly treat one user as two than two users as one
Principle
User identity is the primary key of the Agent memory system. Identity errors cause severe memory confusion. Conservative merging is safer than aggressive merging.
Case 73: Cross-session & User Identity Errors — Guest Session Upgrade Data Loss
Scenario
A user talks with the Agent in guest mode and accumulates many preference memories (style, address, etc.). When the user registers, the process creates a new user ID without migrating guest-session memories to the new account.
Error Manifestation
After registration the user finds the Agent has “forgotten” all previous preferences and must reconfigure them, feeling the experience regressed.
Solution
- Assign a temporary user ID to guest sessions and migrate memories to the new ID on registration
- Ask explicitly during registration, “Do you want to keep settings from your guest session?”
- Set a guest-session retention period (e.g., 30 days) during which the user can register and restore memories
Principle
Guest-to-registered-user conversion is a key lifecycle moment. Losing memories at this transition zeros out the user’s earlier investment and lowers conversion.
Case 74: Cross-session & User Identity Errors — Cross Device Session State Sync Lag
Scenario
The user chats with the Agent on mobile and sets language preference to Chinese. Later the user logs in on desktop. Due to a five-minute server-state sync lag, the desktop Agent still uses the default English.
Error Manifestation
The user receives English replies on desktop and wonders, “Didn’t I set Chinese?” suspecting the setting was not saved.
Solution
- Store critical user state in strongly consistent storage such as etcd or ZooKeeper
- Devices actively pull the latest user state on startup rather than waiting for passive sync
- Send invalidation notifications to all online devices when state changes, triggering real-time refresh
Principle
Cross-device consistency is foundational to user experience. Eventual consistency is unacceptable within user-perceivable time windows (seconds).
Case 75: Cross-session & User Identity Errors — Session Timeout Mid Interaction
Scenario
The user is in the middle of a complex multi-step task such as filling a long form and leaves for 30 minutes. The Agent’s session timeout is 30 minutes, so when the user returns the session has expired and all entered information and progress are lost.
Error Manifestation
The user has to start over, wasting 15 minutes of work, and angrily abandons the task.
Solution
- Save breakpoints for ongoing tasks: persist progress after each step
- Warn before timeout and let the user extend the session with one click
- Distinguish session idle timeout from task timeout: extend validity while a task is in progress
Principle
Session timeouts protect resources and security but should not sacrifice user experience. Task-state persistence is key to preventing long tasks from being interrupted.
Source: Agent Search