Skip to content

fix: ReWOOReasoning.aplan() calls sync add_to_memory instead of async aadd_to_memory#185

Open
BhoomiAgrawal12 wants to merge 2 commits intomesa:mainfrom
BhoomiAgrawal12:fix/rewoo-aplan-async-memory
Open

fix: ReWOOReasoning.aplan() calls sync add_to_memory instead of async aadd_to_memory#185
BhoomiAgrawal12 wants to merge 2 commits intomesa:mainfrom
BhoomiAgrawal12:fix/rewoo-aplan-async-memory

Conversation

@BhoomiAgrawal12
Copy link
Contributor

@BhoomiAgrawal12 BhoomiAgrawal12 commented Mar 11, 2026

Pre-PR Checklist

  • [T] This PR is a bug fix, not a new feature or enhancement.

Summary

ReWOOReasoning.aplan() was calling the synchronous add_to_memory() directly instead of await self.agent.memory.aadd_to_memory().

The Memory base class defines both:

  • add_to_memory() : sync, does in-memory dict manipulation
  • aadd_to_memory() : async, intended override point for subclasses

If a Memory subclass overrides aadd_to_memory to do genuinely async work (async database write or async event emit), calling the sync method silently bypasses that override entirely without any error.

All other reasoning classes (CoTReasoning, ReActReasoning) already use await aadd_to_memory() correctly in their async paths. ReWOO was the only one missing it.

Bug / Issue

Fixes #184

Implementation

mesa_llm/reasoning/rewoo.py: replaced self.agent.memory.add_to_memory(...) with
await self.agent.memory.aadd_to_memory(...) in aplan()
tests/test_reasoning/test_rewoo.py: added test_aplan_uses_async_memory_method regression test that asserts aadd_to_memory is awaited and add_to_memory is never called in the async path

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 11, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: faf3c49a-bbc2-4240-a2d5-438585de2346

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 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.

@souro26
Copy link

souro26 commented Mar 11, 2026

CI is failing here because the async version awaits for the memory method, but some tests still treat it like a normal function. The tests fail when the code tries to await it so they should be updated to treat that method as async.

@BhoomiAgrawal12 BhoomiAgrawal12 force-pushed the fix/rewoo-aplan-async-memory branch from 04a6efb to 071161b Compare March 11, 2026 22:25
@codecov
Copy link

codecov bot commented Mar 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.64%. Comparing base (27f0f50) to head (e1bc674).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #185   +/-   ##
=======================================
  Coverage   90.64%   90.64%           
=======================================
  Files          19       19           
  Lines        1540     1540           
=======================================
  Hits         1396     1396           
  Misses        144      144           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@BhoomiAgrawal12
Copy link
Contributor Author

CI is failing here because the async version awaits for the memory method, but some tests still treat it like a normal function. The tests fail when the code tries to await it so they should be updated to treat that method as async.

Thanks! I have updated them.

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.

ReWOOReasoning.aplan() calls sync add_to_memory instead of async aadd_to_memory

2 participants