fix(sessions): Re-enable session tracking with active_files support and multi-session safety - #9
Merged
Merged
Conversation
…nd multi-session safety Phase 1: Add active_files parameter to WorkSessionManager - Add active_files parameter to update_session_progress() method - Update parameter documentation with clear usage examples - Enable JSON-based file list storage in work_sessions table Phase 2: Re-enable PostToolUse session tracking - Remove DISABLED comments from WorkSessionManager calls - Re-activate active_files tracking for Write/Edit/MultiEdit tools - Re-activate active_tasks tracking for TodoWrite operations - Restore proper session progress updates via WorkSessionManager abstraction layer Phase 3: Add session ID-based idempotency to SessionStart - Implement idempotency check at start of initialize_session() - Check if session exists AND status='active' before cleanup - Early return with session resume if already initialized - Prevents duplicate session creation in multi-session scenarios - Multi-session safe: Uses session_id instead of PID for detection Phase 4: Fix session duration formatting - Add _format_duration() method to SessionSummaryGenerator - Handle short sessions (<1 minute) by showing seconds - Add duration_formatted field to SessionSummary dataclass - Update markdown template to use human-readable duration - Fixes "0 minutes" bug for sessions shorter than 60 seconds Impact: - ✅ Fixes empty session summaries (active_files now tracked) - ✅ Fixes wrong durations (now shows "45 seconds" instead of "0 minutes") - ✅ Prevents duplicate session creation (idempotent SessionStart) - ✅ Multi-session safe (concurrent Sonnet + GLM sessions supported) Context: Lost changes from previous session due to Edit tool failure All 4 files re-implemented from plan with proper testing 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Re-enables session tracking system that was disabled due to missing active_files parameter. Implements complete fix across 4 core files with multi-session safety improvements.
Changes
Phase 1: WorkSessionManager Enhancement
active_filesparameter toupdate_session_progress()methodPhase 2: PostToolUse Re-activation
Phase 3: SessionStart Idempotency
Phase 4: Duration Formatting Fix
_format_duration()method to SessionSummaryGeneratorduration_formattedfield to SessionSummary dataclassImpact
Fixes 3 Critical Bugs:
Multi-Session Safety:
Test Plan
Context
This PR restores functionality that was lost in a previous session due to Edit tool failure. All changes were re-implemented following the original plan with proper testing validation.
🤖 Generated with Claude Code