Skip to content

fix: prevent ReWOO replay from mutating cached tool_calls#160

Open
Harsh-617 wants to merge 2 commits intomesa:mainfrom
Harsh-617:fix-rewoo-replay-mutation
Open

fix: prevent ReWOO replay from mutating cached tool_calls#160
Harsh-617 wants to merge 2 commits intomesa:mainfrom
Harsh-617:fix-rewoo-replay-mutation

Conversation

@Harsh-617
Copy link
Contributor

Fixes #159

Use copy.copy(self.current_plan) before mutating tool_calls in both plan()
and aplan() so the original plan is preserved across replay steps.

Previously, aliasing self.current_plan caused tool_calls to shrink after
the first replay step, resulting in A->A->A execution instead of A->B->C.

Adds regression tests for both sync and async replay paths.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 5, 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: 6c6b22ff-4d31-4830-9f2d-f44ffd2cf4cc

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.

@codecov
Copy link

codecov bot commented Mar 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.09%. Comparing base (4ea91ed) to head (e37c7ab).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #160   +/-   ##
=======================================
  Coverage   90.08%   90.09%           
=======================================
  Files          19       19           
  Lines        1503     1504    +1     
=======================================
+ Hits         1354     1355    +1     
  Misses        149      149           

☔ 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.

Copy link
Member

@colinfrisch colinfrisch left a comment

Choose a reason for hiding this comment

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

I like this and I think that we could merge it soon. I'm going to leave @sanika-n review it as she worked on ReWOO more than me. But don't hesitate if you have any questions

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 silently re-executes the first tool on all replay steps due to in-place mutation of self.current_plan.tool_calls

3 participants