MiMo-Code icon indicating copy to clipboard operation
MiMo-Code copied to clipboard

Prompt History Cross-Contamination Between Sessions After Window Reopen

Open caiyilian opened this issue 5 months ago • 2 comments

Summary

When working with multiple MiMo Code windows simultaneously, each window correctly maintains its own prompt history. However, after closing and reopening a window (and restoring the session), the prompt history may become cross-contaminated with prompts from other windows.

Steps to Reproduce

  1. Open two MiMo Code windows (Window A and Window B) with different working directories or sessions
  2. In Window A: Send a prompt "Task A prompt"
  3. In Window B: Send a prompt "Task B prompt"
  4. Verify: In each window, press the Up arrow key - Window A shows "Task A prompt", Window B shows "Task B prompt" (this works correctly)
  5. Close Window B completely
  6. Reopen Window B and restore the previous session (using session command or session restore)
  7. In the reopened Window B: Press the Up arrow key

Expected Behavior

Window B should show "Task B prompt" (its own previous prompt).

Actual Behavior

Window B may show "Task A prompt" (the prompt from Window A) or some other prompt from a different window/session.

Possible Cause (Brief Analysis)

The issue appears to be related to how session identifiers are managed during session restoration:

  1. Each window's prompt history is stored using a scoped key that includes the workspace directory and session ID
  2. When a window is reopened and the session is restored, the session ID may not be correctly re-associated
  3. This can cause the window to read from or write to a shared/default storage location that other windows also access
  4. As a result, the prompt history becomes cross-contaminated between what should be isolated sessions

The storage key generation logic (likely in Persist.scoped() or similar) may be producing identical keys for different sessions when the session ID is undefined or not properly restored.

Environment

  • MiMo Code version: 0.1.0
  • Operating System: Windows 11
  • Installation method: npm install -g @mimo-ai/cli

Additional Context

  • The issue does not occur when both windows remain open simultaneously
  • The issue specifically manifests after window close + reopen + session restore
  • The cross-contamination appears to be unidirectional or random (not consistently bidirectional)

caiyilian avatar Jun 12 '26 03:06 caiyilian

@nightt5879 请帮忙看一下这个问题,涉及 session 恢复后 prompt history 的存储 key 可能发生冲突。

caiyilian avatar Jun 12 '26 03:06 caiyilian

Prompt history cross-contamination between sessions is a memory isolation bug — session state isn't being cleared on window reopen.

AgentAutopsy's memory drift detector flags exactly this pattern — when context from a previous run bleeds into a new one.

github.com/Abhisekhpatel/AgentAutopsy

Abhisekhpatel avatar Jun 13 '26 00:06 Abhisekhpatel