Claude Code v2.1.91 — Auto-Compaction ChromaDB Pointer Not Reset on Continuation
Summary
When auto-compaction triggers at context limit and spawns a continuation session, the ChromaDB collection pointer is not reset. The new session inherits the stale pointer from the previous session, causing retrieval queries to pull from the wrong collection.
Steps to Reproduce
- Run a long session that approaches context limit and triggers auto-compaction
- Allow the compaction hook to complete and automatically spawn a continuation session
- In the new continuation session, perform a retrieval query (e.g., through embedding lookup, context pulling, or agent research)
- Expected: Retrieval correctly accesses the intended knowledge base/context collection
- Actual: Retrieval pulls data from an incorrect collection (stale pointer from previous session)
Expected Behavior
On session initialization after compaction-triggered continuation, all ChromaDB collection pointers should be reset to a clean state before any retrieval operations execute.
Actual Behavior
Continuation sessions inherit corrupted/stale ChromaDB pointers, causing:
- Retrieval operations access wrong collection
- Agent context becomes misaligned with intended knowledge base
- Potential for hallucinations due to context mismatch
Environment
- Claude Code Version: v2.1.91
- Platform: macOS
- Trigger: Auto-compaction hook on context limit
Impact
This breaks reliability of long-running agent sessions that rely on auto-compaction to continue past context limits. Every continuation inherits corrupted state.
Workaround
Disable auto-compaction and run manual compactions only, or implement local session init that forces ChromaDB pointer reset before retrieval queries.
Additional Context
The issue manifests as retrieval returning data from an unintended context source, which agents then incorporate into their responses, leading to context drift and incorrect behavior.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗