Skip to content

fix: Fixed all 4 bugs from issue #243: initialized tool_calls before#308

Closed
singlaamitesh wants to merge 1 commit into
The-OpenROAD-Project:masterfrom
singlaamitesh:fix/243-orassistant-243
Closed

fix: Fixed all 4 bugs from issue #243: initialized tool_calls before#308
singlaamitesh wants to merge 1 commit into
The-OpenROAD-Project:masterfrom
singlaamitesh:fix/243-orassistant-243

Conversation

@singlaamitesh

Copy link
Copy Markdown
Contributor

Fixes #243

Summary

Fixed all 4 bugs from issue #243: initialized tool_calls before the if/else and replaced in-place list.remove() with a filter comprehension to avoid UnboundLocalError and skip-while-iterating in retriever_rag.py; reassigned the discarded str.replace() result so tool descriptions are actually cleaned; moved the streaming yield inside the if msg: guard so None is never sent to clients; and bounded the in-memory chat_history dict with an OrderedDict + eviction helper capped by MAX_IN_MEMORY_CONVERSATIONS (default 1000) to prevent unbounded memory growth when USE_DB=false. Reproduced bug 1's crash with a minimal repro before fixing, and added regression tests for all four bugs.

Changes

  • backend/src/agents/retriever_rag.py
  • backend/src/api/routers/conversations.py
  • backend/tests/test_retriever_graph_simplified.py
  • backend/tests/test_api_conversations_streaming.py

How this was tested

Ran the affected tests locally.

Copilot AI review requested due to automatic review settings July 10, 2026 07:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@luarss

luarss commented Jul 12, 2026

Copy link
Copy Markdown
Collaborator

Thanks @singlaamitesh , salvaged in #311

@luarss luarss closed this Jul 12, 2026
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: UnboundLocalError crash in RAG fallback path + streaming endpoint yields None to clients

3 participants