BUG: Watcher stays stuck on first session, missing data when sessions rotate #1
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
The
watch_session()function enters an infinite loop and never returns to check for newer sessions. This causes the watcher to stay stuck on the first session file indefinitely.Impact
Root Cause
OpenClaw doesn't delete old session files, so
watch_session()only returns when file is deleted - which never happens.Solution
Added 1-second mtime polling to detect newer sessions. Validated 100% reliable.
Fix Version
v1.1 - Commit
70f5aecFIX IMPLEMENTED AND PUSHED ✅
Commit:
70f5aec- Fix: Add session rotation detection (v1.1)Detailed Fix Steps:
Root Cause
watch_session()entered infinite loop and never returned. OpenClaw does not delete old session files, so the function only exited when a file was deleted — which never happened.Solution
Added 1-second mtime polling inside
watch_session():last_session_check = time.time()when entering functionif time.time() - last_session_check > 1.0:get_current_session_file()to find newest sessionCode Change
Validation
Also includes SESSIONS_DIR env var fix and config.json dimension docs in commit
a053ec1.Closing as fixed in v1.1