Skip to content

Session storage and retrieval store APIs(redis)#393

Merged
Thirunayan22 merged 59 commits intobuerokratt:wipfrom
rootcodelabs:llm-336
Apr 16, 2026
Merged

Session storage and retrieval store APIs(redis)#393
Thirunayan22 merged 59 commits intobuerokratt:wipfrom
rootcodelabs:llm-336

Conversation

@nuwangeek
Copy link
Copy Markdown
Collaborator

This pull request introduces a Redis-backed session store for managing multi-turn API tool workflows, including all necessary infrastructure, application logic, configuration, and documentation. The main changes add a robust, async CRUD interface for storing session state in Redis, integrate the store into the FastAPI app lifecycle, and provide clear usage documentation. Redis connectivity is now surfaced in the service health check, and all configuration is parameterized for flexible deployment.

Session Store Implementation and Integration

  • Added APIToolSessionStore and APIToolSession Pydantic model to enable async CRUD operations for agentic session state, with sliding TTL and partial updates. (src/utils/api_tool_session_store.py, src/models/session_models.py) [1] [2]
  • Integrated session store initialization and shutdown into the FastAPI app’s lifespan events, making the store available at app.state.session_store and handling Redis outages gracefully. (src/llm_orchestration_service_api.py) [1] [2] [3]
  • Health check endpoint now reports Redis session store connectivity status. (src/llm_orchestration_service_api.py)

Infrastructure and Configuration

  • Added Redis connection management utilities, including async client initialization, teardown, and health checking, with environment-variable-based configuration for host, port, password, and DB selection. (src/utils/redis_client.py, env.example) [1] [2]
  • Updated Docker Compose files to inject Redis connection settings as environment variables, ensure the LLM orchestration service depends on Redis, and expose configuration for the session DB. (docker-compose.yml, docker-compose-ec2.yml) [1] [2] [3] [4]

Documentation and Dependencies

  • Added a comprehensive usage guide for the Redis session store, including example CRUD patterns and schema reference. (docs/REDIS_SESSION_STORE.md)
  • Declared redis[hiredis] as an application dependency and updated lint configuration to allow dynamic field updates in the session store. (pyproject.toml) [1] [2]

nuwangeek and others added 30 commits February 20, 2026 16:06
Get update from wip into llm-316
get update from wip into llm-304
Service layer validation in tool classifier (buerokratt#321)
Pulling changes from BYK wip to LLM-Module WIP
Get update from wip into optimization/data-enrichment
Get update from optimization/data-enrichment into optimization/vector-indexer
nuwangeek and others added 23 commits March 9, 2026 10:00
Get update from llm-309 before getting context generation workflow changes
Get update from llm-310 into llm/service-integration
Context based response generation workflow (buerokratt#327)
Sync wip branches 3/18/2026
fixed the test production UI issue (buerokratt#366)
Sync wip branches 3/23/2026
Sync wip branches 4/7/2026
Parameter Extractor DSPy Module. (buerokratt#391)
@nuwangeek nuwangeek requested a review from Thirunayan22 April 16, 2026 08:09
Copy link
Copy Markdown
Collaborator

@Thirunayan22 Thirunayan22 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Overview

Verdict: Request Changes — 2 critical issues must be resolved before merge.

Issues by Severity

Critical

  • Hardcoded Redis password in docker-compose files (violates ADR SEC-001)
  • Race condition in update() — non-atomic read-modify-write

High

  • No TLS support despite existing TLS config vars in env.example
  • Silent None fallback with no consumer feedback mechanism
  • Global mutable state for Redis client singleton

Medium

  • update() accepts arbitrary **kwargs with no field validation
  • REDIS_SESSION_DB misplaced in env.example
  • No integration tests — all Redis interactions mocked
  • Dead code in documentation usage example

Low

  • close_redis_client() outside try/except in shutdown path
  • Legacy typing.Dict / typing.Optional imports (Python 3.12 project)

ADR Compliance

ADR Status Notes
SEC-001: Secrets Management VIOLATION Default password myredissecret hardcoded in compose files
ARCH-001: Modular Architecture PASS Clean module separation
VIS-003: Observability Contracts PARTIAL Health check present, no /metrics for session ops
DATA-001: Client Data Boundary NEEDS REVIEW Session data may contain user-provided params
NOOPS-004: Fault Tolerance PARTIAL Graceful degradation present, no retry/backoff
LOG-001: Structured Logging PARTIAL Loguru used, not JSON schema per ADR

Comment thread docker-compose.yml Outdated
Comment thread src/utils/api_tool_session_store.py Outdated
Comment thread src/utils/redis_client.py Outdated
Comment thread src/llm_orchestration_service_api.py
Comment thread src/utils/redis_client.py
Comment thread env.example
Comment thread tests/test_api_tool_session_store.py
Comment thread docs/REDIS_SESSION_STORE.md Outdated
Comment thread src/llm_orchestration_service_api.py Outdated
Comment thread src/models/session_models.py Outdated
@Thirunayan22 Thirunayan22 merged commit ea80c53 into buerokratt:wip Apr 16, 2026
5 of 9 checks passed
nuwangeek added a commit to rootcodelabs/LLM-Module that referenced this pull request Apr 16, 2026
Session storage and retrieval store APIs(redis) (buerokratt#393)
@nuwangeek nuwangeek linked an issue Apr 17, 2026 that may be closed by this pull request
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.

Implement session storage and retrieval store APIs (Redis)

2 participants