Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions api/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -3217,6 +3217,10 @@ def handle_get(handler, parsed) -> bool:
return bad(handler, "Session not found", 404)
return j(handler, report)

if parsed.path == "/api/session/recovery/audit":
from api.session_recovery import audit_session_recovery
return j(handler, audit_session_recovery(SESSION_DIR, state_db_path=_active_state_db_path()))

if parsed.path == "/api/session/status":
sid = parse_qs(parsed.query).get("session_id", [""])[0]
if not sid:
Expand Down Expand Up @@ -3770,6 +3774,11 @@ def handle_post(handler, parsed) -> bool:
diag.finish()
raise

if parsed.path == "/api/session/recovery/repair-safe":
from api.session_recovery import repair_safe_session_recovery
result = repair_safe_session_recovery(SESSION_DIR, state_db_path=_active_state_db_path())
return j(handler, result, status=200 if result.get("ok") else 409)

if parsed.path.startswith("/api/kanban/"):
from api.kanban_bridge import handle_kanban_post

Expand Down Expand Up @@ -4147,6 +4156,7 @@ def handle_post(handler, parsed) -> bool:
return bad(handler, "Invalid session_id", 400)
try:
p.unlink(missing_ok=True)
p.with_suffix('.json.bak').unlink(missing_ok=True)
except Exception:
logger.debug("Failed to unlink session file %s", p)
# Prune the per-session agent lock so deleted sessions don't leak
Expand Down
Loading
Loading