Repository navigation
fix(backend): fail-soft reliability for LLM routes, search, and KG stale docs - #9211
Conversation
There was a problem hiding this comment.
💡 Codex Review
omi/backend/utils/memory/canonical_kg_promotion.py
Lines 120 to 123 in 0e5828f
When a canonical memory is deleted or retracted after the caller loaded it but before this flag update, the new helpers return False for the missing Firestore doc, but this function ignores that and returns success=True. Callers such as backfill reconciliation derive failure from not kg_result.success, so a stale item can be counted as successfully reconciled after extract_knowledge_from_memory has already written KG citations for a memory row that no longer exists; use the boolean return (or check existence before extraction) to skip/report the stale case.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
1 issue found across 7 files
Confidence score: 4/5
- In
backend/utils/conversations/search.py,typesense.exceptions.ServiceUnavailableis missing from the exception-name allowlist, so a 503 from Typesense may bypass the intended handling path and surface as a user-facing search failure instead of graceful degradation; add this exception class to the allowlist and cover it with a 503-focused test before merging.
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Structured-output features (trends, chat_extraction, etc.) use .with_structured_output(), which rejects thinking_budget on Completions.parse(). Only set thinking_budget=0 for non-SO Gemini routes. Verification: TestGeminiThinkingBudget (6 passed) Closes #7898 Co-authored-by: Cursor <[email protected]>
Map transient Typesense timeouts to ConversationSearchUnavailableError and return HTTP 503 from the search endpoint instead of an unhandled 500. Verification: test_search_conversations_typesense_timeout_failsoft.py (2 passed) Closes #9188 Co-authored-by: Cursor <[email protected]>
Use update + NotFound guard for canonical memory KG flags (matching legacy memories path) and add regression tests for stale-memory races. Verification: test_process_conversation_kg_stale_memory.py, test_set_canonical_memory_kg_extracted_missing_doc_is_idempotent Closes #9137 Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
Stale-memory KG guard is covered by test_memories_stale_updates and test_set_canonical_memory_kg_extracted_missing_doc_is_idempotent. Co-authored-by: Cursor <[email protected]>
0e5828f to
97a9658
Compare
97a9658 to
c711b56
Compare
|
Monitor follow-up for the backend fail-soft reliability PR:
Verification passed:
|
kodjima33
left a comment
There was a problem hiding this comment.
Backend fail-soft reliability fix for conversation search/LLM routes/KG stale docs; CI green, has tests.
Closes #7898\nCloses #9188\nCloses #9137
Made with Cursor