Fix RAG retrieving logic and application hang on 0 documents#69
Fix RAG retrieving logic and application hang on 0 documents#69
Conversation
- Update `l.embeddedDocs` calculation in `internal/rag/rag.go` to use `coll.Count()` instead of the number of newly loaded files so that it correctly accounts for already embedded documents. - Unconditionally pass `ai.WithDocs(ragContextDocs...)` in `internal/ai/agent/logic.go` when generating content, even if the document slice is empty. This prevents a blocking loop/hang in `genkit.Generate` when `SearchEnable` (server-side tools) is enabled but no context documents are explicitly provided to the generation options. Co-authored-by: Gerifield <195914+Gerifield@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
- Changed `os.Kill` to `syscall.SIGTERM` in `signal.Notify` and `signal.NotifyContext` calls across application entrypoints (`cmd/server-bot` and `cmd/client-telegram`). - `os.Kill` (SIGKILL) cannot be caught or intercepted by user-space programs, which resulted in the application terminating immediately upon receiving a stop signal without running its shutdown sequence (such as flushing the RAG database). Using `SIGTERM` resolves this and permits the shutdown routines to complete gracefully. Co-authored-by: Gerifield <195914+Gerifield@users.noreply.github.com>
Fixes the issue where the application would stop working (hang) if 0 RAG documents were retrieved. Also ensures that the internal counter tracking the number of embedded documents correctly reflects the entire Chromem database count rather than resetting to 0 if no new documents were parsed during startup.
PR created automatically by Jules for task 2904263248769327638 started by @Gerifield