Feature: Configurable session store lock timeout

Resolved 💬 2 comments Opened Feb 10, 2026 by skjftp Closed Feb 10, 2026

Problem

When a process (cron job, long-running exec) is killed mid-write, the session store lock file at ~/.openclaw/agents/{agent}/sessions/sessions.json.lock becomes orphaned. Subsequent session operations fail with:

Error: timeout acquiring session store lock: /home/user/.openclaw/agents/main/sessions/sessions.json.lock

This happens frequently with:

  • Long-running cron jobs (60+ seconds) that timeout
  • Killed processes that don't release locks
  • Multiple concurrent sessions competing for locks

Current Behavior

Lock timeout appears to be hardcoded internally. Users have no way to configure:

  1. How long to wait for a lock
  2. When to consider a lock stale (for auto-cleanup)

Proposed Solution

Add configurable options, perhaps under session in the config:

{
  "session": {
    "lockTimeoutMs": 30000,
    "staleLockAgeMs": 60000,
    "autoCleanStaleLocks": true
  }
}
  • lockTimeoutMs: How long to wait before failing to acquire lock
  • staleLockAgeMs: Age after which a lock is considered stale/orphaned
  • autoCleanStaleLocks: Automatically remove locks older than staleLockAgeMs

Workaround

Manual cleanup: rm -f ~/.openclaw/agents/*/sessions/*.lock

Environment

  • OS: Linux (GCP VM)
  • OpenClaw version: 2026.2.6-3
  • Multiple cron jobs running every 10-30 minutes

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗