fix: advance dream cursor when Dream is disabled to prevent prompt bloat (#4242)
When dream.enabled is false, the Dream cron job never runs, so the dream cursor (.dream_cursor) stays at its initial value (0). This causes read_recent_history_for_prompt() to treat every history entry as unprocessed, injecting the full chat history into every system prompt and growing without bound. Fix: fast-forward the dream cursor to the latest history entry at gateway startup when Dream is disabled.
This commit is contained in:
@@ -1165,6 +1165,7 @@ def _run_gateway(
|
||||
console.print(f"[green]✓[/green] Dream: {dream_cfg.describe_schedule()}")
|
||||
else:
|
||||
console.print("[yellow]○[/yellow] Dream: disabled")
|
||||
agent.context.memory.set_last_dream_cursor(agent.context.memory.get_latest_cursor())
|
||||
|
||||
# Register Heartbeat system job (idempotent on restart)
|
||||
if hb_cfg.enabled:
|
||||
|
||||
Reference in New Issue
Block a user