-
Notifications
You must be signed in to change notification settings - Fork 153
Description
🎯 Goal
Prevent an infinite loop occurring during conversation recording inside
memori/integrations/openai_integration.py.
📋 Description
In the openai_integration.py file, there is a code block that checks for messages where message.get("role") == "user".
However, this condition may incorrectly skip or reprocess internal messages since internal calls can also contain {role: "user"}.
As a result, the message recording logic can fall into a dead or infinite loop, continuously re-processing the same message.
🧠 Suggested Fix
Comment out or remove this part of the code:
#if message.get("role") == "user":
# continueand test whether conversation messages are still recorded correctly without looping infinitely. Alternatively, use a more precise condition to distinguish external user inputs from internal system calls, for example:
if message.get("role") == "user" and not message.get("internal"):
continue✅ Acceptance Criteria
- Infinite loop issue is resolved (tested with multiple conversation threads).
- Internal and external messages are handled properly.
- No regression in conversation recording.
- Unit test added for this behavior.
- Code follows existing linting and style rules.
🤝 Hacktoberfest Details
- Labels: hacktoberfest, bug, help wanted
- This issue is part of Hacktoberfest 2025 — valid pull requests will be merged or labeled hacktoberfest-accepted.
- Please review the CONTRIBUTING.md for contribution guidelines.
- Follow our Code of Conduct to maintain a positive and inclusive environment.
⭐ Don’t forget to star the repo on GitHub. It really helps our community grow