Skip to content

Conversation

@YEEthanCC
Copy link
Owner

@YEEthanCC YEEthanCC commented Nov 20, 2025

Summary by CodeRabbit

  • Refactor
    • Query endpoint updated to use session-based history management instead of inline history passing
    • API response payload no longer includes conversation history

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Nov 20, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

The pull request migrates history management from client-side to server-side. The API endpoint now accepts a session_id instead of passing history with each request. Session history is stored and retrieved from Redis via new utility functions in the service and persistence layers.

Changes

Cohort / File(s) Summary
Session Management Layer
db/session.py
New module with Redis-backed session store. Adds get_session() and set_session() functions for storing and retrieving pickled session history keyed by session_id. Initializes module-level Redis client connected to localhost:6379.
Service Layer
services/repo_service.py
Updated query() function signature to accept session_id: str instead of history: list[Any]. Function now retrieves history via get_session(), passes it to rag_agent.run(), and persists updates via set_session(). Returns only response output.
Controller Layer
controllers/repo_controller.py
Updated GET /repo/query endpoint to accept session_id parameter instead of history. Changed internal service call and response payload to exclude history; now returns only {"response": response}.
Application Setup
main.py
Removed Redis client import and initialization lines. Session management is now delegated to db/session.py.

Sequence Diagram

sequenceDiagram
    participant Client
    participant Controller as API Controller
    participant Service as Repo Service
    participant Redis as Redis Session Store

    Note over Client,Redis: New Session-Based Flow
    Client->>Controller: GET /repo/query<br/>(question, repo_path, session_id)
    Controller->>Service: query(question, repo_path, session_id)
    Service->>Redis: get_session(session_id)
    Redis-->>Service: history (or [])
    Service->>Service: rag_agent.run(question,<br/>message_history=history)
    Service->>Redis: set_session(session_id, history)
    Redis-->>Service: ack
    Service-->>Controller: response
    Controller-->>Client: {"response": response}
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Signature changes across layers: Verify that session_id parameter is correctly threaded through controller → service → session store.
  • Session serialization: Confirm pickle serialization/deserialization is appropriate and handles edge cases (empty sessions, corrupt data).
  • Redis connectivity: Ensure hardcoded localhost:6379 connection is intentional or should be configurable; verify Redis availability assumptions.
  • History retrieval and persistence: Validate that get_session() returning empty list [] for missing keys doesn't cause unexpected behavior in rag_agent.run().

Poem

🐰 A rabbit hops through sessions now,

No history clutters each request's bow.

Redis stores our tales with care,

Server-side magic floats in the air! 🔴✨


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Free

📥 Commits

Reviewing files that changed from the base of the PR and between 539566d and 7f7ceef.

📒 Files selected for processing (4)
  • controllers/repo_controller.py (1 hunks)
  • db/session.py (1 hunks)
  • main.py (0 hunks)
  • services/repo_service.py (1 hunks)

Tip

📝 Customizable high-level summaries are now available in beta!

You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.

  • Provide your own instructions using the high_level_summary_instructions setting.
  • Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
  • Use high_level_summary_in_walkthrough to move the summary from the description to the walkthrough section.

Example instruction:

"Divide the high-level summary into five sections:

  1. 📝 Description — Summarize the main change in 50–60 words, explaining what was done.
  2. 📓 References — List relevant issues, discussions, documentation, or related PRs.
  3. 📦 Dependencies & Requirements — Mention any new/updated dependencies, environment variable changes, or configuration updates.
  4. 📊 Contributor Summary — Include a Markdown table showing contributions:
    | Contributor | Lines Added | Lines Removed | Files Changed |
  5. ✔️ Additional Notes — Add any extra reviewer context.
    Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."

Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.


Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

Comment @coderabbitai help to get the list of available commands and usage tips.

@YEEthanCC YEEthanCC merged commit ee3db55 into main Nov 20, 2025
0 of 2 checks passed
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