fix(agents): open agy, codex and hermes databases read-only (Issue #64)

This commit is contained in:
Godopu committed 2026-10-19 23:12:55 +09:00
1 parent 3ce5d5fdc1
commit b0eccc5301
8 files changed
+461 -56

No files matched your search

@@ -420,7 +420,7 @@ import yaml
from lib_py.verify_session import verify_session_uuid, workspace_key
from lib_py.agents.registry import get_adapter
from lib_py.agents.base import DiscoveryContext
from lib_py.agents.base import DiscoveryContext, _ro_connect
def _slug(path):
if not path:
@@ -862,7 +862,7 @@ for s in d.get('herdr_sessions', []):
valid_candidates = []
try:
conn = sqlite3.connect(hdb)
conn = _ro_connect(hdb)
rows = conn.execute(
"SELECT id FROM sessions WHERE cwd=? AND started_at >= ? ORDER BY started_at DESC LIMIT 20",
(cwd, epoch_threshold)
@@ -951,7 +951,6 @@ for s in d.get('herdr_sessions', []):
valid_candidates = []
try:
# read-only: nothing is created or removed beside the agent's db (Issue #60)
from lib_py.agents.adapters.opencode import _ro_connect
conn = _ro_connect(odb)
cursor = conn.cursor()
# opencode 2.x keeps sessions in session_v2 (a migrated 1.x `session`
@@ -1046,7 +1045,7 @@ for s in d.get('herdr_sessions', []):
rows = []
if state_db and os.path.exists(state_db):
try:
conn = sqlite3.connect(state_db)
conn = _ro_connect(state_db)
cols = [c[1] for c in conn.execute("PRAGMA table_info(threads)").fetchall()]
order_col = "updated_at" if "updated_at" in cols else ("created_at" if "created_at" in cols else None)
if order_col: