test(cli): lock disabled dream cursor advancement

This commit is contained in:
Xubin Ren
2026-06-25 22:53:10 +08:00
parent f7b027a295
commit 34f776b48b
2 changed files with 21 additions and 3 deletions
+7 -3
View File
@@ -154,6 +154,12 @@ def _install_gateway_shutdown_handlers(
return restore
def _advance_dream_cursor_if_behind(memory: Any) -> None:
latest = memory.get_latest_cursor()
if memory.get_last_dream_cursor() < latest:
memory.set_last_dream_cursor(latest)
class SafeFileHistory(FileHistory):
"""FileHistory subclass that sanitizes surrogate characters on write.
@@ -1165,9 +1171,7 @@ def _run_gateway(
console.print(f"[green]✓[/green] Dream: {dream_cfg.describe_schedule()}")
else:
console.print("[yellow]○[/yellow] Dream: disabled")
latest = agent.context.memory.get_latest_cursor()
if agent.context.memory.get_last_dream_cursor() < latest:
agent.context.memory.set_last_dream_cursor(latest)
_advance_dream_cursor_if_behind(agent.context.memory)
# Register Heartbeat system job (idempotent on restart)
if hb_cfg.enabled: