The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test: give bare profile-dir fixtures an identity marker (#113377 red-fix)
teknium10a62d4564e63
diff --git a/tests/gateway/test_multiplex_lifecycle.py b/tests/gateway/test_multiplex_lifecycle.pyindex 848a91e7e10..b340b0ff42d 100644--- a/tests/gateway/test_multiplex_lifecycle.py+++ b/tests/gateway/test_multiplex_lifecycle.py@@ -29,6 +29,7 @@ def test_cron_profile_homes_serve_every_live_profile(tmp_path, monkeypatch):monkeypatch.setenv("HERMES_HOME", str(default_home))for name in ("worker", "guest", "gone"):(default_home / "profiles" / name).mkdir(parents=True)+ (default_home / "profiles" / name / "config.yaml").write_text("{}\n") # identity markerfrom hermes_constants import mark_named_profile_deletedmark_named_profile_deleted(default_home / "profiles" / "gone")@@ -46,6 +47,7 @@ def test_cron_tick_homes_include_active_named_host(tmp_path, monkeypatch):default_home = tmp_path / ".hermes"for name in ("host", "worker"):(default_home / "profiles" / name).mkdir(parents=True)+ (default_home / "profiles" / name / "config.yaml").write_text("{}\n") # identity markermonkeypatch.setenv("HERMES_HOME", str(default_home / "profiles" / "host"))import gateway.run as gateway_rundiff --git a/tests/gateway/test_multiplex_session_db_profile_scope.py b/tests/gateway/test_multiplex_session_db_profile_scope.pyindex 34a2a189757..d1a812e9aac 100644--- a/tests/gateway/test_multiplex_session_db_profile_scope.py+++ b/tests/gateway/test_multiplex_session_db_profile_scope.py@@ -57,6 +57,7 @@ def multiplex_homes(tmp_path, monkeypatch):profile = root / "profiles" / "fitness"root.mkdir(parents=True)profile.mkdir(parents=True)+ (profile / "config.yaml").write_text("{}\n", encoding="utf-8") # identity marker: a bare dir is not a profilemonkeypatch.setenv("HERMES_HOME", str(root))# The suite-wide fixture in conftest re-points ``hermes_state.DEFAULT_DB_PATH``@@ -618,6 +619,9 @@ def test_profile_home_is_not_memoized_before_the_profile_exists(multiplex_homes)assert store._profile_home_for_key(key) is None(root / "profiles" / "latecomer").mkdir(parents=True)+ # A bare dir is still not a profile; the bridge publishes identity files (create_profile).+ assert store._profile_home_for_key(key) is None+ (root / "profiles" / "latecomer" / "config.yaml").write_text("{}\n", encoding="utf-8")assert store._profile_home_for_key(key) == root / "profiles" / "latecomer"@@ -642,6 +646,7 @@ def test_named_owner_without_a_home_never_falls_back_to_root(multiplex_homes):# Once the bridge provisions it, the same key owns a real store.home = root / "profiles" / "latecomer"home.mkdir(parents=True)+ (home / "config.yaml").write_text("{}\n", encoding="utf-8") # identity markerdb = store._db_for_key(key)assert db is not Nonedb.create_session("20260829_120000_abcdef01", "telegram")@@ -803,6 +808,7 @@ def test_profile_named_main_keeps_its_own_namespace_and_store(multiplex_homes):root, _profile = multiplex_homesmain_home = root / "profiles" / "main"main_home.mkdir(parents=True)+ (main_home / "config.yaml").write_text("{}\n", encoding="utf-8") # identity markerstore = _multiplex_store(root)source = SessionSource(platform=Platform.TELEGRAM, chat_id="555", user_id="u1", profile="main")diff --git a/tests/gateway/test_status_command.py b/tests/gateway/test_status_command.pyindex d22916b037f..98f615c473d 100644--- a/tests/gateway/test_status_command.py+++ b/tests/gateway/test_status_command.py@@ -604,6 +604,7 @@ async def test_profile_command_reports_source_stamped_profile(monkeypatch, tmp_phermes_home = tmp_path / ".hermes"profile_home = hermes_home / "profiles" / "milo"profile_home.mkdir(parents=True)+ (profile_home / "config.yaml").write_text("{}\n") # identity marker: a bare dir is not a profilesession_entry = SessionEntry(session_key=build_session_key(_make_source()),diff --git a/tests/hermes_cli/test_apply_profile_override.py b/tests/hermes_cli/test_apply_profile_override.pyindex 662fb4206d6..a981bda518b 100644--- a/tests/hermes_cli/test_apply_profile_override.py+++ b/tests/hermes_cli/test_apply_profile_override.py@@ -34,6 +34,7 @@ def _run_apply_profile_override(if active_profile and active_profile != "default":(hermes_root / "profiles" / active_profile).mkdir(parents=True, exist_ok=True)+ (hermes_root / "profiles" / active_profile / "config.yaml").write_text("{}\n") # identity markermonkeypatch.setattr(Path, "home", lambda: tmp_path)if hermes_home is not None:@@ -162,8 +163,9 @@ class TestSupervisedChildIgnoresStickyProfile:hermes_root = tmp_path / ".hermes"hermes_root.mkdir(parents=True, exist_ok=True)(hermes_root / "active_profile").write_text("briefer")- (hermes_root / "profiles" / "briefer").mkdir(parents=True, exist_ok=True)- (hermes_root / "profiles" / "coder").mkdir(parents=True, exist_ok=True)+ for name in ("briefer", "coder"):+ (hermes_root / "profiles" / name).mkdir(parents=True, exist_ok=True)+ (hermes_root / "profiles" / name / "config.yaml").write_text("{}\n") # identity markermonkeypatch.setattr(Path, "home", lambda: tmp_path)monkeypatch.delenv("HERMES_HOME", raising=False)diff --git a/tests/hermes_cli/test_dashboard_admin_endpoints.py b/tests/hermes_cli/test_dashboard_admin_endpoints.pyindex fe23b4a6a1d..88c32414872 100644--- a/tests/hermes_cli/test_dashboard_admin_endpoints.py+++ b/tests/hermes_cli/test_dashboard_admin_endpoints.py@@ -288,6 +288,7 @@ class TestPairingEndpoints:from hermes_constants import get_hermes_home(get_hermes_home() / "profiles" / "work").mkdir(parents=True, exist_ok=True)+ (get_hermes_home() / "profiles" / "work" / "config.yaml").write_text("{}\n") # identity markerPairingStore().generate_code("telegram", "global-1", "GlobalGuy")PairingStore(profile="work").generate_code("telegram", "work-1", "WorkGal")diff --git a/tests/hermes_cli/test_gateway_multiplex_served_record.py b/tests/hermes_cli/test_gateway_multiplex_served_record.pyindex e391227e6f7..a06cc960a3e 100644--- a/tests/hermes_cli/test_gateway_multiplex_served_record.py+++ b/tests/hermes_cli/test_gateway_multiplex_served_record.py@@ -22,8 +22,9 @@ import pytest@pytest.fixturedef served_root(tmp_path, monkeypatch):root = tmp_path / "hermes"- (root / "profiles" / "coder").mkdir(parents=True)- (root / "profiles" / "other").mkdir(parents=True)+ for name in ("coder", "other"):+ (root / "profiles" / name).mkdir(parents=True)+ (root / "profiles" / name / "config.yaml").write_text("{}\n") # identity marker(root / "config.yaml").write_text("model: {default: x}\n") # NO multiplex flag: env-only opt-in(root / "gateway.pid").write_text(json.dumps({"pid": os.getpid(), "hermes_home": str(root)}))(root / "gateway_state.json").write_text(json.dumps(diff --git a/tests/hermes_cli/test_kanban_per_profile_cap.py b/tests/hermes_cli/test_kanban_per_profile_cap.pyindex b1a73c7aced..2741f6b34c0 100644--- a/tests/hermes_cli/test_kanban_per_profile_cap.py+++ b/tests/hermes_cli/test_kanban_per_profile_cap.py@@ -20,6 +20,8 @@ def isolated_kanban_home_with_profiles(monkeypatch):test_home = tempfile.mkdtemp(prefix="kanban_per_profile_cap_test_")for prof in ("alpha", "beta", "default"):os.makedirs(os.path.join(test_home, "profiles", prof), exist_ok=True)+ with open(os.path.join(test_home, "profiles", prof, "config.yaml"), "w") as fh:+ fh.write("{}\n") # identity marker: a bare dir is not a profilemonkeypatch.setenv("HERMES_HOME", test_home)for mod in list(sys.modules.keys()):if mod.startswith("hermes_cli") or mod.startswith("hermes_state") or mod == "hermes_constants":diff --git a/tests/hermes_cli/test_kanban_review_surfaces.py b/tests/hermes_cli/test_kanban_review_surfaces.pyindex bf6f685b556..84e213256f7 100644--- a/tests/hermes_cli/test_kanban_review_surfaces.py+++ b/tests/hermes_cli/test_kanban_review_surfaces.py@@ -22,6 +22,7 @@ def review_worker(monkeypatch: pytest.MonkeyPatch, tmp_path: Path) -> str:monkeypatch.delenv("HERMES_DELEGATED_CHILD_CONTEXT", raising=False)# kanban_request_review now rejects reviewers that are not installed profiles (#106163).(home / "profiles" / "reviewer").mkdir(parents=True)+ (home / "profiles" / "reviewer" / "config.yaml").write_text("{}\n") # identity markerkb._INITIALIZED_PATHS.clear()kb.init_db()with kbc.connect() as conn:diff --git a/tests/hermes_cli/test_pooled_served_profile_backend_unscoped.py b/tests/hermes_cli/test_pooled_served_profile_backend_unscoped.pyindex 8fe8673cbee..69f2c2f30b8 100644--- a/tests/hermes_cli/test_pooled_served_profile_backend_unscoped.py+++ b/tests/hermes_cli/test_pooled_served_profile_backend_unscoped.py@@ -20,8 +20,9 @@ import pytestdef pooled_served_process(tmp_path, monkeypatch):"""Process whose HERMES_HOME is a served named profile; the default home records a live multiplexer."""root = tmp_path / "hermes"- (root / "profiles" / "alpha").mkdir(parents=True)- (root / "profiles" / "solo").mkdir(parents=True)+ for name in ("alpha", "solo"):+ (root / "profiles" / name).mkdir(parents=True)+ (root / "profiles" / name / "config.yaml").write_text("{}\n") # identity marker(root / "config.yaml").write_text("gateway: {multiplex_profiles: true}\n")(root / "gateway.pid").write_text(json.dumps({"pid": os.getpid(), "hermes_home": str(root)}))(root / "gateway_state.json").write_text(json.dumps({diff --git a/tests/hermes_cli/test_profiles.py b/tests/hermes_cli/test_profiles.pyindex 4cfa4e11b91..d8761fb284c 100644--- a/tests/hermes_cli/test_profiles.py+++ b/tests/hermes_cli/test_profiles.py@@ -1452,10 +1452,10 @@ class TestResolveProfileEnvSpelling:never fall back to the platform default."""root = tmp_path / "configured-root"- (root / "profiles" / "beta").mkdir(parents=True)- (root / "profiles" / "coder").mkdir(parents=True)custom = tmp_path / "custom-hermes"- (custom / "profiles" / "beta").mkdir(parents=True)+ for profile_dir in (root / "profiles" / "beta", root / "profiles" / "coder", custom / "profiles" / "beta"):+ profile_dir.mkdir(parents=True)+ (profile_dir / "config.yaml").write_text("{}\n") # identity marker: a bare dir does not resolvecases = [(root, "coder", root / "profiles" / "coder"),(root / "profiles" / "alpha", "beta", root / "profiles" / "beta"),diff --git a/tests/hermes_cli/test_web_oauth_dispatch.py b/tests/hermes_cli/test_web_oauth_dispatch.pyindex 806dd0959dc..097acb7e034 100644--- a/tests/hermes_cli/test_web_oauth_dispatch.py+++ b/tests/hermes_cli/test_web_oauth_dispatch.py@@ -43,6 +43,7 @@ def _make_profile_home(tmp_path, monkeypatch, profile="coder"):monkeypatch.setenv("HERMES_HOME", str(tmp_path))profile_home = tmp_path / "profiles" / profileprofile_home.mkdir(parents=True)+ (profile_home / "config.yaml").write_text("{}\n") # identity marker: a bare dir is not a profilereturn profile_home@@ -233,6 +234,7 @@ def test_oauth_session_cannot_be_polled_or_cancelled_from_another_profile(monkeypatch.setenv("HERMES_HOME", str(tmp_path))(tmp_path / "profiles" / "worker").mkdir(parents=True)+ (tmp_path / "profiles" / "worker" / "config.yaml").write_text("{}\n") # identity markersession_id, _session = _rt_oauth._new_oauth_session("xai-oauth", "device_code", profile="worker")diff --git a/tests/hermes_cli/test_web_profile_soul_writes.py b/tests/hermes_cli/test_web_profile_soul_writes.pyindex bbf8d64fda3..63b01586a68 100644--- a/tests/hermes_cli/test_web_profile_soul_writes.py+++ b/tests/hermes_cli/test_web_profile_soul_writes.py@@ -50,6 +50,8 @@ def profile_dir(tmp_path, monkeypatch) -> Path:d = profiles_mod.get_profile_dir("demo")d.mkdir(parents=True, exist_ok=True)+ # Identity marker (SOUL.md is one too, but these tests own SOUL.md; config.yaml is neutral).+ (d / "config.yaml").write_text("{}\n")return ddiff --git a/tests/hermes_cli/test_web_profiles_off_loop.py b/tests/hermes_cli/test_web_profiles_off_loop.pyindex 0b19e56b97f..383f0ee13ba 100644--- a/tests/hermes_cli/test_web_profiles_off_loop.py+++ b/tests/hermes_cli/test_web_profiles_off_loop.py@@ -49,6 +49,7 @@ def profile_dir(tmp_path, monkeypatch) -> Path:d = profiles_mod.get_profile_dir("demo")d.mkdir(parents=True, exist_ok=True)+ (d / "config.yaml").write_text("{}\n") # identity marker: a bare dir is not a profilereturn ddiff --git a/tests/hermes_cli/test_webhook_cli.py b/tests/hermes_cli/test_webhook_cli.pyindex 314e0dcaf62..0ac55bce7c9 100644--- a/tests/hermes_cli/test_webhook_cli.py+++ b/tests/hermes_cli/test_webhook_cli.py@@ -70,6 +70,7 @@ class TestSubscribe:def test_profile_binding_and_secret_survive_update(self, tmp_path, capsys):profile_dir = tmp_path / "profiles" / "compta"profile_dir.mkdir(parents=True)+ (profile_dir / "config.yaml").write_text("{}\n") # identity markerwebhook_command(_make_args(webhook_action="subscribe", name="notifier", route_profile="compta"diff --git a/tests/tools/test_kanban_tools.py b/tests/tools/test_kanban_tools.pyindex a7b64bd630e..43de32de092 100644--- a/tests/tools/test_kanban_tools.py+++ b/tests/tools/test_kanban_tools.py@@ -173,6 +173,7 @@ def test_request_review_rejects_unknown_reviewer_without_mutation(monkeypatch, wfrom tools import kanban_tools as kt(tmp_path / ".hermes" / "profiles" / "verifier").mkdir(parents=True)+ (tmp_path / ".hermes" / "profiles" / "verifier" / "config.yaml").write_text("{}\n") # identity markerwith kbc.connect() as conn:before = kb.get_task(conn, worker_env)before_events = kb.list_events(conn, worker_env)@@ -193,6 +194,7 @@ def test_request_review_accepts_installed_profile(monkeypatch, worker_env, tmp_pfrom tools import kanban_tools as kt(tmp_path / ".hermes" / "profiles" / "verifier").mkdir(parents=True)+ (tmp_path / ".hermes" / "profiles" / "verifier" / "config.yaml").write_text("{}\n") # identity markerwith kbc.connect() as conn:monkeypatch.setenv("HERMES_KANBAN_RUN_ID", str(kb.get_task(conn, worker_env).current_run_id))diff --git a/tests/tools/test_local_env_blocklist.py b/tests/tools/test_local_env_blocklist.pyindex c0787cb955c..3f6b062c515 100644--- a/tests/tools/test_local_env_blocklist.py+++ b/tests/tools/test_local_env_blocklist.py@@ -1116,6 +1116,7 @@ class TestPythonpathSelectiveStrip:physical_root = physical_home / "hermes-agent"physical_root.mkdir(parents=True)(physical_home / "profiles" / "coder").mkdir(parents=True)+ (physical_home / "profiles" / "coder" / "config.yaml").write_text("{}\n") # identity markerconfigured_home = tmp_path / "configured-home"try:_make_directory_link(configured_home, physical_home)diff --git a/tests/tui_gateway/test_groups_methods.py b/tests/tui_gateway/test_groups_methods.pyindex 54e66356093..f45a17be50e 100644--- a/tests/tui_gateway/test_groups_methods.py+++ b/tests/tui_gateway/test_groups_methods.py@@ -19,6 +19,7 @@ def home(tmp_path, monkeypatch):path = tmp_path / ".hermes"path.mkdir()(path / "profiles" / "ops").mkdir(parents=True)+ (path / "profiles" / "ops" / "config.yaml").write_text("{}\n") # identity marker: local rostermonkeypatch.setenv("HERMES_HOME", str(path))monkeypatch.setattr(srv, "_run_idempotency_store", DurableRunStore(), raising=False)methods_groups.stop_hosted_room_service(timeout=1.0)@@ -244,6 +245,7 @@ def test_multiplexed_invitation_uses_exact_profile_secret(home, monkeypatch):reviewer_home = home / "profiles" / "reviewer"reviewer_home.mkdir(parents=True)+ (reviewer_home / "config.yaml").write_text("{}\n") # identity markerreviewer_key = "reviewer-api-key-1234567890"default_key = "default-api-key-1234567890"(reviewer_home / ".env").write_text(@@ -287,6 +289,7 @@ def test_named_profile_needs_no_copied_api_key_for_roomlink(home, monkeypatch):reviewer_home = home / "profiles" / "reviewer"reviewer_home.mkdir(parents=True)+ (reviewer_home / "config.yaml").write_text("{}\n") # identity markergateway_key = "gateway-api-key-1234567890"monkeypatch.setenv("API_SERVER_KEY", gateway_key)diff --git a/tests/tui_gateway/test_groups_replication_methods.py b/tests/tui_gateway/test_groups_replication_methods.pyindex 642a0561fac..3947f18daf2 100644--- a/tests/tui_gateway/test_groups_replication_methods.py+++ b/tests/tui_gateway/test_groups_replication_methods.py@@ -16,6 +16,7 @@ def home(tmp_path, monkeypatch):path = tmp_path / ".hermes"path.mkdir()(path / "profiles" / "ops").mkdir(parents=True)+ (path / "profiles" / "ops" / "config.yaml").write_text("{}\n") # identity marker: local rostermonkeypatch.setenv("HERMES_HOME", str(path))methods_groups.stop_hosted_room_service(timeout=1.0)methods_groups.start_hosted_room_service()diff --git a/tests/tui_gateway/test_hosted_room_settled_retry.py b/tests/tui_gateway/test_hosted_room_settled_retry.pyindex ce79b34798f..f6c0e4a945b 100644--- a/tests/tui_gateway/test_hosted_room_settled_retry.py+++ b/tests/tui_gateway/test_hosted_room_settled_retry.py@@ -15,6 +15,7 @@ def test_settled_discussion_retry_publishes_once(tmp_path, monkeypatch, later_memonkeypatch.setenv("HERMES_HOME", str(tmp_path / ".hermes"))monkeypatch.setattr("pathlib.Path.home", lambda: tmp_path)(tmp_path / ".hermes" / "profiles" / "reviewer").mkdir(parents=True)+ (tmp_path / ".hermes" / "profiles" / "reviewer" / "config.yaml").write_text("{}\n") # identity markerserver = SimpleNamespace(_methods={}, _sessions={}, _sessions_lock=threading.Lock())service = HostedRoomService(server, db_path=tmp_path / ".hermes" / "state.db")service.create_room(room_id="room", name="Room", members=[