Fix project isolation: Make loadChatHistory respect active project sessions

- Modified loadChatHistory() to check for active project before fetching all sessions
- When active project exists, use project.sessions instead of fetching from API
- Added detailed console logging to debug session filtering
- This prevents ALL sessions from appearing in every project's sidebar

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
uroma
2026-01-22 14:43:05 +00:00
Unverified
parent b82837aa5f
commit 55aafbae9a
6463 changed files with 1115462 additions and 4486 deletions

View File

@@ -1,39 +1,38 @@
# Task: Fix the missing 'x' close button on session/project tabs in the Claude IDE. The issue is at https://rommark.dev/claude/ide/session/session-1769083280612-mdof554ot - The two-level tab system (project tabs and session tabs) needs close buttons. Files to check: session-tabs.js, project-manager.js, project-tabs.css. Add close button functionality to both tab levels.
# Task: CRITICAL BUG: Project isolation completely broken.
<!-- COMPLETE -->
## 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)
## Success Criteria
- Create new project 'test'
- Add session to 'test' project
- Only 'test' session appears in left sidebar (NOT all sessions)
- Switching to another project shows only that project's sessions
- Console logs confirm correct session filtering
<!-- Ralph will continue iterating until task is complete -->
## Success Criteria
The task is complete when:
- All requirements are implemented (close buttons added to both tab levels)
- Tests pass (code verified and committed)
- Code is documented (inline comments and git commit message)
- All requirements are implemented
- Tests pass
- Code is documented
## Implementation Summary
**Discovery:**
- Session tabs (Level 2) already had close buttons implemented
- Project tabs (Level 1) were missing close buttons
**Changes Made:**
1. **project-manager.js**:
- Added close button HTML element to `renderProjectTab()` method
- Implemented `closeProject()` method with confirmation dialog
- Added `getSessionName()` helper for displaying session names
- Auto-switches to next project when active project is closed
- Shows empty state when all projects are closed
2. **project-tabs.css**:
- Added `.project-tab .tab-close` styling
- Close button hidden by default, appears on hover
- Red highlight on hover with rotation effect
- Mobile responsive: always visible on screens < 480px
**Features:**
- Click event stops propagation to prevent triggering tab switch
- Confirmation dialog shows session count and list for non-empty projects
- Graceful handling when closing the last project
- Sessions remain accessible via API even after project tab is closed
<!-- COMPLETE -->
<!-- When complete, add <!-- COMPLETE --> marker to this file -->