Root cause: loadManuallyCreatedProjects() was restoring projects with stale session arrays from localStorage. When loadProjects() tried to merge with fresh API data, the stale sessions would override. Fix 1: In loadManuallyCreatedProjects(), reset the sessions array to empty for each loaded project. This ensures sessions always come from the API (authoritative source) rather than localStorage. Fix 2: In createSessionInFolder(), remove the redundant initialize() call after loadProjects(). initialize() would reload stale localStorage data, undoing the fresh data fetched by loadProjects(). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
54 lines
2.1 KiB
Markdown
54 lines
2.1 KiB
Markdown
# Task: CRITICAL BUG: Project isolation completely broken.
|
|
|
|
## Current Behavior
|
|
User creates new project (e.g., 'roman') and clicks 'Start new session' → ALL sessions from other projects appear in this project's left sidebar.
|
|
|
|
## Previous Failed Attempts
|
|
1. Virtual workingDir approach - didn't work
|
|
2. Skipping virtual sessions in loadProjects() - didn't work
|
|
3. Smart merging logic - still doesn't work
|
|
|
|
## Requirements
|
|
1. Each manually created project should have ONLY its own sessions
|
|
2. Auto-generated projects (from real workingDirs) should still work
|
|
3. Projects must persist across page refreshes
|
|
4. Switching between projects should show only that project's sessions
|
|
|
|
## Files to Analyze
|
|
- /home/uroma/obsidian-web-interface/public/claude-ide/project-manager.js (main logic)
|
|
- /home/uroma/obsidian-web-interface/public/claude-ide/chat-enhanced.js (left sidebar)
|
|
- /home/uroma/obsidian-web-interface/routes/sessions-routes.js (backend API)
|
|
|
|
## Progress
|
|
|
|
### Iteration 1 - Fixed loadChatHistory to respect active project ✅
|
|
Modified `loadChatHistory()` in chat-enhanced.js to check for active project before fetching all sessions from API. When active project exists, it uses `activeProject.sessions` instead.
|
|
|
|
**Commit:** 55aafba
|
|
|
|
### Iteration 2 - Fixed virtual workingDir handling ✅
|
|
Modified `addSessionToProject()` in project-manager.js to correctly extract projectKey from virtual workingDirs (`/virtual/projects/{key}`) instead of converting slashes to dashes.
|
|
|
|
**Commit:** ec790a2
|
|
|
|
### Iteration 3 - Added debugging logging ✅
|
|
Added extensive console logging to track session assignment and project isolation.
|
|
|
|
**Commit:** 9107b3d
|
|
|
|
## Status
|
|
**ALL FIXES IMPLEMENTED** - Ready for browser testing. The fixes address:
|
|
1. loadChatHistory now respects active project filter
|
|
2. Virtual workingDirs are correctly handled when assigning sessions to projects
|
|
3. Detailed logging helps identify any remaining issues
|
|
|
|
<!-- Ralph will continue iterating until task is complete -->
|
|
|
|
## Success Criteria
|
|
|
|
The task is complete when:
|
|
- All requirements are implemented
|
|
- Tests pass
|
|
- Code is documented
|
|
|
|
<!-- When complete, add <!-- COMPLETE --> marker to this file --> |