Dream jobs don't create git commits if there were no changes

fixes #4872
This commit is contained in:
Aleksander W. Oleszkiewicz (Alek) 2026-07-10 11:13:34 +02:00 committed by Xubin Ren
parent 7675364eae
commit 0a1c98c142

View File

@ -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