Compare commits
1 Commits
fix/499-ha
...
burn/379-1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7aeb84e3fc |
@@ -37,6 +37,7 @@ sys.path.insert(0, str(Path(__file__).parent.parent))
|
||||
from hermes_constants import get_hermes_home
|
||||
from hermes_cli.config import load_config
|
||||
from hermes_time import now as _hermes_now
|
||||
from agent.model_metadata import is_local_endpoint
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -777,6 +778,20 @@ def run_job(job: dict) -> tuple[bool, str, str, Optional[str]]:
|
||||
},
|
||||
)
|
||||
|
||||
# Build disabled toolsets — always exclude cronjob/messaging/clarify
|
||||
# for cron sessions. When the runtime endpoint is cloud (not local),
|
||||
# also disable terminal so the agent does not attempt SSH or shell
|
||||
# commands that require local infrastructure (keys, filesystem). #379
|
||||
_cron_disabled = ["cronjob", "messaging", "clarify"]
|
||||
_runtime_base_url = turn_route["runtime"].get("base_url", "")
|
||||
if not is_local_endpoint(_runtime_base_url):
|
||||
_cron_disabled.append("terminal")
|
||||
logger.info(
|
||||
"Job '%s': cloud provider detected (%s), disabling terminal toolset",
|
||||
job_name,
|
||||
turn_route["runtime"].get("provider", "unknown"),
|
||||
)
|
||||
|
||||
_agent_kwargs = _safe_agent_kwargs({
|
||||
"model": turn_route["model"],
|
||||
"api_key": turn_route["runtime"].get("api_key"),
|
||||
@@ -792,7 +807,7 @@ def run_job(job: dict) -> tuple[bool, str, str, Optional[str]]:
|
||||
"providers_ignored": pr.get("ignore"),
|
||||
"providers_order": pr.get("order"),
|
||||
"provider_sort": pr.get("sort"),
|
||||
"disabled_toolsets": ["cronjob", "messaging", "clarify"],
|
||||
"disabled_toolsets": _cron_disabled,
|
||||
"tool_choice": "required",
|
||||
"quiet_mode": True,
|
||||
"skip_memory": True, # Cron system prompts would corrupt user representations
|
||||
|
||||
@@ -69,7 +69,7 @@ class OwnedTwilioNumber:
|
||||
|
||||
|
||||
def _hermes_home() -> Path:
|
||||
return Path(os.environ.get("HERMES_HOME", str(Path.home() / ".hermes")))
|
||||
return Path(os.environ.get("HERMES_HOME", "~/.hermes")).expanduser()
|
||||
|
||||
|
||||
def _env_path() -> Path:
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
"""Tests for hardcoded path fixes in optional skills."""
|
||||
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def hermes_agent_root():
|
||||
return Path(__file__).parent.parent.parent
|
||||
|
||||
|
||||
class TestNoHardcodedPaths:
|
||||
def test_telephony_no_tilde_default(self, hermes_agent_root):
|
||||
"""telephony.py should not use ~/.hermes as a default path."""
|
||||
telephony = hermes_agent_root / "optional-skills/productivity/telephony/scripts/telephony.py"
|
||||
content = telephony.read_text()
|
||||
# The _hermes_home function should not use ~/
|
||||
lines = content.split("\n")
|
||||
for line in lines:
|
||||
if "_hermes_home" in line and "def " not in line:
|
||||
assert '"~/.hermes"' not in line, f"Hardcoded ~/.hermes found in telephony.py: {line.strip()}"
|
||||
|
||||
def test_memento_uses_path_home(self, hermes_agent_root):
|
||||
"""memento_cards.py should use Path.home() not hardcoded paths."""
|
||||
memento = hermes_agent_root / "optional-skills/productivity/memento-flashcards/scripts/memento_cards.py"
|
||||
content = memento.read_text()
|
||||
assert "Path.home()" in content, "memento_cards.py should use Path.home()"
|
||||
|
||||
def test_canvas_no_hardcoded_home(self, hermes_agent_root):
|
||||
"""canvas_api.py docstrings are OK, but code should not hardcode paths."""
|
||||
canvas = hermes_agent_root / "optional-skills/productivity/canvas/scripts/canvas_api.py"
|
||||
content = canvas.read_text()
|
||||
# Check that there's no code (non-docstring) using ~/.hermes as a path
|
||||
lines = content.split("\n")
|
||||
for line in lines:
|
||||
stripped = line.strip()
|
||||
if stripped.startswith("#") or stripped.startswith('"'):
|
||||
continue # comments and strings are OK
|
||||
if "~/.hermes" in stripped and ("Path(" in stripped or "os.path" in stripped):
|
||||
pytest.fail(f"Hardcoded ~/.hermes path in code: {stripped}")
|
||||
Reference in New Issue
Block a user