Skip to content

The agent that grows with you

fix(serve): bound the backend lock read before the 64 KiB cap

kshitijk4poor279be90cf119
diff --git a/hermes_cli/dashboard_procs.py b/hermes_cli/dashboard_procs.py
index a3e14c99afa..fe08440178b 100644
--- a/hermes_cli/dashboard_procs.py
+++ b/hermes_cli/dashboard_procs.py
@@ -908,7 +908,8 @@ def read_valid_backend_lock(lock_path: Path) -> dict | None:
try: # validateOwnershipId(): exactly 32 lowercase hex chars
if not _is_hex(ownership_id, 32) or not lock_path.is_file():
return None
- data = lock_path.read_bytes()
+ with lock_path.open("rb") as f: # bounded: this runs on every owner-watchdog poll
+ data = f.read(65537)
if len(data) > 65536:
return None
parsed = json.loads(data)