Diagnose and fix missing import errors in gateway/status.py, particularly 'acquire_scoped_lock' and other missing functions
Hermes Gateway fails to start with error:
ImportError: cannot import name 'acquire_scoped_lock' from 'gateway.status'
This typically happens when the gateway/status.py file has been replaced with a Windows-compatible version that lacks functions required by platform adapters (feishu.py, discord.py, telegram.py, etc.).
The Windows-compatible status.py contains only basic PID management functions but misses:
acquire_scoped_lock and release_scoped_lock - used by all platform adapters for token lockingwrite_runtime_status and read_runtime_status - used for gateway health trackingis_gateway_running - used by CLI toolsCreate a hybrid version that maintains Windows compatibility while restoring all required functions.
read_file /path/to/hermes-agent/gateway/status.py
Check what functions are present. The Windows version typically only has:
get_running_pid()write_pid_file()remove_pid_file()release_all_scoped_locks()read_file /path/to/hermes-agent/gateway/status.py.backup
The backup contains the original implementation with all required functions.
Search for all imports of gateway.status to understand the full scope:
search_files "from gateway.status import" /path/to/hermes-agent
This reveals all required functions.
The hybrid status.py should:
/proc filesystem and os.kill()/proc access gracefully on WindowsThe final status.py must include:
get_running_pid() - with platform-specific logicwrite_pid_file(pid)remove_pid_file()acquire_scoped_lock(scope, identity, metadata)release_scoped_lock(scope, identity)release_all_scoped_locks()write_runtime_status() - with gateway_state, platform, etc. parametersread_runtime_status()is_gateway_running()import sys
if sys.platform == "win32":
# Windows-specific logic