Add checkpoint debug logging to diagnose resume save failures

Writes SAVED/FAILED entries to ~/strix_checkpoint_debug.log on every
save attempt, bypassing the suppressed warning logger. This lets us
see if saves are happening during resumed sessions and what error (if
any) is causing them to fail silently.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Ahmex000 2026-03-19 13:59:38 +01:00
parent 9cba355b54
commit c1a464a9de

View file

@ -177,7 +177,18 @@ class CheckpointManager:
self._tmp_path.write_text(json_str, encoding="utf-8")
os.rename(self._tmp_path, self.checkpoint_path)
with open(Path.home() / "strix_checkpoint_debug.log", "a") as _dbg:
_dbg.write(f"SAVED iter={agent_state.iteration} path={self.checkpoint_path}\n")
except Exception as e: # noqa: BLE001
try:
with open(Path.home() / "strix_checkpoint_debug.log", "a") as _dbg:
_dbg.write(
f"FAILED iter={getattr(agent_state, 'iteration', '?')} "
f"path={self.checkpoint_path} err={e}\n"
)
except Exception:
pass
logger.warning("[Resume] Checkpoint save failed (non-fatal): %s", e)
def load(self) -> "CheckpointModel | None":