-
Notifications
You must be signed in to change notification settings - Fork 0
fix(engine): wire compaction_callback through auto-selection path in AgentEngine #577
Description
Problem
AgentEngine._resolve_loop() calls build_execution_loop() without passing compaction_callback. This means loops created via the auto-selection path (auto_loop_config) never get compaction wired in.
The static path (_make_default_loop()) does wire compaction correctly, but the dynamic auto-selection path does not.
Affected code
src/synthorg/engine/agent_engine.py lines ~1062-1066:
return build_execution_loop(
loop_type,
approval_gate=self._approval_gate,
stagnation_detector=self._stagnation_detector,
# Missing: compaction_callback=...
)Impact
Any agent using auto_loop_config (which routes COMPLEX/EPIC tasks to hybrid, MEDIUM to plan_execute) will run without context compaction, even if compaction is configured elsewhere. This could lead to context window exhaustion on long-running tasks -- exactly the tasks that auto-selection is designed for.
Fix
Wire compaction_callback through _resolve_loop() the same way approval_gate and stagnation_detector are wired. This requires:
- Adding a
compaction_callbackattribute toAgentEngine(or building it from config) - Passing it to
build_execution_loop()in_resolve_loop()
Discovered during #199 (Hybrid execution loop implementation).