Commit Graph

4 Commits

Author SHA1 Message Date
mindesbunister
32f9d98340 Fix cleanup process timing and coordination with analysis sessions
CRITICAL BUG FIX: Cleanup process was interfering with active analysis sessions

- Aggressive cleanup was running during active analysis, causing navigation failures
- Progress tracking was not properly coordinated with cleanup system
- No session state checking before process termination

1. AUTOMATION SERVICE COORDINATION:
   - Added proper progress tracking to automation cycles
   - Created unique session IDs for each analysis run
   - Integrated with progressTracker for session state management
   - Added post-analysis cleanup triggers with proper timing

2. ENHANCED CLEANUP INTELLIGENCE:
   - Improved session checking with detailed logging of active sessions
   - Added process age filtering in development mode (only kill >5min old processes)
   - Better error handling when progress tracker import fails
   - More granular cleanup control with session state awareness

3. TIMING IMPROVEMENTS:
   - Post-analysis cleanup now waits for session completion
   - Added proper delays between analysis phases
   - Implemented graceful cleanup deferral when sessions are active
   - Added delayed cleanup fallback for stuck sessions

4. DEVELOPMENT MODE SAFETY:
   - Gentler SIGTERM → SIGKILL progression for development
   - Only clean processes older than 5 minutes during dev
   - Better logging of process age and cleanup decisions
   - Safer fallback behavior when session tracking fails

This resolves the 'Failed to navigate to layout' errors by ensuring cleanup
doesn't interfere with active browser sessions during analysis.
2025-07-19 00:08:39 +02:00
mindesbunister
74b0087f17 feat: implement on-demand cleanup triggered after analysis completion
- Replace time-based cleanup with on-demand cleanup in development mode
- Cleanup is triggered immediately after AI analysis completes
- Added runPostAnalysisCleanup() method to aggressive-cleanup service
- Cleanup triggers added to both single and batch analysis endpoints
- More efficient: cleanup happens only when needed, not on timer
- Prevents zombie processes without interfering with active analysis
- Production mode still uses periodic cleanup as backup (10 min intervals)
- Gentle cleanup in development: SIGTERM first, then SIGKILL if needed
2025-07-18 19:11:15 +02:00
mindesbunister
2bdf9e2b41 fix: implement proper multi-timeframe batch analysis
- Create /api/batch-analysis endpoint that collects ALL screenshots first
- Then sends all screenshots to AI for comprehensive analysis
- Fixes issue where individual timeframes were analyzed immediately
- Multi-timeframe analysis now provides cross-timeframe consensus
- Update AIAnalysisPanel to use batch analysis for multiple timeframes
- Maintains backward compatibility with single timeframe analysis
2025-07-18 18:32:08 +02:00
mindesbunister
6232c457ad feat: implement comprehensive process cleanup system
- Added aggressive cleanup system that runs every 5 minutes to kill orphaned processes
- Enhanced process cleanup with better signal handling and forced cleanup
- Added startup initialization system to ensure cleanup is properly loaded
- Integrated cleanup system into app layouts for automatic initialization
- Added zombie process cleanup and temp directory cleanup
- Improved Docker container restart behavior for proper process cleanup
- Resolves issue with zombie Chrome processes accumulating
2025-07-18 13:08:31 +02:00