Fix Modal backend not working from CLI
Two config systems used different key names for the terminal backend: - hermes_cli/config.py, README, and all docs use "terminal.backend" - cli.py's env var mapping only recognized "terminal.env_type" Users following the docs who set `backend: modal` in ~/.hermes/config.yaml had it silently ignored -- TERMINAL_ENV always defaulted to "local". Additionally, when no config file existed, cli.py's hardcoded defaults overwrote any TERMINAL_ENV=modal set in .env, despite the comment saying "env vars take precedence." Fixes: - cli.py now normalizes "backend" -> "env_type" (backend takes precedence) - Defaults no longer overwrite .env when no config file terminal section exists - hermes status reads from config as fallback when env var isn't set Also fixes four related bugs found in the Modal/sandbox lifecycle: - file_tools cache not cleared on sandbox cleanup (stale ops on dead sandbox) - Global lock held during slow Modal teardown (blocked all tool calls 10-15s) - Race condition in file_tools between existence check and access (KeyError) - Per-task creation locks never cleaned up (memory leak)
This commit is contained in:
parent
8117d0adab
commit
2c7deb41f6
2 changed files with 31 additions and 4 deletions
|
|
@ -91,7 +91,16 @@ def show_status(args):
|
|||
print()
|
||||
print(color("◆ Terminal Backend", Colors.CYAN, Colors.BOLD))
|
||||
|
||||
terminal_env = os.getenv("TERMINAL_ENV", "local")
|
||||
terminal_env = os.getenv("TERMINAL_ENV", "")
|
||||
if not terminal_env:
|
||||
# Fall back to config file value when env var isn't set
|
||||
# (hermes status doesn't go through cli.py's config loading)
|
||||
try:
|
||||
from hermes_cli.config import load_config
|
||||
_cfg = load_config()
|
||||
terminal_env = _cfg.get("terminal", {}).get("backend", "local")
|
||||
except Exception:
|
||||
terminal_env = "local"
|
||||
print(f" Backend: {terminal_env}")
|
||||
|
||||
if terminal_env == "ssh":
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue