Skip to content

The agent that grows with you

Merge origin/main into chore/relay-0.9

Alex Fournierf5448560e954
diff --cc agent/relay_runtime.py
index ddc84689da3,c8c0724aff7..d659421ac0a
--- a/agent/relay_runtime.py
+++ b/agent/relay_runtime.py
@@@ -156,45 -159,6 +161,51 @@@ class _RelayPluginConfigurationLoadErro
"""An explicitly selected Relay plugin configuration could not be loaded."""
+def _activation_requires_managed_execution(activation: Any) -> bool:
+ """Return whether Relay activated any static or dynamic plugin behavior.
+
+ Relay owns the report contract. An unfamiliar report stays fail-safe by
+ retaining Hermes managed execution instead of silently bypassing plugins.
+ """
+
+ def keep_enabled() -> bool:
+ logger.warning(
+ "Hermes could not determine whether the Relay activation is empty; keeping managed execution enabled"
+ )
+ return True
+
+ try:
+ report = getattr(activation, "report", None)
+ except Exception:
+ return keep_enabled()
+ if not isinstance(report, dict):
+ return keep_enabled()
+ resolved = report.get("resolved_config")
+ dynamic_plugins = report.get("dynamic_plugins")
+ if not isinstance(resolved, dict) or not isinstance(dynamic_plugins, list):
+ return keep_enabled()
+ components = resolved.get("components")
+ if not isinstance(components, list):
+ return keep_enabled()
- if components:
- return True
++ for component in components:
++ if not isinstance(component, dict):
++ return keep_enabled()
++ enabled = component.get("enabled")
++ if not isinstance(enabled, bool):
++ return keep_enabled()
++ if enabled:
++ return True
+ for plugin in dynamic_plugins:
+ if not isinstance(plugin, dict) or "selected" not in plugin:
+ return keep_enabled()
+ selected = plugin["selected"]
+ if not isinstance(selected, bool):
+ return keep_enabled()
+ if selected:
+ return True
+ return False
+
+
@dataclass
class RelaySession:
"""One isolated Relay scope stack owned by a Hermes session."""
diff --cc hermes_cli/update_cmd_maint.py
index bd9ddbd62cf,c9970c5fa58..f618573f743
--- a/hermes_cli/update_cmd_maint.py
+++ b/hermes_cli/update_cmd_maint.py
@@@ -918,13 -953,14 +953,14 @@@ def _print_post_update_notices_and_self
('Curator first-run notice failed: %s', _print_curator_first_run_notice),
('Curator recent-run notice failed: %s', _print_curator_recent_run_notice),
('FHS PATH guard check failed: %s', _ensure_fhs_path_guard),
- ('hermes-acp launcher self-heal failed: %s', _ensure_acp_launcher),
+ ('CLI launcher exposure failed: %s', lambda: _launchers.expose_cli(_m().PROJECT_ROOT)),
('Windows bin launcher migration failed: %s', _migrate_windows_bin_path),
('cua-driver refresh failed: %s', _refresh_cua_driver_after_update),
+ ('Default PM tool install failed: %s', _install_default_tools_after_update),
('Checkpoint footprint notice failed: %s', _print_checkpoint_footprint_notice),
('Plugin compat notice failed: %s', _print_plugin_compat_notice),
- # Legacy HERMES_NEMO_RELAY_ATIF_*/ATOF_* vars produce no traces since the Relay cutover;
- # generate each profile's relay-plugins.toml instead of leaving exports silently dead.
+ # Relay ignores legacy HERMES_NEMO_RELAY_ATIF_*/ATOF_* vars; migrate each profile to
+ # relay-plugins.toml so those exporter settings remain effective.
('Relay exporter migration failed: %s', _migrate_relay_exporter_env),
):
with _best_effort(message):
diff --cc pyproject.toml
index 9053d0007a8,3380055aa40..e066df3cf92
--- a/pyproject.toml
+++ b/pyproject.toml
@@@ -174,8 -193,8 +193,8 @@@ dependencies =
# already works there and managed-mode perms depend on its exact lifecycle.
# Hence the ``sys_platform == 'win32'`` marker: the dep (and its portalocker
# / pywin32 tree) ships only where it's actually used.
- "concurrent-log-handler==0.9.29; sys_platform == 'win32'",
+ "concurrent-log-handler==0.9.29; sys_platform == 'win32' and python_version >= '3.14'",
- # First-party lifecycle and shared-metrics runtime. Relay 0.8 is the supported
+ # First-party lifecycle and shared-metrics runtime. Relay 0.9 is the supported
# native runtime and provider-codec baseline. Managed calls pass request and
# response data through this native module in-process; shared metrics installs
# no network exporter and consumes only its bounded projection. This marker
@@@ -189,8 -208,7 +208,7 @@@
# 738 CPython reports sys_platform == 'android' and never matched.) Pre-GKI
# devices can still slip through; they get the same resolution failure as
# before, worked around by installing with `--no-deps` or an older release.
- "nemo-relay>=0.9,<0.10; (sys_platform == 'darwin' and platform_machine == 'arm64') or (sys_platform == 'linux' and platform_machine == 'x86_64' and 'android' not in platform_release) or (sys_platform == 'linux' and platform_machine == 'aarch64' and 'android' not in platform_release) or (sys_platform == 'win32' and platform_machine == 'AMD64') or (sys_platform == 'win32' and platform_machine == 'ARM64')",
- ]
- "nemo-relay>=0.8.3,<0.9; ((sys_platform == 'darwin' and platform_machine == 'arm64') or (sys_platform == 'linux' and platform_machine == 'x86_64' and 'android' not in platform_release) or (sys_platform == 'linux' and platform_machine == 'aarch64' and 'android' not in platform_release) or (sys_platform == 'win32' and platform_machine == 'AMD64') or (sys_platform == 'win32' and platform_machine == 'ARM64')) and python_version >= '3.14'",]
++ "nemo-relay>=0.9,<0.10; ((sys_platform == 'darwin' and platform_machine == 'arm64') or (sys_platform == 'linux' and platform_machine == 'x86_64' and 'android' not in platform_release) or (sys_platform == 'linux' and platform_machine == 'aarch64' and 'android' not in platform_release) or (sys_platform == 'win32' and platform_machine == 'AMD64') or (sys_platform == 'win32' and platform_machine == 'ARM64')) and python_version >= '3.14'",]
[project.optional-dependencies]
# High-performance event loop — uvloop replaces the stdlib asyncio loop with
diff --cc tests/_fixtures/env_filter.py
index 00000000000,4bccbdad4f0..630c3adc124
mode 000000,100644..100644
--- a/tests/_fixtures/env_filter.py
+++ b/tests/_fixtures/env_filter.py
@@@ -1,0 -1,330 +1,331 @@@
+ """Env-var names the hermetic ``_hermetic_environment`` fixture blanks before every test.
+
+ Pure data, split out of ``tests/conftest.py`` to keep it under the file-size
+ gate; the fixture itself stays in conftest next to the sandbox it maintains.
+ """
+
+
+ # ── Credential env-var filter ──────────────────────────────────────────────
+ #
+ # Any env var in the current process matching ONE of these patterns is
+ # unset for every test. Developers' local keys cannot leak into assertions
+ # about "auto-detect provider when key present".
+
+ _CREDENTIAL_SUFFIXES = (
+ "_API_KEY",
+ "_TOKEN",
+ "_SECRET",
+ "_PASSWORD",
+ "_CREDENTIALS",
+ "_ACCESS_KEY",
+ "_SECRET_ACCESS_KEY",
+ "_PRIVATE_KEY",
+ "_OAUTH_TOKEN",
+ "_WEBHOOK_SECRET",
+ "_ENCRYPT_KEY",
+ "_APP_SECRET",
+ "_CLIENT_SECRET",
+ "_CORP_SECRET",
+ "_AES_KEY",
+ )
+
+ # Explicit names (for ones that don't fit the suffix pattern)
+ _CREDENTIAL_NAMES = frozenset({
+ "AWS_ACCESS_KEY_ID",
+ "AWS_SECRET_ACCESS_KEY",
+ "AWS_SESSION_TOKEN",
+ "ANTHROPIC_TOKEN",
+ "FAL_KEY",
+ "GH_TOKEN",
+ "GITHUB_TOKEN",
+ "OPENAI_API_KEY",
+ "OPENROUTER_API_KEY",
+ "NOUS_API_KEY",
+ "GEMINI_API_KEY",
+ "GOOGLE_API_KEY",
+ "GROQ_API_KEY",
+ "XAI_API_KEY",
+ "MISTRAL_API_KEY",
+ "DEEPSEEK_API_KEY",
+ "KIMI_API_KEY",
+ "MOONSHOT_API_KEY",
+ "GLM_API_KEY",
+ "ZAI_API_KEY",
+ "MINIMAX_API_KEY",
+ "OLLAMA_API_KEY",
+ "OPENVIKING_API_KEY",
+ "COPILOT_API_KEY",
+ "CLAUDE_CODE_OAUTH_TOKEN",
+ "BROWSERBASE_API_KEY",
+ "FIRECRAWL_API_KEY",
+ "PARALLEL_API_KEY",
+ "EXA_API_KEY",
+ "TAVILY_API_KEY",
+ "PERPLEXITY_API_KEY",
+ "WANDB_API_KEY",
+ "ELEVENLABS_API_KEY",
+ "HONCHO_API_KEY",
+ "MEM0_API_KEY",
+ "SUPERMEMORY_API_KEY",
+ "RETAINDB_API_KEY",
+ "HINDSIGHT_API_KEY",
+ "HINDSIGHT_LLM_API_KEY",
+ "DAYTONA_API_KEY",
+ "TWILIO_AUTH_TOKEN",
+ "TELEGRAM_BOT_TOKEN",
+ "DISCORD_BOT_TOKEN",
+ "SLACK_BOT_TOKEN",
+ "SLACK_APP_TOKEN",
+ "MATTERMOST_TOKEN",
+ "MATRIX_ACCESS_TOKEN",
+ "MATRIX_PASSWORD",
+ "MATRIX_RECOVERY_KEY",
+ "HASS_TOKEN",
+ "EMAIL_PASSWORD",
+ "BLUEBUBBLES_PASSWORD",
+ "FEISHU_APP_SECRET",
+ "FEISHU_ENCRYPT_KEY",
+ "FEISHU_VERIFICATION_TOKEN",
+ "DINGTALK_CLIENT_SECRET",
+ "QQ_CLIENT_SECRET",
+ "QQ_STT_API_KEY",
+ "WECOM_SECRET",
+ "WECOM_CALLBACK_CORP_SECRET",
+ "WECOM_CALLBACK_TOKEN",
+ "WECOM_CALLBACK_ENCODING_AES_KEY",
+ "WEIXIN_TOKEN",
+ "MODAL_TOKEN_ID",
+ "MODAL_TOKEN_SECRET",
+ "TERMINAL_SSH_KEY",
+ "SUDO_PASSWORD",
+ "GATEWAY_PROXY_KEY",
+ "API_SERVER_KEY",
+ "TOOL_GATEWAY_USER_TOKEN",
+ "TELEGRAM_WEBHOOK_SECRET",
+ "WEBHOOK_SECRET",
+ "AI_GATEWAY_API_KEY",
+ "VOICE_TOOLS_OPENAI_KEY",
+ "BROWSER_USE_API_KEY",
+ "CUSTOM_API_KEY",
+ "GATEWAY_PROXY_URL",
+ "GEMINI_BASE_URL",
+ "OPENAI_BASE_URL",
+ "OPENROUTER_BASE_URL",
+ "OLLAMA_BASE_URL",
+ "GROQ_BASE_URL",
+ "XAI_BASE_URL",
+ "AI_GATEWAY_BASE_URL",
+ "ANTHROPIC_BASE_URL",
+ })
+
+
+ def _looks_like_credential(name: str) -> bool:
+ """True if env var name matches a credential-shaped pattern."""
+ if name in _CREDENTIAL_NAMES:
+ return True
+ return any(name.endswith(suf) for suf in _CREDENTIAL_SUFFIXES)
+
+
+ # HERMES_* vars that change test behavior by being set. Unset all of these
+ # unconditionally — individual tests that need them set do so explicitly.
+ _HERMES_BEHAVIORAL_VARS = frozenset({
+ # Voice/TTS runtime flags. ``tui_gateway/server.py`` reads these straight
+ # off ``os.environ`` at call time (``_voice_mode_enabled`` /
+ # ``_voice_tts_enabled``) and, on every completed turn, hands the turn's
+ # final response text to ``hermes_cli.voice.speak_text`` — real synthesis,
+ # real playback, out of the developer's speakers. Blank them per-test so a
+ # leak (from the shell, or from an earlier test that drove the
+ # ``voice.toggle`` RPC, which writes ``os.environ`` directly) cannot carry
+ # into the next test. See ``_audio_playback_guard`` for the second layer.
+ "HERMES_VOICE",
+ "HERMES_VOICE_TTS",
+ "HERMES_YOLO_MODE",
+ # Injected into subprocess envs by the terminal tool (_make_run_env), so
+ # any test run launched FROM a Hermes agent session inherits them and
+ # hermes_constants home-resolution helpers prefer them over monkeypatched
+ # HOME (test_subprocess_home_isolation red locally, green on CI).
+ "HERMES_REAL_HOME",
+ "TERMINAL_HOME_MODE",
+ "HERMES_INTERACTIVE",
+ "HERMES_QUIET",
+ "HERMES_TOOL_PROGRESS",
+ "HERMES_TOOL_PROGRESS_MODE",
+ "HERMES_MAX_ITERATIONS",
+ "HERMES_SESSION_PLATFORM",
+ "HERMES_SESSION_CHAT_ID",
+ "HERMES_SESSION_CHAT_NAME",
+ "HERMES_SESSION_CHAT_TYPE",
+ "HERMES_SESSION_THREAD_ID",
+ "HERMES_SESSION_SOURCE",
+ "HERMES_SESSION_KEY",
+ "HERMES_GATEWAY_SESSION",
+ "HERMES_CRON_SESSION",
+ "_HERMES_GATEWAY",
+ "HERMES_PLATFORM",
+ "HERMES_MODEL",
+ "HERMES_INFERENCE_MODEL",
+ "HERMES_INFERENCE_PROVIDER",
+ "HERMES_TUI_PROVIDER",
+ "HERMES_MANAGED",
+ "HERMES_MANAGED_DIR",
+ # A Nix-wrapped `hermes` on the developer's host exports the store's read-only plugins
+ # tree; tests must discover the checkout's plugins/ (get_bundled_plugins_dir), not a
+ # different release's.
+ "HERMES_BUNDLED_PLUGINS",
+ "HERMES_DEV",
+ "HERMES_CONTAINER",
+ "HERMES_EPHEMERAL_SYSTEM_PROMPT",
+ "HERMES_TIMEZONE",
+ "HERMES_REDACT_SECRETS",
+ "HERMES_BACKGROUND_NOTIFICATIONS",
+ "HERMES_EXEC_ASK",
+ "HERMES_HOME_MODE",
+ "HERMES_AGENT_USE_LEGACY_SESSION_KEYS",
++ "HERMES_NEMO_RELAY_PLUGINS_TOML",
+ # Kanban path/board pins must never leak from a developer shell or
+ # dispatched worker into tests; otherwise tests can write fake tasks to
+ # the real ~/.hermes/kanban.db instead of the per-test HERMES_HOME.
+ "HERMES_KANBAN_DB",
+ "HERMES_KANBAN_BOARD",
+ "HERMES_KANBAN_HOME",
+ "HERMES_KANBAN_WORKSPACES_ROOT",
+ "HERMES_KANBAN_LOGS_ROOT",
+ "HERMES_KANBAN_TASK",
+ "HERMES_KANBAN_WORKSPACE",
+ "HERMES_KANBAN_RUN_ID",
+ "HERMES_KANBAN_CLAIM_LOCK",
+ "HERMES_KANBAN_DISPATCH_IN_GATEWAY",
+ # Pytest is routinely launched from a delegated worker. The worker
+ # lineage marker must not make parent-state tests run as delegated
+ # children; tests that exercise child behavior set it explicitly.
+ "HERMES_DELEGATED_CHILD_CONTEXT",
+ "HERMES_TENANT",
+ # Honcho host selection changes which nested config block wins. A local
+ # shell override leaked "myhost" into the full suite and flipped 20
+ # otherwise-unrelated config tests away from the default "hermes" host.
+ "HERMES_HONCHO_HOST",
+ # Dashboard OAuth auth gate (PR #30156). When set, the bundled
+ # dashboard-auth `nous` plugin auto-registers itself on plugin discovery,
+ # which is triggered by any `/api/status` call. That leaks a provider
+ # into the dashboard_auth registry across tests in the same worker and
+ # makes assertions like `auth_providers == []` flaky. CI never sets
+ # these, so production tests must not see them either.
+ "HERMES_DASHBOARD_OAUTH_CLIENT_ID",
+ "HERMES_DASHBOARD_PORTAL_URL",
+ "TERMINAL_CWD",
+ "TERMINAL_ENV",
+ "TERMINAL_VERCEL_RUNTIME",
+ "TERMINAL_CONTAINER_CPU",
+ "TERMINAL_CONTAINER_DISK",
+ "TERMINAL_CONTAINER_MEMORY",
+ "TERMINAL_CONTAINER_PERSISTENT",
+ "TERMINAL_DOCKER_PERSIST_ACROSS_PROCESSES",
+ "TERMINAL_DOCKER_ORPHAN_REAPER",
+ "TERMINAL_DOCKER_RUN_AS_HOST_USER",
+ "BROWSER_CDP_URL",
+ "CAMOFOX_URL",
+ # Platform allowlists — not credentials, but if set from any source
+ # (user shell, earlier leaky test, CI env), they change gateway auth
+ # behavior and flake button-authorization tests.
+ "TELEGRAM_ALLOWED_USERS",
+ "TELEGRAM_GROUP_ALLOWED_USERS",
+ "TELEGRAM_GROUP_ALLOWED_CHATS",
+ "QQ_ALLOWED_USERS",
+ "QQ_GROUP_ALLOWED_USERS",
+ "DISCORD_ALLOWED_USERS",
+ "WHATSAPP_ALLOWED_USERS",
+ "SLACK_ALLOWED_USERS",
+ "SIGNAL_ALLOWED_USERS",
+ "SIGNAL_GROUP_ALLOWED_USERS",
+ "EMAIL_ALLOWED_USERS",
+ "SMS_ALLOWED_USERS",
+ "MATTERMOST_ALLOWED_USERS",
+ "MATRIX_ALLOWED_USERS",
+ "DINGTALK_ALLOWED_USERS",
+ "FEISHU_ALLOWED_USERS",
+ "WECOM_ALLOWED_USERS",
+ "PHOTON_ALLOWED_USERS",
+ "GATEWAY_ALLOWED_USERS",
+ "GATEWAY_ALLOW_ALL_USERS",
+ "TELEGRAM_ALLOW_ALL_USERS",
+ "DISCORD_ALLOW_ALL_USERS",
+ "WHATSAPP_ALLOW_ALL_USERS",
+ "SLACK_ALLOW_ALL_USERS",
+ "SIGNAL_ALLOW_ALL_USERS",
+ "EMAIL_ALLOW_ALL_USERS",
+ "SMS_ALLOW_ALL_USERS",
+ "PHOTON_ALLOW_ALL_USERS",
+ # Gateway home channels are set by /sethome in real profiles. Tests that
+ # exercise dashboard notification toggles must opt in explicitly or they
+ # can accidentally subscribe against a developer's real home channel.
+ "TELEGRAM_HOME_CHANNEL",
+ "TELEGRAM_HOME_CHANNEL_THREAD_ID",
+ "TELEGRAM_HOME_CHANNEL_NAME",
+ "TELEGRAM_CRON_THREAD_ID",
+ "DISCORD_HOME_CHANNEL",
+ "DISCORD_HOME_CHANNEL_THREAD_ID",
+ "DISCORD_HOME_CHANNEL_NAME",
+ "SLACK_HOME_CHANNEL",
+ "SLACK_HOME_CHANNEL_THREAD_ID",
+ "SLACK_HOME_CHANNEL_NAME",
+ "WHATSAPP_HOME_CHANNEL",
+ "WHATSAPP_HOME_CHANNEL_THREAD_ID",
+ "WHATSAPP_HOME_CHANNEL_NAME",
+ "SIGNAL_HOME_CHANNEL",
+ "SIGNAL_HOME_CHANNEL_THREAD_ID",
+ "SIGNAL_HOME_CHANNEL_NAME",
+ "EMAIL_HOME_CHANNEL",
+ "EMAIL_HOME_CHANNEL_THREAD_ID",
+ "EMAIL_HOME_CHANNEL_NAME",
+ "SMS_HOME_CHANNEL",
+ "SMS_HOME_CHANNEL_THREAD_ID",
+ "SMS_HOME_CHANNEL_NAME",
+ "MATTERMOST_HOME_CHANNEL",
+ "MATTERMOST_HOME_CHANNEL_THREAD_ID",
+ "MATTERMOST_HOME_CHANNEL_NAME",
+ "MATRIX_HOME_CHANNEL",
+ "MATRIX_HOME_CHANNEL_THREAD_ID",
+ "MATRIX_HOME_CHANNEL_NAME",
+ "DINGTALK_HOME_CHANNEL",
+ "DINGTALK_HOME_CHANNEL_THREAD_ID",
+ "DINGTALK_HOME_CHANNEL_NAME",
+ "FEISHU_HOME_CHANNEL",
+ "FEISHU_HOME_CHANNEL_THREAD_ID",
+ "FEISHU_HOME_CHANNEL_NAME",
+ "WECOM_HOME_CHANNEL",
+ "WECOM_HOME_CHANNEL_THREAD_ID",
+ "WECOM_HOME_CHANNEL_NAME",
+ "PHOTON_HOME_CHANNEL",
+ "PHOTON_HOME_CHANNEL_THREAD_ID",
+ "PHOTON_HOME_CHANNEL_NAME",
+ # API server bind/auth settings are common in local gateway profiles and
+ # change adapter defaults plus load_gateway_config() enablement. Tests that
+ # need them set opt in explicitly with monkeypatch.
+ "API_SERVER_ENABLED",
+ "API_SERVER_HOST",
+ "API_SERVER_PORT",
+ "API_SERVER_KEY",
+ "API_SERVER_CORS_ORIGINS",
+ "API_SERVER_MODEL_NAME",
+ # Platform gating — set by load_gateway_config() as a side effect when
+ # a config.yaml is present, so individual test bodies that call the
+ # loader leak these values into later tests in the same process.
+ # Force-clear on every test setup so the leak can't happen.
+ "SLACK_REQUIRE_MENTION",
+ "SLACK_STRICT_MENTION",
+ "SLACK_THREAD_REQUIRE_MENTION",
+ "SLACK_IGNORE_OTHER_USER_MENTIONS",
+ "SLACK_REQUIRE_MENTION_CHANNELS",
+ "SLACK_FREE_RESPONSE_CHANNELS",
+ "SLACK_ALLOWED_CHANNELS",
+ "SLACK_IGNORED_CHANNELS",
+ "SLACK_DISABLE_DMS",
+ "SLACK_ALLOW_BOTS",
+ "SLACK_REACTIONS",
+ "DISCORD_REQUIRE_MENTION",
+ "DISCORD_FREE_RESPONSE_CHANNELS",
+ "TELEGRAM_REQUIRE_MENTION",
+ "WHATSAPP_REQUIRE_MENTION",
+ "DINGTALK_REQUIRE_MENTION",
+ "MATRIX_REQUIRE_MENTION",
+ })
diff --cc tests/agent/test_relay_runtime_plugins.py
index fa400a7c3e3,49fedeaf3be..ca4cf767253
--- a/tests/agent/test_relay_runtime_plugins.py
+++ b/tests/agent/test_relay_runtime_plugins.py
@@@ -179,34 -181,7 +179,50 @@@ def explicit_static_config(tmp_path, mo
return config
-def test_unset_config_disables_plugin_initialization(monkeypatch):
+ ("report", "expected"),
+ [
+ (EMPTY_ACTIVATION_REPORT, False),
+ (ACTIVE_ACTIVATION_REPORT, True),
++ (
++ {
++ **EMPTY_ACTIVATION_REPORT,
++ "resolved_config": {
++ "components": [{"kind": "observability", "enabled": False}],
++ },
++ },
++ False,
++ ),
++ (
++ {
++ **EMPTY_ACTIVATION_REPORT,
++ "resolved_config": {"components": [{"kind": "observability"}]},
++ },
++ True,
++ ),
+ (
+ {
+ **EMPTY_ACTIVATION_REPORT,
+ "dynamic_plugins": [{"id": "selected", "selected": True}],
+ },
+ True,
+ ),
+ (
+ {
+ **EMPTY_ACTIVATION_REPORT,
+ "dynamic_plugins": [{"id": "disabled", "selected": False}],
+ },
+ False,
+ ),
+ ({"config": {"diagnostics": []}}, True),
+ ],
+)
+def test_activation_report_controls_managed_execution(report, expected):
+ activation = SimpleNamespace(report=report)
+ assert relay_runtime._activation_requires_managed_execution(activation) is expected
+
+
+def test_unset_config_uses_relay_discovery(monkeypatch):
monkeypatch.delenv(relay_runtime.RELAY_PLUGINS_CONFIG_ENV, raising=False)
relay = _FakeRelay()
host = relay_runtime.RelayRuntime(relay=relay, profile_key="profile")
@@@ -1044,14 -1002,33 +1060,36 @@@ def test_real_binding_discovers_user_an
project_root = tmp_path / "project"
working_directory = project_root / "workspace"
config_directory = project_root / ".nemo-relay"
+ atof_dir = tmp_path / "atof"
working_directory.mkdir(parents=True)
config_directory.mkdir()
- (config_directory / "plugins.toml").write_text(
+ project_config = config_directory / "plugins.toml"
- project_config.write_text("", encoding="utf-8")
++ project_config.write_text(
+ f"""
+ version = 1
+
+ [[components]]
+ kind = "observability"
+ enabled = true
+
+ [components.config]
+ version = 3
+
+ [components.config.atof]
+ enabled = true
+
+ [[components.config.atof.sinks]]
+ type = "file"
+ output_directory = "{atof_dir.as_posix()}"
+ filename = "events.jsonl"
+ mode = "overwrite"
+ """.strip(),
+ encoding="utf-8",
+ )
xdg_config_home = tmp_path / "xdg"
- xdg_config_home.mkdir()
+ user_config = xdg_config_home / "nemo-relay" / "plugins.toml"
+ user_config.parent.mkdir(parents=True)
+ user_config.write_text("", encoding="utf-8")
monkeypatch.chdir(working_directory)
monkeypatch.setenv("XDG_CONFIG_HOME", str(xdg_config_home))
monkeypatch.delenv(relay_runtime.RELAY_PLUGINS_CONFIG_ENV, raising=False)
@@@ -1071,8 -1042,10 +1109,10 @@@
host.shutdown()
relay_runtime._reset_for_tests()
+ assert not (atof_dir / "events.jsonl").exists()
+
-def test_real_binding_ignores_project_config_with_explicit_opt_in(
+def test_real_binding_explicit_config_replaces_user_and_ignores_project(
tmp_path,
monkeypatch,
):
@@@ -1087,14 -1062,53 +1129,56 @@@
working_directory.mkdir(parents=True)
config_directory.mkdir()
selected_directory.mkdir()
- (config_directory / "plugins.toml").write_text(
+ project_config = config_directory / "plugins.toml"
- project_config.write_text("", encoding="utf-8")
++ project_config.write_text(
+ f"""
+ version = 1
+
+ [[components]]
+ kind = "observability"
+ enabled = true
+
+ [components.config]
+ version = 3
+
+ [components.config.atof]
+ enabled = true
+
+ [[components.config.atof.sinks]]
+ type = "file"
+ output_directory = "{project_atof_dir.as_posix()}"
+ filename = "events.jsonl"
+ mode = "overwrite"
+ """.strip(),
+ encoding="utf-8",
+ )
selected_config = selected_directory / "plugins.toml"
- selected_config.write_text("", encoding="utf-8")
+ selected_config.write_text(
+ f"""
+ version = 1
+
+ [[components]]
+ kind = "observability"
+ enabled = true
+
+ [components.config]
+ version = 4
+
+ [components.config.atof]
+ enabled = true
+
+ [[components.config.atof.sinks]]
+ type = "file"
+ output_directory = "{selected_atof_dir.as_posix()}"
+ filename = "events.jsonl"
+ mode = "overwrite"
+ """.strip(),
+ encoding="utf-8",
+ )
xdg_config_home = tmp_path / "xdg"
- xdg_config_home.mkdir()
+ user_config = xdg_config_home / "nemo-relay" / "plugins.toml"
+ user_config.parent.mkdir(parents=True)
+ user_config.write_text("", encoding="utf-8")
monkeypatch.chdir(working_directory)
monkeypatch.setenv("XDG_CONFIG_HOME", str(xdg_config_home))
monkeypatch.setenv(
@@@ -1104,16 -1118,9 +1188,17 @@@
host = relay_runtime.RelayRuntime(relay=relay, profile_key="profile")
try:
- assert not host.managed_execution_enabled()
+ assert host.managed_execution_enabled()
+ assert (
+ host._plugin_configuration_state
- is relay_runtime._RelayPluginConfigurationState.DISABLED
++ is relay_runtime._RelayPluginConfigurationState.ACTIVE
+ )
+ report = relay_runtime._PLUGIN_CONFIGURATION._activation.report
+ config_paths = set(report["config_paths"])
+ assert str(selected_config) in config_paths
+ assert str(user_config) not in config_paths
+ assert str(project_config) not in config_paths
+ host.ensure_session({"session_id": "native-explicit-plugins"})
finally:
host.shutdown()
relay_runtime._reset_for_tests()
diff --cc tests/conftest.py
index d5584eeb2f4,3006008d8eb..1e72d70ef66
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@@ -492,13 -245,12 +245,12 @@@ from tests._fixtures.platform_gating im
@pytest.fixture(autouse=True)
-def _hermetic_environment(tmp_path, monkeypatch):
+def _hermetic_environment(tmp_path, tmp_path_factory, monkeypatch):
"""Blank out all credential/behavioral env vars so local and CI match.
- Also redirects HERMES_HOME to a per-test tempdir so code that reads
- ``~/.hermes/*`` cannot touch the real one, selects an empty Relay user
- configuration, and pins TZ/LANG so datetime/locale-sensitive tests are
- deterministic.
+ Also redirects HOME and HERMES_HOME to per-test tempdirs so code that
+ reads ``~/.hermes/*`` can't touch the real one, and pins TZ/LANG so
+ datetime/locale-sensitive tests are deterministic.
"""
# 1. Blank every credential-shaped env var that's currently set.
for name in list(os.environ.keys()):
diff --cc uv.lock
index 9f6da015888,953221d85bd..1b449172a2f
--- a/uv.lock
+++ b/uv.lock
@@@ -2052,54 -2684,61 +2684,61 @@@ requires-dist =
{ name = "hermes-agent", extras = ["youtube"], marker = "extra == 'all'" },
{ name = "honcho-ai", marker = "extra == 'honcho'", specifier = "==2.2.0" },
{ name = "httplib2", marker = "extra == 'google'", specifier = "==0.32.0" },
- { name = "httplib2", marker = "extra == 'google-chat'", specifier = "==0.32.0" },
- { name = "httptools", specifier = ">=0.6.3,<0.9" },
- { name = "httpx", extras = ["socks"], specifier = "==0.28.1" },
+ { name = "httptools", marker = "python_full_version >= '3.14'", specifier = ">=0.6.3,<0.9" },
+ { name = "httpx", extras = ["socks"], marker = "python_full_version >= '3.14'", specifier = "==0.28.1" },
{ name = "httpx2", marker = "extra == 'computer-use'", specifier = "==2.7.0" },
- { name = "httpx2", marker = "extra == 'dev'", specifier = "==2.7.0" },
{ name = "httpx2", marker = "extra == 'mcp'", specifier = "==2.7.0" },
- { name = "jinja2", specifier = "==3.1.6" },
+ { name = "huggingface-hub", marker = "extra == 'trace-upload'", specifier = "==1.24.0" },
+ { name = "jinja2", marker = "python_full_version >= '3.14'", specifier = "==3.1.6" },
+ { name = "kittentts", marker = "(platform_machine != 'x86_64' and sys_platform == 'darwin' and extra == 'kittentts') or (platform_machine != 'ARM64' and sys_platform == 'win32' and extra == 'kittentts') or (sys_platform != 'darwin' and sys_platform != 'win32' and extra == 'kittentts')", url = "https://github.com/KittenML/KittenTTS/releases/download/0.8.1/kittentts-0.8.1-py3-none-any.whl" },
+ { name = "langfuse", marker = "extra == 'langfuse'", specifier = "==4.15.2" },
{ name = "lark-oapi", marker = "extra == 'feishu'", specifier = "==1.6.8" },
- { name = "markdown", specifier = "==3.10.2" },
- { name = "mautrix", extras = ["encryption"], marker = "extra == 'matrix'", specifier = "==0.21.1" },
+ { name = "markdown", marker = "python_full_version >= '3.14'", specifier = "==3.10.2" },
+ { name = "mautrix", extras = ["encryption"], marker = "sys_platform == 'linux' and extra == 'matrix'", specifier = "==0.21.1" },
{ name = "mcp", marker = "extra == 'computer-use'", specifier = "==2.0.0" },
- { name = "mcp", marker = "extra == 'dev'", specifier = "==2.0.0" },
{ name = "mcp", marker = "extra == 'mcp'", specifier = "==2.0.0" },
- { name = "mem0ai", marker = "extra == 'mem0'", specifier = "==2.0.10" },
+ { name = "mem0ai", marker = "(platform_machine != 'ARM64' and extra == 'mem0') or (sys_platform != 'win32' and extra == 'mem0')", specifier = "==2.0.10" },
{ name = "microsoft-teams-apps", marker = "extra == 'teams'", specifier = "==2.0.13.4" },
+ { name = "misaki", extras = ["en"], marker = "(platform_machine != 'x86_64' and sys_platform == 'darwin' and extra == 'kittentts') or (platform_machine != 'ARM64' and sys_platform == 'win32' and extra == 'kittentts') or (sys_platform != 'darwin' and sys_platform != 'win32' and extra == 'kittentts')", git = "https://github.com/NousResearch/misaki.git?rev=f03fd2be7346952a83d3d4845c217fc7667f322d" },
{ name = "mistralai", marker = "extra == 'mistral'", specifier = "==2.4.8" },
{ name = "modal", marker = "extra == 'modal'", specifier = "==1.3.4" },
- { name = "nemo-relay", marker = "(platform_machine == 'aarch64' and 'android' not in platform_release and sys_platform == 'linux') or (platform_machine == 'x86_64' and 'android' not in platform_release and sys_platform == 'linux') or (platform_machine == 'arm64' and sys_platform == 'darwin') or (platform_machine == 'AMD64' and sys_platform == 'win32') or (platform_machine == 'ARM64' and sys_platform == 'win32')", specifier = ">=0.9,<0.10" },
- { name = "nemo-relay", marker = "(python_full_version >= '3.14' and platform_machine == 'aarch64' and 'android' not in platform_release and sys_platform == 'linux') or (python_full_version >= '3.14' and platform_machine == 'x86_64' and 'android' not in platform_release and sys_platform == 'linux') or (python_full_version >= '3.14' and platform_machine == 'arm64' and sys_platform == 'darwin') or (python_full_version >= '3.14' and platform_machine == 'AMD64' and sys_platform == 'win32') or (python_full_version >= '3.14' and platform_machine == 'ARM64' and sys_platform == 'win32')", specifier = ">=0.8.3,<0.9" },
++ { name = "nemo-relay", marker = "(python_full_version >= '3.14' and platform_machine == 'aarch64' and 'android' not in platform_release and sys_platform == 'linux') or (python_full_version >= '3.14' and platform_machine == 'x86_64' and 'android' not in platform_release and sys_platform == 'linux') or (python_full_version >= '3.14' and platform_machine == 'arm64' and sys_platform == 'darwin') or (python_full_version >= '3.14' and platform_machine == 'AMD64' and sys_platform == 'win32') or (python_full_version >= '3.14' and platform_machine == 'ARM64' and sys_platform == 'win32')", specifier = ">=0.9,<0.10" },
+ { name = "neutts", extras = ["all"], marker = "python_full_version < '3.14' and extra == 'neutts'", specifier = "==1.4.1" },
+ { name = "numpy", marker = "extra == 'audio-io'", specifier = "==2.4.3" },
{ name = "numpy", marker = "extra == 'voice'", specifier = "==2.4.3" },
{ name = "numpy", marker = "extra == 'wake'", specifier = "==2.4.3" },
- { name = "onnxruntime", marker = "extra == 'wake'", specifier = "==1.27.0" },
- { name = "openai", specifier = "==2.24.0" },
+ { name = "openai", marker = "python_full_version >= '3.14'", specifier = "==2.24.0" },
{ name = "opentelemetry-exporter-otlp-proto-http", marker = "extra == 'otlp'", specifier = "==1.39.1" },
{ name = "opentelemetry-sdk", marker = "extra == 'otlp'", specifier = "==1.39.1" },
- { name = "openwakeword", marker = "extra == 'wake'", specifier = "==0.6.0" },
- { name = "packaging", specifier = "==26.0" },
+ { name = "packaging", marker = "python_full_version >= '3.14'", specifier = "==26.0" },
{ name = "parallel-web", marker = "extra == 'parallel-web'", specifier = "==0.4.2" },
- { name = "pathspec", specifier = "==1.1.1" },
- { name = "pillow", specifier = "==12.3.0" },
- { name = "pillow-heif", specifier = ">=1.4.0,<2" },
- { name = "prompt-toolkit", specifier = "==3.0.52" },
- { name = "psutil", specifier = "==7.2.2" },
- { name = "ptyprocess", marker = "sys_platform != 'win32'", specifier = ">=0.7.0,<1" },
+ { name = "pathspec", marker = "python_full_version >= '3.14'", specifier = "==1.1.1" },
+ { name = "pilk", marker = "extra == 'silk'", specifier = "==0.2.4" },
+ { name = "pillow", marker = "python_full_version >= '3.14'", specifier = "==12.3.0" },
+ { name = "pillow-heif", marker = "python_full_version >= '3.14'", specifier = ">=1.4.0,<2" },
+ { name = "piper-tts", marker = "(platform_machine != 'x86_64' and sys_platform == 'darwin' and extra == 'piper') or (platform_machine != 'ARM64' and sys_platform == 'win32' and extra == 'piper') or (sys_platform != 'darwin' and sys_platform != 'win32' and extra == 'piper')", specifier = "==1.8.0" },
+ { name = "playwright", marker = "extra == 'google-meet'", specifier = "==1.62.0" },
+ { name = "prompt-toolkit", marker = "python_full_version >= '3.14'", specifier = "==3.0.52" },
+ { name = "psutil", marker = "python_full_version >= '3.14' and sys_platform == 'android'", git = "https://github.com/giampaolo/psutil.git?rev=380bd2b59c67b0e1b04bbf3a90b11744f4f96644" },
+ { name = "psutil", marker = "python_full_version >= '3.14' and sys_platform != 'android'", specifier = "==7.2.2" },
+ { name = "ptyprocess", marker = "python_full_version >= '3.14' and sys_platform != 'win32'", specifier = ">=0.7.0,<1" },
{ name = "pvporcupine", marker = "extra == 'wake'", specifier = "==4.0.3" },
+ { name = "pvporcupine", marker = "extra == 'wake-porcupine'", specifier = "==4.0.3" },
{ name = "pyasn1", marker = "extra == 'google'", specifier = "==0.6.4" },
- { name = "pyasn1", marker = "extra == 'google-chat'", specifier = "==0.6.4" },
- { name = "pydantic", specifier = "==2.13.4" },
- { name = "pyjwt", extras = ["crypto"], specifier = "==2.13.0" },
- { name = "pytest", marker = "extra == 'dev'", specifier = "==9.1.1" },
- { name = "pytest-asyncio", marker = "extra == 'dev'", specifier = "==1.3.0" },
- { name = "python-dotenv", specifier = "==1.2.2" },
- { name = "python-multipart", specifier = ">=0.0.9,<1" },
+ { name = "pydantic", marker = "python_full_version >= '3.14'", specifier = "==2.13.4" },
+ { name = "pyjwt", extras = ["crypto"], marker = "python_full_version >= '3.14'", specifier = "==2.13.0" },
+ { name = "pyopen-wakeword", marker = "(platform_machine != 'x86_64' and sys_platform == 'darwin' and extra == 'wake') or (platform_machine != 'ARM64' and sys_platform == 'win32' and extra == 'wake') or (sys_platform != 'darwin' and sys_platform != 'win32' and extra == 'wake')", specifier = "==1.1.0" },
+ { name = "pyopen-wakeword", marker = "(platform_machine != 'x86_64' and sys_platform == 'darwin' and extra == 'wake-openwakeword') or (platform_machine != 'ARM64' and sys_platform == 'win32' and extra == 'wake-openwakeword') or (sys_platform != 'darwin' and sys_platform != 'win32' and extra == 'wake-openwakeword')", specifier = "==1.1.0" },
+ { name = "pypinyin", marker = "extra == 'wake'", specifier = "==0.55.0" },
+ { name = "pypinyin", marker = "extra == 'wake-sherpa'", specifier = "==0.55.0" },
+ { name = "python-dotenv", marker = "python_full_version >= '3.14'", specifier = "==1.2.2" },
+ { name = "python-multipart", marker = "python_full_version >= '3.14'", specifier = ">=0.0.9,<1" },
{ name = "python-multipart", marker = "extra == 'web'", specifier = "==0.0.32" },
{ name = "python-telegram-bot", extras = ["webhooks"], marker = "extra == 'messaging'", specifier = "==22.8" },
+ { name = "python-telegram-bot", extras = ["webhooks"], marker = "extra == 'telegram'", specifier = "==22.8" },
{ name = "python-telegram-bot", extras = ["webhooks"], marker = "extra == 'termux'", specifier = "==22.8" },
- { name = "pywin32", marker = "sys_platform == 'win32'", specifier = ">=306,<312" },
- { name = "pywinpty", marker = "sys_platform == 'win32'", specifier = ">=2.0.0,<3" },
- { name = "pyyaml", specifier = "==6.0.3" },
+ { name = "pywin32", marker = "python_full_version >= '3.14' and sys_platform == 'win32'", specifier = ">=306,<312" },
+ { name = "pywinpty", marker = "python_full_version >= '3.14' and sys_platform == 'win32'", specifier = ">=3.0.5,<4" },
{ name = "qrcode", marker = "extra == 'dingtalk'", specifier = "==7.4.2" },
{ name = "qrcode", marker = "extra == 'feishu'", specifier = "==7.4.2" },
{ name = "qrcode", marker = "extra == 'messaging'", specifier = "==7.4.2" },