Bugfix: How to fix critical session management issues in MCP system?
Documentation for Sessions
🐛 Bugfix: How to fix critical session management issues in MCP system?
📋 Decision Context
Question:
How to fix critical session management issues in MCP system?
Task: Fix session 30 manifest creation, active.json sync, and prevent future session tracking errors
🎯 Decision Made
Chosen:
Create proper session-30.json manifest, regenerate active.json, fix MCP session detection to read from active.json first, add validation checks
Options Considered:
- Manual session tracking only
- Fix session detection in MCP
- Ignore session numbers
- Use timestamp-based sessions
💭 Reasoning
Root cause: MCP server's session detection was reading stale data or falling back to wrong session. The session-30.json was created but empty (1 byte). Active.json was missing entirely. This caused MCP to log decisions to session 29.11 instead of 30.1. Fix requires: (1) Properly populate session-30.json with complete manifest, (2) Run yarn session:sync to regenerate active.json, (3) Update MCP session detector to prioritize active.json and validate session exists, (4) Add checks to prevent logging to wrong session. Also discovered: numbered directory names (01-getting-started) violate AGENTS.md standards - should use frontmatter 'order' property instead.
📁 Files Involved
sessions/sessions-history/editor2/session-30.jsonMCP/mcp-development-ai/src/session/session-detector.ts
🔗 Related
- Decision ID:
dev_1767897192488_hx2zzof - Session: 29
- Workspace: editor2
Auto-generated by MCP Smart Consolidation