Skip to content

Fix shared database issue between ApprovalService and AgentAlpha#84

Merged
johnkord merged 3 commits intomainfrom
copilot/fix-83
Jun 27, 2025
Merged

Fix shared database issue between ApprovalService and AgentAlpha#84
johnkord merged 3 commits intomainfrom
copilot/fix-83

Conversation

Copy link
Copy Markdown

Copilot AI commented Jun 27, 2025

Problem

The ApprovalService and AgentAlpha services were unable to share session data when deployed independently because each service created its own agent_sessions.db database in service-specific directories. This caused the ApprovalService's session management APIs to be unable to access sessions created by AgentAlpha.

Solution

Implemented a comprehensive shared database solution that allows both services to access the same session database:

Key Changes

  1. Shared Database Path Configuration

    • Updated SessionManager default path from ./app/data/agent_sessions.db to ./data/agent_sessions.db
    • Both services now use the AGENT_SESSION_DB_PATH environment variable for configuration
    • ApprovalService explicitly configures SessionManager with shared database path
  2. Container Infrastructure

    • Updated Dockerfiles to create shared /app/data directory with proper permissions
    • Modified Helm charts to use a shared persistent volume claim with ReadWriteMany access
    • Both services mount the same shared volume instead of separate volumes
  3. Environment Configuration

    AGENT_SESSION_DB_PATH=./data/agent_sessions.db  # Shared location

Deployment Examples

Docker Compose:

services:
  agent-alpha:
    environment:
      - AGENT_SESSION_DB_PATH=/app/data/agent_sessions.db
    volumes:
      - shared_data:/app/data
  
  approval-service:
    environment:
      - AGENT_SESSION_DB_PATH=/app/data/agent_sessions.db
    volumes:
      - shared_data:/app/data

volumes:
  shared_data:

Kubernetes:

  • Shared persistent volume claim allows multiple pods to access the same session database
  • Both services mount the shared volume at /app/data

Testing

  • Added SharedDatabaseTests to verify multiple SessionManager instances can access the same database
  • All existing tests continue to pass
  • Verification scripts confirm proper configuration

Documentation

  • Updated agent-session-management.md with database sharing architecture
  • Added deployment considerations and troubleshooting for shared database scenarios
  • Included container and Kubernetes deployment examples

This solution enables independent deployment of AgentAlpha and ApprovalService while maintaining shared access to session data, resolving the core issue where services couldn't see each other's session files.

Fixes #83.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI and others added 2 commits June 27, 2025 02:30
Co-authored-by: johnkord <16021727+johnkord@users.noreply.github.com>
Co-authored-by: johnkord <16021727+johnkord@users.noreply.github.com>
Copilot AI changed the title [WIP] Issue with Approval Service and agent_sessions.db Fix shared database issue between ApprovalService and AgentAlpha Jun 27, 2025
Copilot AI requested a review from johnkord June 27, 2025 02:34
@johnkord johnkord marked this pull request as ready for review June 27, 2025 02:37
@johnkord johnkord merged commit 4753a3a into main Jun 27, 2025
@johnkord johnkord deleted the copilot/fix-83 branch June 27, 2025 02:37
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.

Issue with Approval Service and agent_sessions.db

2 participants