refactor(agent/relay): fold relay_llm attempt scaffolding into _ManagedAttempt; dedupe runtime session/scope paths; drop dead relay_runtime module-level shims

This commit is contained in:
Teknium
2026-09-02 13:18:33 -07:00
parent a7cd02d1bd
commit 00cd12f7e4
4 changed files with 922 additions and 1533 deletions
+435 -602
View File
File diff suppressed because it is too large Load Diff
+484 -924
View File
File diff suppressed because it is too large Load Diff
+1 -5
View File
@@ -72,11 +72,7 @@ def execute(
and relay_runtime._is_relay_wrapped_callback_error(exc, callback_error) and relay_runtime._is_relay_wrapped_callback_error(exc, callback_error)
): ):
raise callback_error raise callback_error
if ( if isinstance(exc, Exception) and callback_error is None and "value" in raw_result:
isinstance(exc, Exception)
and callback_error is None
and "value" in raw_result
):
logger.warning( logger.warning(
"NeMo Relay tool post-processing failed after dispatch success; " "NeMo Relay tool post-processing failed after dispatch success; "
"returning the Hermes tool result", "returning the Hermes tool result",
@@ -939,7 +939,7 @@ def test_execution_adapters_do_not_create_relay_host_without_a_consumer(
assert result is tool_result assert result is tool_result
assert observed_args is tool_args assert observed_args is tool_args
assert relay_runtime.get_host(create=False) is None assert relay_runtime.HOST_REGISTRY.for_profile(create=False) is None
assert imports == [] assert imports == []
@@ -958,7 +958,7 @@ def test_core_runtime_is_fail_open_without_a_published_binding(monkeypatch, capl
monkeypatch.setattr(relay_runtime.importlib, "import_module", missing_relay) monkeypatch.setattr(relay_runtime.importlib, "import_module", missing_relay)
assert relay_runtime.get_runtime() is None assert relay_runtime.get_runtime() is None
host = relay_runtime.get_host() host = relay_runtime.HOST_REGISTRY.for_profile()
assert isinstance(host, relay_runtime.NoopRelayRuntime) assert isinstance(host, relay_runtime.NoopRelayRuntime)
assert host.profile_key == relay_runtime.current_profile_key() assert host.profile_key == relay_runtime.current_profile_key()
assert "nemo_relay" in host.reason assert "nemo_relay" in host.reason