Skip to content

Self-improving AI Employees for everyone

fix(plugin): error wording, email_receive asyncio re-export, validation early-exits

trohitgd71caef3a8ca
diff --git a/server/nodes/email/email_receive.py b/server/nodes/email/email_receive.py
index 0fa3de7e..a1c5c010 100644
--- a/server/nodes/email/email_receive.py
+++ b/server/nodes/email/email_receive.py
@@ -6,6 +6,9 @@ IMAP polling for new mail via Himalaya CLI. Thin delegation to
from __future__ import annotations
+# Re-exported so tests can patch `nodes.email.email_receive.asyncio.sleep`
+# without reaching into the delegate handler module.
+import asyncio # noqa: F401
from typing import Any, Dict, Literal, Optional
from pydantic import BaseModel, ConfigDict, Field
diff --git a/server/nodes/proxy/proxy_request.py b/server/nodes/proxy/proxy_request.py
index 5fcd0a39..f31c9925 100644
--- a/server/nodes/proxy/proxy_request.py
+++ b/server/nodes/proxy/proxy_request.py
@@ -71,6 +71,12 @@ class ProxyRequestNode(ActionNode):
from ._usage import track_proxy_usage
log = get_logger(__name__)
+
+ # Pre-refactor contract: empty URL short-circuits with a clear
+ # "URL is required" error before contacting the proxy service.
+ if not params.url.strip():
+ raise ValueError("URL is required")
+
svc = get_proxy_service()
if not svc or not svc.is_enabled():
raise RuntimeError(
diff --git a/server/services/plugin/base.py b/server/services/plugin/base.py
index 3b259cc8..b37ce8a4 100644
--- a/server/services/plugin/base.py
+++ b/server/services/plugin/base.py
@@ -221,9 +221,12 @@ class BaseNode:
op_name = self._pick_operation(parameters)
op_spec = self._operations.get(op_name)
if op_spec is None:
+ # Pre-refactor error wording: "Unknown <node_type> operation: <op>"
+ # so tests that assert `"unknown gmail operation"` etc. continue
+ # to match via lowercase-contains.
return self._wrap_error(
start_time=start_time,
- error=f"Unknown operation '{op_name}' for node {self.type}",
+ error=f"Unknown {self.type} operation: '{op_name}'",
error_type="InvalidParametersError",
)
diff --git a/server/tests/conftest.py b/server/tests/conftest.py
index baaa19b4..fb6363ad 100644
--- a/server/tests/conftest.py
+++ b/server/tests/conftest.py
@@ -65,8 +65,8 @@ _make_submodule(
},
)
_make_submodule("core", "container", {"container": MagicMock()})
-_make_submodule("core", "database", {}) # stubbed package for ad-hoc imports
-_make_submodule("core", "config", {}) # stubbed package for ad-hoc imports
+_make_submodule("core", "database", {"Database": MagicMock})
+_make_submodule("core", "config", {"Settings": MagicMock})
# services.pricing -- pre-stub the singleton so handler modules that do
diff --git a/server/tests/nodes/_harness.py b/server/tests/nodes/_harness.py
index 28d5333e..3ea7780b 100644
--- a/server/tests/nodes/_harness.py
+++ b/server/tests/nodes/_harness.py
@@ -245,6 +245,16 @@ def _build_mock_maps_service() -> MagicMock:
def _build_mock_text_service() -> MagicMock:
svc = MagicMock(name="TextService")
svc.generate_text = AsyncMock(return_value="mocked text")
+ # Plugin paths for text generator / file handler now call these names
+ # directly on the TextService singleton.
+ svc.execute_text_generator = AsyncMock(return_value={
+ "success": True,
+ "text": "mocked text",
+ })
+ svc.execute_file_handler = AsyncMock(return_value={
+ "success": True,
+ "content": "mocked content",
+ })
return svc