June 2, 2026

ACT-loop Refactor: Flat Path, Fixes, and Delegate Tools

This batch lands the comprehensive ACT-loop refactor (phases T6–T9, T13), replacing the old subclass-based MessageProcessor architecture with a single flat proc

This batch lands the comprehensive ACT-loop refactor (phases T6–T9, T13), replacing the old subclass-based MessageProcessor architecture with a single flat processor driven entirely by ProcessorConfig objects. Eight dead MP subclasses were deleted, all callers migrated to the flat process() path, and background/housekeeping channels wired via configs/channels.py. Universal compaction strategies (trail and history compaction) now run within the flat loop, and turn-0 seeding dispatches memory recall and attachment uploads as tool calls before iteration zero.

Several critical production bugs were fixed. AbilityRegistry.build_tools was a stub returning an empty list, causing all tools to be invisible to the model — resolved by porting canonical pre-refactor logic. Moments pin and forget features were broken because create_moment required an integer transcript_id the UI never held; the backend now resolves assistant turns by message text. Delegate synthesis cards rendered HTML literal characters instead of formatted text; fixed by routing through the same renderMarkupTo path as normal assistant bubbles. A circular import left dispatch aliases as None, crashing every turn; fixed with lazy self-healing rebinding. EAMP channel string and thinking gate were spec-incorrect on the flat path; corrected.

Delegate tools (web_search, research, summariser, web_browse) replace the removed subagent, each a standalone Ability that builds its own clean-context config and calls the normal message processor. An async delegate primitive supports non-blocking dispatch with active tracking and cancellation. Metrics were added at the send gateway.

The test suite saw extensive improvements: regression guards for single-flat-processor invariants, AC-3 collapse of per-field §9a tests into parametrized item-level tests, alignment of stale extraction-trigger tests to the user-only gate, and new integration tests for moments roundtrip. The suite remains green at ~1700 tests.

  • Fixed empty tool list bug: AbilityRegistry.build_tools now returns real tools, restoring find_tools, memory, web search, and all delegates.

  • Delivered four delegate tools (web_search, research, summariser, web_browse) replacing subagent, with async dispatch and clean contexts.

  • Completed ACT-loop refactor: 8 subclass files deleted, all channels migrated to flat MessageProcessor.process() with config-driven behavior.

  • Implemented universal trail and history compaction inside the flat process loop, with 90-before-80 ordering and recursion guard.

  • Resolved moments pin/forget: backend resolves assistant transcript rows by message text, enabling full round-trip persistence.

  • Strengthened test posture with regression guards, parametrized §9a tests, and integration tests for moments.