Skip to content

refactor(engine): B5 — move compact_listings to a shared helper (kill the leak)

Maryam Ghorbani requested to merge main into production

memory_logic.py reached across a module boundary into workflow_engine's PRIVATE _compact_listings (a deferred local import to dodge a circular dep). Move the model-view-of-history formatter (the 7 regexes + _compact_block + the function) to a new leaf helper core/helpers/history_view.py as the public compact_listings, and import it from both the engine (_format_tail) and memory_logic. Behavior identical.

  • history_view.py: new module — no engine deps, so memory_logic's import moves to the top of the file (the circular-import workaround is gone too).
  • workflow_engine.py: drop the moved unit; import compact_listings.
  • memory_logic.py: import compact_listings at top; drop the private engine import.
  • STATE.md: mark the leak RESOLVED.

Verified: test_memory + test_greeting + test_turn_serialization + test_booking_flow (66) green.

Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com

Merge request reports

Loading