Merge PR #538: fix cron HERMES_HOME path mismatch, missing HomeAssistant toolset mapping, Daytona timeout drift
Authored by Himess. Three independent fixes: - cron/jobs.py: respect HERMES_HOME env var (consistent with scheduler.py) - gateway/run.py: add Platform.HOMEASSISTANT to toolset mappings - tools/environments/daytona.py: use time.monotonic() for timeout deadline
This commit is contained in:
commit
88f8bcde38
3 changed files with 6 additions and 4 deletions
|
|
@ -26,7 +26,7 @@ except ImportError:
|
||||||
# Configuration
|
# Configuration
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
|
|
||||||
HERMES_DIR = Path.home() / ".hermes"
|
HERMES_DIR = Path(os.getenv("HERMES_HOME", Path.home() / ".hermes"))
|
||||||
CRON_DIR = HERMES_DIR / "cron"
|
CRON_DIR = HERMES_DIR / "cron"
|
||||||
JOBS_FILE = CRON_DIR / "jobs.json"
|
JOBS_FILE = CRON_DIR / "jobs.json"
|
||||||
OUTPUT_DIR = CRON_DIR / "output"
|
OUTPUT_DIR = CRON_DIR / "output"
|
||||||
|
|
|
||||||
|
|
@ -2402,6 +2402,7 @@ class GatewayRunner:
|
||||||
Platform.DISCORD: "hermes-discord",
|
Platform.DISCORD: "hermes-discord",
|
||||||
Platform.WHATSAPP: "hermes-whatsapp",
|
Platform.WHATSAPP: "hermes-whatsapp",
|
||||||
Platform.SLACK: "hermes-slack",
|
Platform.SLACK: "hermes-slack",
|
||||||
|
Platform.HOMEASSISTANT: "hermes-homeassistant",
|
||||||
}
|
}
|
||||||
|
|
||||||
# Try to load platform_toolsets from config
|
# Try to load platform_toolsets from config
|
||||||
|
|
@ -2423,6 +2424,7 @@ class GatewayRunner:
|
||||||
Platform.DISCORD: "discord",
|
Platform.DISCORD: "discord",
|
||||||
Platform.WHATSAPP: "whatsapp",
|
Platform.WHATSAPP: "whatsapp",
|
||||||
Platform.SLACK: "slack",
|
Platform.SLACK: "slack",
|
||||||
|
Platform.HOMEASSISTANT: "homeassistant",
|
||||||
}.get(source.platform, "telegram")
|
}.get(source.platform, "telegram")
|
||||||
|
|
||||||
# Use config override if present (list of toolsets), otherwise hardcoded default
|
# Use config override if present (list of toolsets), otherwise hardcoded default
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ and resumed on next creation, preserving the filesystem across sessions.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
import time
|
||||||
import math
|
import math
|
||||||
import shlex
|
import shlex
|
||||||
import threading
|
import threading
|
||||||
|
|
@ -142,10 +143,9 @@ class DaytonaEnvironment(BaseEnvironment):
|
||||||
t = threading.Thread(target=_run, daemon=True)
|
t = threading.Thread(target=_run, daemon=True)
|
||||||
t.start()
|
t.start()
|
||||||
# Wait for timeout + generous buffer for network/SDK overhead
|
# Wait for timeout + generous buffer for network/SDK overhead
|
||||||
deadline = timeout + 10
|
deadline = time.monotonic() + timeout + 10
|
||||||
while t.is_alive():
|
while t.is_alive():
|
||||||
t.join(timeout=0.2)
|
t.join(timeout=0.2)
|
||||||
deadline -= 0.2
|
|
||||||
if is_interrupted():
|
if is_interrupted():
|
||||||
with self._lock:
|
with self._lock:
|
||||||
try:
|
try:
|
||||||
|
|
@ -156,7 +156,7 @@ class DaytonaEnvironment(BaseEnvironment):
|
||||||
"output": "[Command interrupted - Daytona sandbox stopped]",
|
"output": "[Command interrupted - Daytona sandbox stopped]",
|
||||||
"returncode": 130,
|
"returncode": 130,
|
||||||
}
|
}
|
||||||
if deadline <= 0:
|
if time.monotonic() > deadline:
|
||||||
# Shell timeout didn't fire and SDK is hung — force stop
|
# Shell timeout didn't fire and SDK is hung — force stop
|
||||||
with self._lock:
|
with self._lock:
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue