Skip to content

Conversation

@plusplusoneplusplus
Copy link
Owner

Summary

This PR implements the complete Session Unification Plan documented in docs/session_unification_plan.md, consolidating three separate session concepts into a single, cohesive session management system.

Key Changes

Phase 1: Enhanced utils/session/ with data storage

  • Added data: Dict[str, Any] field to Session model for key-value storage
  • Implemented get(), set(), delete(), clear_data() methods
  • Updated FileSystemSessionStorage to persist data to data.json
  • Updated MemorySessionStorage to handle data field
  • Added 6 new tests for data storage functionality

Phase 2: Migrated utils/agent/ to SessionManager

  • Replaced in-memory _sessions dict with unified SessionManager
  • Added _create_storage() for automatic backend selection
  • Filesystem storage when session_storage_path is configured
  • Memory storage otherwise (backward compatible)
  • Updated all session history methods to use unified API
  • Fixed 2 test failures

Phase 3: Deleted automation session module

  • Removed plugins/automation/runtime_data/session.py (157 lines)
  • Updated runtime_data/__init__.py to remove session exports
  • Added migration note directing to utils.session

Benefits

Single unified session system across entire codebase
Agents now support persistent filesystem storage (previously memory-only)
Sessions support both conversation tracking AND data storage
Eliminated ~160 lines of duplicate code
Zero breaking changes - fully backward compatible

Testing

All tests passing:

  • Session tests: 60 pass (6 new data storage tests)
  • Agent tests: 98 pass (2 updated)
  • Automation tests: 89 pass (unchanged)
  • Total: 247 tests passing

Note: The 4 failing workflow engine tests are pre-existing (documented in the plan).

Implementation Timeline

Completed in ~1 hour (vs. estimated 1.5-2 weeks):

  • Phase 1: 30 minutes
  • Phase 2: 20 minutes
  • Phase 3: 10 minutes

Much faster due to:

  • Experimental automation plugin allowed direct deletion
  • Well-tested foundation (54 existing session tests)
  • Clean internal separation in agent implementation

Documentation

  • Full implementation plan: docs/session_unification_plan.md
  • Marked as completed with detailed summary
  • All commits follow conventional commit format

🤖 Generated with Claude Code

Co-Authored-By: Claude noreply@anthropic.com

plusplusoneplusplus and others added 4 commits November 8, 2025 22:02
Enhance utils/session/ with workflow data storage:
- Add `data` field to Session model for key-value storage
- Add get(), set(), delete(), clear_data() methods to Session
- Update FileSystemSessionStorage to persist data field to data.json
- Update MemorySessionStorage to handle data field
- Add comprehensive tests for data storage functionality
- Update serialization (to_dict/from_dict) to include data field

This is Phase 1 of the session unification plan, enabling the session
system to support both conversation tracking and workflow data storage.

All 60 session tests pass including 6 new data storage tests.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Replace in-memory agent sessions with unified SessionManager:
- Add SessionManager integration to SpecializedAgent
- Create _create_storage() method for storage backend selection
- Use FileSystemSessionStorage when session_storage_path is set
- Use MemorySessionStorage otherwise (backward compatible)
- Update _get_session_history() to convert ConversationMessage to dict
- Update _add_to_history() to use add_conversation_message()
- Update clear_session_history() to use SessionManager API
- Update get_session_history() to return same format as before
- Update set_session() to ensure session exists
- Fix test for _sessions attribute (now _session_manager)
- Fix test with invalid filesystem path to use temp directory

All 98 agent tests pass + 24 ExploreAgent tests pass.
Agents now support both memory and filesystem persistence!

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Remove plugins/automation/runtime_data/session.py:
- Delete SessionData, SessionStorage, get_storage() module
- Update runtime_data/__init__.py to remove session exports
- Add note directing users to utils.session.SessionManager
- No breaking changes: module was not yet in use

All 89 passing automation tests still pass.
4 pre-existing workflow engine test failures unchanged.

This completes the session unification migration. The codebase now
has a single unified session system in utils/session/ supporting:
- Conversation tracking (for agents and tools)
- Key-value data storage (for workflows)
- Metadata and statistics
- Multiple storage backends (memory, filesystem)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Mark plan as completed and add implementation summary:
- All 3 phases completed successfully in ~1 hour
- 247 tests passing (60 session + 98 agent + 89 automation)
- ~160 lines of duplicate code deleted
- Zero breaking changes
- New capabilities: persistent agent sessions, unified data storage

Phase 1 (30 min): Enhanced utils/session/ with data storage
Phase 2 (20 min): Migrated utils/agent/ to SessionManager
Phase 3 (10 min): Deleted automation session module

Key achievements:
✅ Single unified session system across entire codebase
✅ Agents support both memory and filesystem persistence
✅ Sessions support conversation tracking + data storage
✅ No backward compatibility issues

Much faster than estimated 1.5-2 weeks due to:
- Experimental automation plugin allowed direct deletion
- Well-tested foundation (54 existing session tests)
- Clean internal separation in agent implementation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@plusplusoneplusplus plusplusoneplusplus enabled auto-merge (squash) November 9, 2025 16:02
@plusplusoneplusplus plusplusoneplusplus merged commit 8e3ea0d into main Nov 9, 2025
16 checks passed
@plusplusoneplusplus plusplusoneplusplus deleted the feat/session-unification branch November 9, 2025 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants