Vishal Doshi
e91a5b0216
fix: release stale session locks and add watchdog for hung API calls ( #18060 )
...
When a model API call hangs indefinitely (e.g. Anthropic quota exceeded
mid-call), the gateway acquires a session .jsonl.lock but the promise
never resolves, so the try/finally block never reaches release(). Since
the owning PID is the gateway itself, stale detection cannot help —
isPidAlive() always returns true.
This commit adds four layers of defense:
1. **In-process lock watchdog** (session-write-lock.ts)
- Track acquiredAt timestamp on each held lock
- 60-second interval timer checks all held locks
- Auto-releases any lock held longer than maxHoldMs (default 5 min)
- Catches the hung-API-call case that try/finally cannot
2. **Gateway startup cleanup** (server-startup.ts)
- On boot, scan all agent session directories for *.jsonl.lock files
- Remove locks with dead PIDs or older than staleMs (30 min)
- Log each cleaned lock for diagnostics
3. **openclaw doctor stale lock detection** (doctor-session-locks.ts)
- New health check scans for .jsonl.lock files
- Reports PID status and age of each lock found
- In --fix mode, removes stale locks automatically
4. **Transcript error entry on API failure** (attempt.ts)
- When promptError is set, write an error marker to the session
transcript before releasing the lock
- Preserves conversation history even on model API failures
Closes #18060
2026-02-16 23:59:22 +01:00
..
2026-02-16 23:58:23 +01:00
2026-02-16 14:59:31 +00:00
2026-02-16 23:58:23 +01:00
2026-02-15 19:08:47 +00:00
2026-02-14 15:39:45 +00:00
2026-02-14 15:39:45 +00:00
2026-02-01 10:03:47 +09:00
2026-02-02 21:31:17 -05:00
2026-02-13 15:32:38 +01:00
2026-02-13 15:32:38 +01:00
2026-02-16 18:31:37 +00:00
2026-02-15 16:15:53 +00:00
2026-02-16 14:59:31 +00:00
2026-02-16 00:03:21 +00:00
2026-02-15 23:22:58 +00:00
2026-02-07 20:02:32 -08:00
2026-02-16 23:53:35 +01:00
2026-02-16 23:53:35 +01:00
2026-02-15 16:55:28 -08:00
2026-02-15 16:55:28 -08:00
2026-02-14 15:45:41 +01:00
2026-02-16 14:59:31 +00:00
2026-01-24 13:52:31 +00:00
2026-02-15 03:41:11 +00:00
2026-02-13 19:52:45 +00:00
2026-02-16 23:54:23 +01:00
2026-02-01 10:03:47 +09:00
2026-02-12 07:55:26 -06:00
2026-02-16 03:50:39 +01:00
2026-02-16 03:50:39 +01:00
2026-02-16 03:50:39 +01:00
2026-01-31 16:19:20 +09:00
2026-02-16 14:59:31 +00:00
2026-02-16 03:50:39 +01:00
2026-01-20 13:04:19 +00:00
2026-02-14 13:27:45 +01:00
2026-02-16 14:59:31 +00:00
2026-02-15 18:06:48 +00:00
2026-02-16 03:50:39 +01:00
2026-02-01 10:03:47 +09:00
2026-02-16 14:59:31 +00:00
2026-02-16 14:59:31 +00:00
2026-02-14 13:46:09 +01:00
2026-02-16 14:59:31 +00:00
2026-02-13 19:14:54 +01:00
2026-02-15 04:40:04 +00:00
2026-02-13 19:14:54 +01:00
2026-02-15 13:24:37 +00:00
2026-02-15 13:24:37 +00:00
2026-02-01 10:03:47 +09:00
2026-02-09 00:21:54 -08:00
2026-02-14 12:32:17 +01:00
2026-02-15 16:15:53 +00:00
2026-02-14 19:22:37 +01:00
2026-02-14 13:27:45 +01:00
2026-02-14 18:53:23 +01:00
2026-02-01 10:03:47 +09:00
2026-01-20 07:37:01 +00:00
2026-02-16 14:59:31 +00:00
2026-02-15 19:08:47 +00:00
2026-02-15 23:34:52 +00:00
2026-02-15 19:08:47 +00:00
2026-01-20 07:37:01 +00:00
2026-02-03 16:00:57 -08:00
2026-02-15 16:15:53 +00:00
2026-02-15 06:40:04 +00:00
2026-02-08 23:59:43 -08:00
2026-02-15 13:39:59 +00:00
2026-01-31 16:19:20 +09:00
2026-02-16 23:53:35 +01:00
2026-02-15 15:44:14 +00:00
2026-02-14 17:50:49 -08:00
2026-02-01 10:03:47 +09:00
2026-02-16 16:42:28 +00:00
2026-02-16 23:58:38 +01:00
2026-01-30 03:16:21 +01:00
2026-01-30 03:16:21 +01:00
2026-01-31 16:19:20 +09:00
2026-02-14 01:46:12 +01:00
2026-02-14 01:46:12 +01:00
2026-01-20 10:51:25 +00:00
2026-02-14 17:50:49 -08:00
2026-02-16 23:58:23 +01:00
2026-02-16 23:58:23 +01:00
2026-01-31 16:19:20 +09:00
2026-01-14 09:11:21 +00:00
2026-01-19 10:08:29 +00:00
2026-02-14 18:32:45 -05:00
2026-02-15 18:02:55 +00:00
2026-01-31 16:19:20 +09:00
2026-01-30 03:16:21 +01:00
2026-02-01 10:03:47 +09:00
2026-02-14 00:38:18 +01:00
2026-02-16 00:18:26 +00:00
2026-02-15 10:53:45 -05:00
2026-02-14 12:32:17 +01:00
2026-02-14 12:32:17 +01:00
2026-02-15 13:39:59 +00:00
2026-01-31 16:19:20 +09:00
2026-01-03 19:37:09 +01:00
2026-02-01 10:03:47 +09:00
2026-02-16 10:35:26 -08:00
2026-02-16 10:35:26 -08:00
2026-02-16 23:59:22 +01:00
2026-01-14 15:02:19 +00:00
2026-01-31 16:19:20 +09:00
2026-01-31 16:19:20 +09:00
2026-02-13 15:32:38 +01:00
2026-02-16 17:57:45 +00:00
2026-02-16 14:59:31 +00:00
2026-02-14 23:51:41 +00:00
2026-02-16 14:59:31 +00:00
2026-02-16 14:59:31 +00:00
2026-02-15 21:41:18 +00:00
2026-02-16 23:56:05 +01:00
2026-02-16 14:59:31 +00:00
2026-02-13 17:32:14 +00:00
2026-02-16 08:24:55 -05:00
2026-02-16 02:36:00 -08:00
2026-02-16 14:59:31 +00:00
2026-02-15 23:56:57 +00:00
2026-02-15 22:19:08 +00:00
2026-02-15 23:02:27 +00:00
2026-02-16 23:53:35 +01:00
2026-02-15 23:07:50 +00:00
2026-02-15 23:34:02 +00:00
2026-02-16 14:59:31 +00:00
2026-02-16 14:59:31 +00:00
2026-02-15 23:02:27 +00:00
2026-02-16 14:59:31 +00:00
2026-02-16 03:47:10 +01:00
2026-02-16 14:59:31 +00:00
2026-02-16 14:59:31 +00:00
2026-02-16 14:59:31 +00:00
2026-01-14 15:02:19 +00:00
2026-02-16 14:59:31 +00:00
2026-02-16 14:59:31 +00:00
2026-02-14 13:44:51 -05:00
2026-02-14 12:21:44 +00:00
2026-02-12 23:52:19 -05:00
2026-02-14 22:03:45 -08:00
2026-02-14 22:03:45 -08:00
2026-02-13 20:42:24 +01:00
2026-02-16 14:59:31 +00:00
2026-02-05 16:34:48 -08:00
2026-01-31 16:19:20 +09:00
2026-02-15 23:18:16 +00:00
2026-01-14 01:17:56 +00:00
2026-02-16 14:59:31 +00:00
2026-02-16 14:59:31 +00:00
2026-02-16 14:59:31 +00:00
2026-02-16 14:59:31 +00:00
2026-02-14 18:46:24 +00:00
2026-02-15 16:52:14 +00:00
2026-01-17 20:37:36 +00:00
2026-02-16 14:59:31 +00:00
2025-12-18 13:27:52 +00:00