From 0a1c98c142af064d64e135dd410f283d398dc775 Mon Sep 17 00:00:00 2001 From: "Aleksander W. Oleszkiewicz (Alek)" Date: Fri, 10 Jul 2026 11:13:34 +0200 Subject: [PATCH] Dream jobs don't create git commits if there were no changes fixes #4872 --- nanobot/cli/commands.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/nanobot/cli/commands.py b/nanobot/cli/commands.py index 3013a8f9..25a230d6 100644 --- a/nanobot/cli/commands.py +++ b/nanobot/cli/commands.py @@ -1537,6 +1537,13 @@ def _run_gateway( if productive: store.set_last_dream_cursor(last_cursor) logger.info("Dream cron job completed, cursor advanced to {}", last_cursor) + if store.git.is_initialized(): + msg = build_dream_commit_message( + "dream: periodic memory consolidation", diff_body, + ) + sha = store.git.auto_commit(msg) + if sha: + logger.info("Dream commit: {}", sha) elif MemoryStore.dream_run_completed(resp): logger.info( "Dream cron job completed with no memory changes; " @@ -1557,13 +1564,6 @@ def _run_gateway( source="dream", timezone_name=config.agents.defaults.timezone, ) - if store.git.is_initialized(): - msg = build_dream_commit_message( - "dream: periodic memory consolidation", diff_body, - ) - sha = store.git.auto_commit(msg) - if sha: - logger.info("Dream commit: {}", sha) store.compact_history() prune_dream_sessions(agent.sessions.sessions_dir) return None