Skip to content

Conversation

@dolliecoder
Copy link

@dolliecoder dolliecoder commented Feb 3, 2026

Fixes #208

README referenced CONTRIBUTING.md but the file was missing, causing a 404 error.
Added a basic contribution guide to help new contributors.

Summary by CodeRabbit

  • Documentation

    • Added contributor guidelines and setup instructions.
  • Chores

    • Improved error logging for debugging index creation failures.
    • Enhanced embedding service with asynchronous operation support for better performance.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 3, 2026

📝 Walkthrough

Walkthrough

This pull request addresses a broken documentation link by introducing a new CONTRIBUTING.md file with contributor guidelines and getting started instructions. It also improves error visibility in the graph API by adding explicit logging for index creation failures, and enhances the embedding service with asynchronous encoding support via thread wrapping.

Changes

Cohort / File(s) Summary
Documentation
CONTRIBUTING.md
New contributor guidelines file with setup and installation instructions.
Error Handling
backend/app/database/falkor/code-graph-backend/api/graph.py
Adds module-level logger and replaces silent exception handling with explicit logging for index creation failures.
Async Support
backend/app/services/embedding_service/service.py
Wraps synchronous model encoding calls in asyncio.to_thread via new private helper method, adding async support to embedding methods.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A guide for contributors, clear and bright,
Errors now logged, no more silent night,
Async threads spinning, smooth as can be,
Four-hundred-and-eight? No more, you'll see! 📝✨

🚥 Pre-merge checks | ✅ 1 | ❌ 4
❌ Failed checks (4 warnings)
Check name Status Explanation Resolution
Title check ⚠️ Warning The title 'Fix/add contributing guide' is partially related to the changeset. While the PR primarily addresses issue #208 by adding CONTRIBUTING.md, the changes also include unrelated updates to logging in graph.py and async encoding in embedding_service/service.py. Revise the title to reflect all significant changes, such as 'Add CONTRIBUTING.md, improve logging, and add async encoding support' or create separate PRs for distinct concerns.
Linked Issues check ⚠️ Warning The PR addresses issue #208 by adding the missing CONTRIBUTING.md file. However, the PR includes unrelated changes to logging and async encoding that are not mentioned in the linked issue requirements. Remove out-of-scope changes (logging and async encoding) from this PR, or clarify their connection to issue #208 and create separate PRs for distinct features.
Out of Scope Changes check ⚠️ Warning The PR contains significant out-of-scope changes: logging improvements in graph.py and async encoding support in embedding_service/service.py are unrelated to the stated objective of fixing the broken CONTRIBUTING.md link (issue #208). Isolate the CONTRIBUTING.md changes into a focused PR addressing issue #208, and move logging and async encoding changes to separate PRs with their own issue tracking.
Docstring Coverage ⚠️ Warning Docstring coverage is 57.14% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@dolliecoder dolliecoder closed this Feb 3, 2026
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@CONTRIBUTING.md`:
- Around line 15-16: The CONTRIBUTING.md file has an unclosed fenced code block
and truncated content; close the triple-backtick after the pip install line and
append standard contribution guidance sections (e.g., Creating a feature branch,
Running tests, Submitting pull requests, Code style guidelines) so the doc is
complete and self-contained; update the section around the pip install code
block (the fenced block beginning with ```bash and the pip install -r
requirements.txt line) and add short subsections covering branch workflow, test
command (e.g., pytest), PR submission steps, and a brief code style/conventions
note.
🧹 Nitpick comments (1)
backend/app/services/embedding_service/service.py (1)

40-52: Consider thread-safe lazy initialization for the model property.

Since _encode_sync now runs in a thread pool via asyncio.to_thread, concurrent calls to get_embedding/get_embeddings could race on the lazy model initialization if _model is still None. This could cause the model to be loaded multiple times.

While unlikely to cause correctness issues (just wasteful), you could add a lock for thread safety:

🔧 Optional: Add thread-safe initialization
+import threading
+
 class EmbeddingService:
     """Service for generating embeddings and profile summarization for Weaviate integration"""
 
     def __init__(self, model_name: str = MODEL_NAME, device: str = EMBEDDING_DEVICE):
         """Initialize the embedding service with specified model and LLM"""
         self.model_name = model_name
         self.device = device
         self._model = None
         self._llm = None
+        self._model_lock = threading.Lock()
         logger.info(f"Initializing EmbeddingService with model: {model_name} on device: {device}")
 
     `@property`
     def model(self) -> SentenceTransformer:
         """Lazy-load embedding model to avoid loading during import"""
         if self._model is None:
-            try:
-                logger.info(f"Loading embedding model: {self.model_name}")
-                self._model = SentenceTransformer(self.model_name, device=self.device)
-                logger.info(
-                    f"Model loaded successfully. Embedding dimension: {self._model.get_sentence_embedding_dimension()}")
-            except Exception as e:
-                logger.error(f"Error loading model {self.model_name}: {str(e)}")
-                raise
+            with self._model_lock:
+                if self._model is None:  # Double-check after acquiring lock
+                    try:
+                        logger.info(f"Loading embedding model: {self.model_name}")
+                        self._model = SentenceTransformer(self.model_name, device=self.device)
+                        logger.info(
+                            f"Model loaded successfully. Embedding dimension: {self._model.get_sentence_embedding_dimension()}")
+                    except Exception as e:
+                        logger.error(f"Error loading model {self.model_name}: {str(e)}")
+                        raise
         return self._model

Comment on lines +15 to +16
```bash
pip install -r requirements.txt
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Code block is not closed and content appears truncated.

The fenced code block starting at Line 15 is missing its closing ```. Additionally, the contribution guide ends abruptly after the install command—consider adding sections for:

  • Creating a feature branch
  • Running tests
  • Submitting pull requests
  • Code style guidelines
📝 Suggested completion
 ```bash
 pip install -r requirements.txt
+```
+
+---
+
+## 📋 Submitting Changes
+
+1. Create a new branch for your changes
+2. Make your changes and commit with clear messages
+3. Push your branch and open a pull request
+4. Ensure all checks pass before requesting review
+
+---
+
+## 🧪 Running Tests
+
+```bash
+pytest
+```
+
+---
+
+Thank you for contributing! 🎉
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
```bash
pip install -r requirements.txt
🤖 Prompt for AI Agents
In `@CONTRIBUTING.md` around lines 15 - 16, The CONTRIBUTING.md file has an
unclosed fenced code block and truncated content; close the triple-backtick
after the pip install line and append standard contribution guidance sections
(e.g., Creating a feature branch, Running tests, Submitting pull requests, Code
style guidelines) so the doc is complete and self-contained; update the section
around the pip install code block (the fenced block beginning with ```bash and
the pip install -r requirements.txt line) and add short subsections covering
branch workflow, test command (e.g., pytest), PR submission steps, and a brief
code style/conventions note.

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.

BUG: Broken link to CONTRIBUTING.md results in 404 error

1 participant