Skip to content

The agent that grows with you

fix: stabilize Python e2e entrypoints and skill schema

ethernetaf23d047874b
diff --git a/tests/e2e/core/upgrade/_helpers.py b/tests/e2e/core/upgrade/_helpers.py
index c690cfde68c..2b15dd6b22e 100644
--- a/tests/e2e/core/upgrade/_helpers.py
+++ b/tests/e2e/core/upgrade/_helpers.py
@@ -101,6 +101,8 @@ def isolated_env(
env.update(
HOME=str(home),
HERMES_HOME=str(hermes_home),
+ # The pytest ancestor marks this child as guarded; its HOME is already the sandbox.
+ HERMES_STATE_DB_GUARD_BYPASS="1",
XDG_RUNTIME_DIR=str(root / "run"),
XDG_CONFIG_HOME=str(home / ".config"),
XDG_DATA_HOME=str(home / ".local" / "share"),
diff --git a/tests/e2e/core/upgrade/test_fresh_process_entrypoints.py b/tests/e2e/core/upgrade/test_fresh_process_entrypoints.py
index 2ef72d0782d..ef87e01ebe5 100644
--- a/tests/e2e/core/upgrade/test_fresh_process_entrypoints.py
+++ b/tests/e2e/core/upgrade/test_fresh_process_entrypoints.py
@@ -724,7 +724,8 @@ def test_entrypoint_in_a_fresh_process(case, tmp_path):
f"{case} called a service manager: {shim_log.read_text(encoding='utf-8')}")
if entry.prints_version:
from hermes_cli.version_info import get_version_info
- assert get_version_info().derived_version in cp.stdout, describe(cp)
+ commit = get_version_info().commit
+ assert commit and commit[:7] in cp.stdout, describe(cp)
db = hermes_home / "state.db"
if db.exists():
assert _db_rows(db, "PRAGMA integrity_check") == [("ok",)], f"{case} left a corrupt state.db"
@@ -779,8 +780,9 @@ def test_serve_announces_ready_and_stops_cleanly_on_sigterm(tmp_path):
record = json.loads(record_file.read_text(encoding="utf-8"))
assert record.get("port") == port, record
- # bwrap's own argv also carries these strings: match the interpreter's argv[1] exactly.
- reaper_proc = next(p for p in psutil.Process(proc.pid).children(recursive=True)
+ # With bwrap the reaper is a child; without it (CI) it is proc itself.
+ root = psutil.Process(proc.pid)
+ reaper_proc = next(p for p in [root, *root.children(recursive=True)]
if p.cmdline()[1:2] == [str(reaper)])
serve = next(p for p in reaper_proc.children() if p.cmdline()[1:3] == ["-m", "hermes_cli.main"])
descendants = [p.pid for p in serve.children(recursive=True)]
diff --git a/tests/tools/test_skill_create_dir.py b/tests/tools/test_skill_create_dir.py
index d26a1bbfc0a..305b50a05f3 100644
--- a/tests/tools/test_skill_create_dir.py
+++ b/tests/tools/test_skill_create_dir.py
@@ -96,6 +96,18 @@ class TestDisplaySkillCreateDir:
assert "opt-brain" in display_skill_create_dir()
+def test_tool_schema_stays_stable_when_skill_creation_home_changes(isolated_home, tmp_path):
+ from tools.skill_manager_tool import SKILL_MANAGE_SCHEMA
+ from tools.registry import registry
+
+ _write_config(isolated_home, f"skills:\n create_dir: {tmp_path / 'first-brain'}\n")
+ first = registry.get_definitions({"skill_manage"})[0]
+ _write_config(isolated_home, f"skills:\n create_dir: {tmp_path / 'second-brain'}\n")
+ second = registry.get_definitions({"skill_manage"})[0]
+ assert first == second
+ assert first["function"]["description"] == SKILL_MANAGE_SCHEMA["description"]
+
+
class TestDiscovery:
def test_create_dir_in_all_skills_dirs(self, isolated_home, tmp_path):
from agent.skill_utils import get_all_skills_dirs
diff --git a/tools/skill_manager_tool.py b/tools/skill_manager_tool.py
index ddecbd209a6..69b6f7849e3 100644
--- a/tools/skill_manager_tool.py
+++ b/tools/skill_manager_tool.py
@@ -20,7 +20,7 @@ from typing import Any, Dict, List, Optional, Tuple
import hermes_yaml as yaml
-from hermes_constants import get_hermes_home, display_hermes_home
+from hermes_constants import get_hermes_home
from utils import atomic_write_text, is_truthy_value
from hermes_cli.config import cfg_get
from agent.skill_utils import (
@@ -116,15 +116,6 @@ _FRONTMATTER_END_RE = re.compile(r'\n---\s*\n')
_NAME_RULE = "Use lowercase letters, numbers, hyphens, dots, and underscores."
-def _display_create_dir() -> str:
- """Skill-creation dir for schema/instruction text; follows ``skills.create_dir``."""
- try:
- from agent.skill_utils import display_skill_create_dir
- return display_skill_create_dir()
- except Exception:
- return f"{display_hermes_home()}/skills/"
-
-
# --- Validation helpers -------------------------------------------------------
def _check_identifier(value: str, label: str, invalid: str) -> Optional[str]:
@@ -813,13 +804,13 @@ def skill_manage(
# --- OpenAI Function-Calling Schema -------------------------------------------
-def _skill_manage_description(create_dir: str) -> str:
+def _skill_manage_description() -> str:
return (
"Create, update, or delete skills — your procedural memory for "
"recurring task types. The call is an operations array (a single "
"edit is a list of one); it applies atomically — any failure rolls "
"every touched skill back. Ops: create (full SKILL.md; lands in "
- f"{create_dir}; must precede that skill's other "
+ "the profile's skills directory or configured skills.create_dir; must precede that skill's other "
"ops), patch (targeted old_string/new_string fix — preferred; "
"content alone REPLACES the whole file, read it via skill_view() "
"first), write_file/remove_file (supporting files), delete (sole "
@@ -832,13 +823,6 @@ def _skill_manage_description(create_dir: str) -> str:
)
-def _skill_manage_schema_overrides() -> dict:
- """Rebuild the create-dir hint from the ACTIVE profile at every get_definitions(): the
- multiplexed gateway serves every profile from one process, so a path baked in at import
- would name the launch profile's skills dir for everyone else (#95685)."""
- return {"description": _skill_manage_description(_display_create_dir())}
-
-
_NAME = {"type": "string"}
_OLD_STRING = {"type": "string",
"description": "Text to find (same matching semantics as the patch tool)."}
@@ -865,7 +849,7 @@ SKILL_MANAGE_SCHEMA = {
# ONE advertised call shape (memory-tool pattern): the call IS an operations
# array. The legacy flat shape (top-level action/name/content/...) is still
# ACCEPTED for old transcripts and staged-write replay, but not advertised.
- "description": _skill_manage_description("the profile's skills.create_dir"),
+ "description": _skill_manage_description(),
"parameters": {
"type": "object",
"properties": {
@@ -926,8 +910,7 @@ from tools.registry import registry, tool_error
registry.register(
name="skill_manage", toolset="skills", schema=SKILL_MANAGE_SCHEMA, emoji="📝",
handler=lambda args, **kw: _skill_manage_from(
- args, task_id=kw.get("task_id"), session_id=kw.get("session_id")),
- dynamic_schema_overrides=_skill_manage_schema_overrides)
+ args, task_id=kw.get("task_id"), session_id=kw.get("session_id")))
# ---- BEGIN PLUGIN-COMPAT (revert-scheduled; see COMPAT_MANIFEST.md) ----