Skip to content

The agent that grows with you

fix: read-only open waits its busy budget once, not per retry

teknium116fe260aab45
diff --git a/hermes_state.py b/hermes_state.py
index ef190d1909e..5d453c6731e 100644
--- a/hermes_state.py
+++ b/hermes_state.py
@@ -711,9 +711,9 @@ class SessionDB(
# SQLITE_IOERR to a mode=ro reader (it can't do the -shm recovery the read
# needs). Closes in milliseconds: retry a bounded number of times before
# classifying the store as failed (#100436; see _READ_ONLY_IOERR_RETRY_ATTEMPTS).
- # A DELETE-mode writer's commit outlasting the busy timeout is the same "busy,
- # not broken" class; each retry waits the busy timeout again.
- transient = is_sqlite_lock_error(ioerr) or _DISK_IO_ERROR_MARKER in str(ioerr).lower()
+ # A lock is NOT retried here: the connection already waited _READ_BUSY_TIMEOUT_S,
+ # and a retry would multiply that wait on blocking callers (TUI, `hermes status`).
+ transient = _DISK_IO_ERROR_MARKER in str(ioerr).lower()
if attempt >= _READ_ONLY_IOERR_RETRY_ATTEMPTS or not transient:
raise
time.sleep(_READ_ONLY_IOERR_RETRY_BACKOFF_S)
diff --git a/website/docs/developer-guide/session-storage.md b/website/docs/developer-guide/session-storage.md
index 7faf21d7671..62070cfe205 100644
--- a/website/docs/developer-guide/session-storage.md
+++ b/website/docs/developer-guide/session-storage.md
@@ -332,8 +332,8 @@ Lock contention is recognised by SQLite result code (`SQLITE_BUSY` /
text. In rollback-journal (`delete`) mode a lock lost inside FTS5's table
constructor arrives as `SQLITE_BUSY` with the text `vtable constructor failed:
messages_fts`; it is treated like `database is locked`. Opening a writable
-`SessionDB` waits up to `_WRITE_PATIENCE_S`; a read-only open retries the busy
-timeout a bounded number of times. If the lock outlasts that, the dashboard
+`SessionDB` waits up to `_WRITE_PATIENCE_S`; a read-only open waits its
+`_READ_BUSY_TIMEOUT_S` (5 s) read budget once. If the lock outlasts that, the dashboard
answers 503 (busy), not 500.