Skip to content

fix: ReActReasoning.__repr__ AttributeError and STLTMemory Mesa 4.x model.steps compatibility#199

Open
abhinavk0220 wants to merge 9 commits intomesa:mainfrom
abhinavk0220:fix/repr-and-steps-compat
Open

fix: ReActReasoning.__repr__ AttributeError and STLTMemory Mesa 4.x model.steps compatibility#199
abhinavk0220 wants to merge 9 commits intomesa:mainfrom
abhinavk0220:fix/repr-and-steps-compat

Conversation

@abhinavk0220
Copy link

@abhinavk0220 abhinavk0220 commented Mar 13, 2026

Fixes #205

Fixes #204

Summary

Two small but real bugs fixed in this PR:

  1. ReActReasoning.__repr__() crashes with AttributeError
  2. STLTMemory uses model.steps which does not exist in Mesa 4.x

Bug 1 — ReActReasoning.__repr__() AttributeError

ReActReasoning.__repr__() was referencing self.remaining_tool_calls
which does not exist on ReActReasoning. That attribute belongs to
ReWOOReasoning only. Calling repr() on any ReActReasoning instance
would crash with:

AttributeError: 'ReActReasoning' object has no attribute 'remaining_tool_calls'

Fix: Removed remaining_tool_calls from ReActReasoning.__repr__().
ReWOOReasoning.__repr__() correctly keeps it since that class does have
the attribute.


Bug 2 — STLTMemory uses model.steps (Mesa 4.x incompatibility)

st_lt_memory.py was using self.agent.model.steps to record the current
step when consolidating memory entries. model.steps does not exist in
Mesa 4.x — it was removed. This causes AttributeError during any
simulation run that triggers memory consolidation.

# Before — crashes in Mesa 4.x
step=self.agent.model.steps,

# After — correct Mesa 4.x API
step=int(getattr(self.agent.model, "_time", 0)),

The same fix was already applied to record_model.py — this brings
st_lt_memory.py in line with the same pattern.


Testing

All existing tests pass:

python -m pytest tests/ -q --ignore=tests/test_parallel_stepping.py
# 0 failures

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 13, 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: 5804e4d0-4dc9-4148-875f-4c7858402c75

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
📝 Coding Plan
  • Generate coding plan for human review comments

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant