@devries-cameron20 / composio-1 / commits / 09b552aa0
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

fix(py): disable retries on non-idempotent tool writes to prevent duplicate side effects (#3657)

This PR: - stops the Python SDK from silently retrying `tools.execute` and `tools.proxy`, which are non-idempotent POST writes. The Stainless-generated client retries POSTs by default (`max_retries=2`) on read timeouts, 429, 5xx, and connection errors. A read timeout is unsafe to retry — the request may already be in flight on the backend — so a retry can duplicate the side effect, e.g. send an email twice. Reported in https://github.com/ComposioHQ/composio/issues/3586 - routes both write paths through a new `client.without_retries` — a cached, retry-disabled (`max_retries=0`) clone of the `HttpClient`. Reads and lists keep the default retries, so resilience is unchanged for idempotent calls - overrides `HttpClient.copy()` to re-inject the required `provider` keyword and re-aliases `with_options`, since the generated `copy()` rebuilds via `self.__class__(...)` without `provider` — previously `with_options(max_retries=0)` raised `TypeError` on the subclass - caches the no-retry sibling instead of cloning per call: each clone creates a new `ContextVar`, and dynamically-created `ContextVar`s are never garbage-collected - adds `tests/test_no_retry_writes.py`: writes hit the transport exactly once on a retryable 5xx, reads still retry-then-succeed (proving the scoping), and a regression guard for the `copy()` override - interim fix only — the durable solution is idempotency keys, tracked in https://github.com/ComposioHQ/composio/issues/3654 (gated on backend support), which supersedes this once available No changeset (Python-only change; changesets are TypeScript-only).

Alberto Schiabel committed Jun 25, 2026 at 02:24 UTC 09b552aa037a780cf6ba8797ee3f2830fca82269
7 files changed +271 -44
python/composio/client/__init__.py
+44
@@ -182,6 +182,50 @@ class HttpClient(BaseComposio, WithLogger):
182 "provider": provider,
183 },
184 )
185 + # Lazily-built sibling client with retries disabled; see `without_retries`.
186 + self._without_retries: t.Optional["HttpClient"] = None
187 +
188 + def copy( # type: ignore[override]
189 + self,
190 + *,
191 + _extra_kwargs: t.Mapping[str, t.Any] = {},
192 + **kwargs: t.Any,
193 + ) -> te.Self:
194 + """
195 + Clone the client, re-injecting the required ``provider`` keyword.
196 +
197 + The Stainless-generated ``copy`` rebuilds the client via
198 + ``self.__class__(...)`` without passing ``provider``, which this subclass
199 + requires — so the inherited ``copy``/``with_options`` raise ``TypeError``.
200 + Threading ``provider`` through ``_extra_kwargs`` makes them work again
201 + (e.g. ``with_options(max_retries=0)``).
202 + """
203 + return super().copy( # type: ignore[misc]
204 + _extra_kwargs={"provider": self.provider, **_extra_kwargs},
205 + **kwargs,
206 + )
207 +
208 + # Re-alias `with_options` to this override. The base class binds
209 + # `with_options = copy` at class-definition time, so without this it would
210 + # still resolve to the base `copy` and miss the `provider` re-injection.
211 + with_options = copy
212 +
213 + @property
214 + def without_retries(self) -> "HttpClient":
215 + """
216 + A cached sibling client that never retries requests.
217 +
218 + Used for non-idempotent writes (``tools.execute`` / ``tools.proxy``),
219 + where a silent retry after a read timeout can duplicate a side effect
220 + (e.g. send an email twice). Reads keep the default retry behaviour.
221 +
222 + The sibling is cached rather than rebuilt per call: each clone creates a
223 + new ``ContextVar``, and dynamically-created ``ContextVar``s are never
224 + garbage-collected.
225 + """
226 + if self._without_retries is None:
227 + self._without_retries = self.with_options(max_retries=0)
228 + return self._without_retries
229
230 def _prepare_request(self, request: Request) -> None:
231 """
python/composio/core/models/tools.py
+6 -2
@@ -582,7 +582,9 @@ class Tools(Resource, t.Generic[TTool, TToolCollection]):
582
583 return t.cast(
584 ToolExecutionResponse,
585 - self._client.tools.execute(
585 + # Disable retries: tool execution is a non-idempotent write, and a
586 + # silent retry after a read timeout can duplicate the side effect.
587 + self._client.without_retries.tools.execute(
588 tool_slug=slug,
589 arguments=arguments,
590 connected_account_id=none_to_omit(connected_account_id),
@@ -740,7 +742,9 @@ class Tools(Resource, t.Generic[TTool, TToolCollection]):
742 ] = None,
743 ) -> tool_proxy_response.ToolProxyResponse:
744 """Proxy a tool call to the Composio API"""
743 - return self._client.tools.proxy(
745 + # Disable retries: a proxied call is a non-idempotent write, and a silent
746 + # retry after a read timeout can duplicate the side effect.
747 + return self._client.without_retries.tools.proxy(
748 endpoint=endpoint,
749 method=method,
750 body=body if body is not None else omit,
python/tests/conftest.py
+14 -1
@@ -62,10 +62,23 @@ def load_golden_signatures() -> dict:
62 return json.load(f)
63
64
65 +def mock_http_client() -> Mock:
66 + """Build a mock ``HttpClient`` for tool-execution tests.
67 +
68 + Production routes non-idempotent writes through ``client.without_retries``
69 + (a retry-disabled clone of the client). The mock mirrors that by returning
70 + itself for ``without_retries``, so assertions on ``client.tools.execute`` and
71 + ``client.tools.proxy`` still observe the call.
72 + """
73 + client = Mock()
74 + client.without_retries = client
75 + return client
76 +
77 +
78 @pytest.fixture
79 def mock_client() -> Mock:
80 """Create a mock HTTP client."""
68 - client = Mock()
81 + client = mock_http_client()
82 client.triggers_types = Mock()
83 client.trigger_instances = Mock()
84 client.trigger_instances.manage = Mock()
python/tests/test_auto_upload_download_files.py
+3 -1
@@ -12,6 +12,8 @@ from composio.client.types import Tool, tool_list_response
12 from composio.core.models.base import allow_tracking
13 from composio.core.models.tools import Tools
14
15 +from tests.conftest import mock_http_client
16 +
17
18 @pytest.fixture(autouse=True)
19 def disable_telemetry():
@@ -24,7 +26,7 @@ def disable_telemetry():
26 @pytest.fixture
27 def mock_client():
28 """Create a mock HTTP client."""
27 - return Mock()
29 + return mock_http_client()
30
31
32 @pytest.fixture
python/tests/test_no_retry_writes.py new
+161
@@ -0,0 +1,161 @@
1 +"""Non-idempotent tool writes (``tools.execute`` / ``tools.proxy``) must not retry.
2 +
3 +A POST that times out while the backend is still processing it is unsafe to
4 +retry: the request may already have taken effect, so a silent re-send can
5 +duplicate the side effect (e.g. send an email twice). ``Tools.execute`` and
6 +``Tools.proxy`` therefore route through ``client.without_retries`` (a
7 +retry-disabled clone), while reads keep the default retry behaviour.
8 +"""
9 +
10 +import typing as t
11 +from unittest.mock import Mock, patch
12 +
13 +import httpx
14 +import pytest
15 +from composio_client import DEFAULT_MAX_RETRIES, APIError
16 +
17 +from composio.client import HttpClient
18 +from composio.core.models.base import allow_tracking
19 +from composio.core.models.tools import Tools
20 +
21 +
22 +@pytest.fixture(autouse=True)
23 +def disable_telemetry():
24 + """Disable telemetry for all tests to prevent thread issues."""
25 + token = allow_tracking.set(False)
26 + yield
27 + allow_tracking.reset(token)
28 +
29 +
30 +@pytest.fixture
31 +def no_sleep(monkeypatch: pytest.MonkeyPatch) -> None:
32 + """Neutralise retry backoff so retry tests run instantly."""
33 + import composio_client._base_client as base
34 +
35 + monkeypatch.setattr(base.time, "sleep", lambda *args, **kwargs: None)
36 +
37 +
38 +def _client_with_transport(
39 + handler: t.Callable[[httpx.Request], httpx.Response],
40 +) -> HttpClient:
41 + """Build an ``HttpClient`` whose HTTP requests are served by ``handler``.
42 +
43 + ``base_url`` is passed explicitly so the test does not depend on
44 + ``COMPOSIO_BASE_URL`` possibly being set in the environment.
45 + """
46 + return HttpClient(
47 + provider="test",
48 + api_key="sk-test",
49 + base_url="https://backend.invalid",
50 + http_client=httpx.Client(transport=httpx.MockTransport(handler)),
51 + )
52 +
53 +
54 +class TestCopyOverride:
55 + """Guards the ``HttpClient.copy()`` override that makes ``with_options`` work."""
56 +
57 + def test_with_options_does_not_raise_and_overrides_max_retries(self) -> None:
58 + client = HttpClient(
59 + provider="myprovider",
60 + api_key="sk-test",
61 + base_url="https://backend.invalid",
62 + )
63 +
64 + # Without the copy() override this raises:
65 + # TypeError: missing required keyword-only argument 'provider'.
66 + clone = client.with_options(max_retries=0)
67 +
68 + assert isinstance(clone, HttpClient)
69 + assert clone.max_retries == 0
70 + assert clone.provider == "myprovider"
71 + assert clone.request_ctx.get()["provider"] == "myprovider"
72 + # The original client keeps its retries.
73 + assert client.max_retries == DEFAULT_MAX_RETRIES
74 +
75 + def test_without_retries_is_a_cached_zero_retry_sibling(self) -> None:
76 + client = HttpClient(
77 + provider="test",
78 + api_key="sk-test",
79 + base_url="https://backend.invalid",
80 + )
81 +
82 + assert client.without_retries.max_retries == 0
83 + # Cached: repeated access returns the same instance (no per-call clone).
84 + assert client.without_retries is client.without_retries
85 + # Reads on the original client keep retrying.
86 + assert client.max_retries == DEFAULT_MAX_RETRIES
87 +
88 +
89 +class TestWritePathDoesNotRetry:
90 + """``execute`` / ``proxy`` must reach the transport exactly once."""
91 +
92 + def test_execute_does_not_retry_on_transient_error(self, no_sleep: None) -> None:
93 + attempts: t.List[httpx.Request] = []
94 +
95 + def handler(request: httpx.Request) -> httpx.Response:
96 + attempts.append(request)
97 + return httpx.Response(500, json={"error": {"message": "boom"}})
98 +
99 + client = _client_with_transport(handler)
100 + tools = Tools(client=client, provider=Mock())
101 +
102 + # Avoid the (read) tool-schema lookup hitting the transport.
103 + mock_tool = Mock()
104 + mock_tool.toolkit.slug = "gmail"
105 + with patch.object(
106 + tools, "get_raw_composio_tool_by_slug", return_value=mock_tool
107 + ):
108 + with pytest.raises(APIError):
109 + tools._execute_tool(
110 + slug="GMAIL_SEND_EMAIL",
111 + arguments={},
112 + version="1.0.0",
113 + )
114 +
115 + assert len(attempts) == 1
116 +
117 + def test_proxy_does_not_retry_on_transient_error(self, no_sleep: None) -> None:
118 + attempts: t.List[httpx.Request] = []
119 +
120 + def handler(request: httpx.Request) -> httpx.Response:
121 + attempts.append(request)
122 + return httpx.Response(500, json={"error": {"message": "boom"}})
123 +
124 + client = _client_with_transport(handler)
125 + tools = Tools(client=client, provider=Mock())
126 +
127 + with pytest.raises(APIError):
128 + tools.proxy(endpoint="/any", method="POST")
129 +
130 + assert len(attempts) == 1
131 +
132 +
133 +class TestReadPathStillRetries:
134 + """Reads keep the default retry behaviour — only writes are scoped to no-retry."""
135 +
136 + def test_read_retries_then_succeeds(self, no_sleep: None) -> None:
137 + attempts: t.List[httpx.Request] = []
138 + responses = [
139 + httpx.Response(503, json={"error": {"message": "transient"}}),
140 + httpx.Response(
141 + 200,
142 + json={
143 + "current_page": 1,
144 + "items": [],
145 + "total_items": 0,
146 + "total_pages": 1,
147 + },
148 + ),
149 + ]
150 +
151 + def handler(request: httpx.Request) -> httpx.Response:
152 + attempts.append(request)
153 + return responses[len(attempts) - 1]
154 +
155 + client = _client_with_transport(handler)
156 +
157 + result = client.tools.list()
158 +
159 + # First attempt 503, retried, second attempt 200 -> success.
160 + assert len(attempts) == 2
161 + assert result.total_items == 0
python/tests/test_provider.py
+20 -19
@@ -15,6 +15,7 @@ from composio.client.types import Tool, tool_list_response
15 from composio.core.models.base import allow_tracking
16 from composio.core.models.tools import Tools
17 from composio.core.provider import AgenticProvider, NonAgenticProvider
18 +from tests.conftest import mock_http_client
19
20
21 @pytest.fixture(autouse=True)
@@ -98,7 +99,7 @@ class TestProviderExecuteToolSetup:
99
100 def test_execute_tool_set_during_tools_initialization_non_agentic(self):
101 """Test that execute_tool is set during Tools initialization for non-agentic providers."""
101 - mock_client = Mock()
102 + mock_client = mock_http_client()
103 from composio.core.provider._openai import OpenAIProvider
104
105 provider = OpenAIProvider()
@@ -117,7 +118,7 @@ class TestProviderExecuteToolSetup:
118
119 def test_execute_tool_set_during_tools_initialization_agentic(self):
120 """Test that execute_tool is set during Tools initialization for agentic providers."""
120 - mock_client = Mock()
121 + mock_client = mock_http_client()
122
123 class TestAgenticProvider(AgenticProvider, name="test_agentic"):
124 def wrap_tool(self, tool, execute_tool):
@@ -142,7 +143,7 @@ class TestProviderExecuteToolSetup:
143
144 def test_execute_tool_available_immediately_after_initialization(self):
145 """Test that execute_tool is available immediately after initialization, before get() is called."""
145 - mock_client = Mock()
146 + mock_client = mock_http_client()
147 from composio.core.provider._openai import OpenAIProvider
148
149 provider = OpenAIProvider()
@@ -160,7 +161,7 @@ class TestProviderExecuteToolSetup:
161
162 def test_execute_tool_signature_matches_protocol(self):
163 """Test that execute_tool has the correct signature matching ExecuteToolFn protocol."""
163 - mock_client = Mock()
164 + mock_client = mock_http_client()
165 from composio.core.provider._openai import OpenAIProvider
166
167 provider = OpenAIProvider()
@@ -202,7 +203,7 @@ class TestProviderExecuteToolFunctionality:
203
204 def test_execute_tool_executes_composio_tool(self):
205 """Test that provider.execute_tool executes Composio tools correctly."""
205 - mock_client = Mock()
206 + mock_client = mock_http_client()
207 from composio.core.provider._openai import OpenAIProvider
208
209 provider = OpenAIProvider()
@@ -236,7 +237,7 @@ class TestProviderExecuteToolFunctionality:
237
238 def test_execute_tool_uses_dangerously_skip_version_check(self):
239 """Test that execute_tool automatically sets dangerously_skip_version_check=True."""
239 - mock_client = Mock()
240 + mock_client = mock_http_client()
241 from composio.core.provider._openai import OpenAIProvider
242
243 provider = OpenAIProvider()
@@ -269,7 +270,7 @@ class TestProviderExecuteToolFunctionality:
270
271 def test_execute_tool_passes_user_id(self):
272 """Test that execute_tool correctly passes user_id parameter."""
272 - mock_client = Mock()
273 + mock_client = mock_http_client()
274 from composio.core.provider._openai import OpenAIProvider
275
276 provider = OpenAIProvider()
@@ -306,7 +307,7 @@ class TestProviderExecuteToolFunctionality:
307 """Test that execute_tool correctly passes modifiers."""
308 from composio.core.models._modifiers import before_execute
309
309 - mock_client = Mock()
310 + mock_client = mock_http_client()
311 from composio.core.provider._openai import OpenAIProvider
312
313 provider = OpenAIProvider()
@@ -347,7 +348,7 @@ class TestProviderExecuteToolFunctionality:
348
349 def test_execute_tool_with_toolkit_versions(self):
350 """Test that execute_tool uses configured toolkit versions."""
350 - mock_client = Mock()
351 + mock_client = mock_http_client()
352 from composio.core.provider._openai import OpenAIProvider
353
354 provider = OpenAIProvider()
@@ -390,7 +391,7 @@ class TestNonAgenticProviderHelperMethods:
391 Function,
392 )
393
393 - mock_client = Mock()
394 + mock_client = mock_http_client()
395 from composio.core.provider._openai import OpenAIProvider
396
397 provider = OpenAIProvider()
@@ -439,7 +440,7 @@ class TestNonAgenticProviderHelperMethods:
440 Function,
441 )
442
442 - mock_client = Mock()
443 + mock_client = mock_http_client()
444 from composio.core.provider._openai import OpenAIProvider
445
446 provider = OpenAIProvider()
@@ -523,7 +524,7 @@ class TestAgenticProviderFunctionality:
524
525 def test_agentic_provider_has_execute_tool_after_initialization(self):
526 """Test that agentic providers have execute_tool after Tools initialization."""
526 - mock_client = Mock()
527 + mock_client = mock_http_client()
528
529 class TestAgenticProvider(AgenticProvider, name="test_agentic"):
530 def wrap_tool(self, tool, execute_tool):
@@ -545,7 +546,7 @@ class TestAgenticProviderFunctionality:
546
547 def test_agentic_provider_execute_tool_works(self):
548 """Test that agentic provider's execute_tool executes tools correctly."""
548 - mock_client = Mock()
549 + mock_client = mock_http_client()
550
551 class TestAgenticProvider(AgenticProvider, name="test_agentic"):
552 def wrap_tool(self, tool, execute_tool):
@@ -583,7 +584,7 @@ class TestAgenticProviderFunctionality:
584
585 def test_agentic_provider_wrapped_tools_receive_execute_function(self):
586 """Test that wrapped tools from agentic providers receive the execute function."""
586 - mock_client = Mock()
587 + mock_client = mock_http_client()
588
589 class TestAgenticProvider(AgenticProvider, name="test_agentic"):
590 def wrap_tool(self, tool, execute_tool):
@@ -640,7 +641,7 @@ class TestAgenticProviderFunctionality:
641
642 def test_agentic_provider_wrap_tools_receives_execute_function(self):
643 """Test that wrap_tools method receives the execute_tool function."""
643 - mock_client = Mock()
644 + mock_client = mock_http_client()
645
646 class TestAgenticProvider(AgenticProvider, name="test_agentic"):
647 def wrap_tool(self, tool, execute_tool):
@@ -838,7 +839,7 @@ class TestProviderEdgeCases:
839
840 def test_execute_tool_with_none_parameters(self):
841 """Test that execute_tool works when optional parameters are None."""
841 - mock_client = Mock()
842 + mock_client = mock_http_client()
843 from composio.core.provider._openai import OpenAIProvider
844
845 provider = OpenAIProvider()
@@ -871,7 +872,7 @@ class TestProviderEdgeCases:
872
873 def test_execute_tool_with_multiple_toolkit_versions(self):
874 """Test execute_tool with multiple configured toolkit versions."""
874 - mock_client = Mock()
875 + mock_client = mock_http_client()
876 from composio.core.provider._openai import OpenAIProvider
877
878 provider = OpenAIProvider()
@@ -917,7 +918,7 @@ class TestProviderIntegration:
918
919 def test_provider_workflow_non_agentic(self):
920 """Test complete workflow with non-agentic provider."""
920 - mock_client = Mock()
921 + mock_client = mock_http_client()
922 from composio.core.provider._openai import OpenAIProvider
923
924 provider = OpenAIProvider()
@@ -969,7 +970,7 @@ class TestProviderIntegration:
970
971 def test_provider_workflow_agentic(self):
972 """Test complete workflow with agentic provider."""
972 - mock_client = Mock()
973 + mock_client = mock_http_client()
974
975 class TestAgenticProvider(AgenticProvider, name="test_agentic"):
976 def wrap_tool(self, tool, execute_tool):
python/tests/test_tool_execution.py
+23 -21
@@ -12,6 +12,8 @@ from composio.core.models.base import allow_tracking
12 from composio.core.models.tools import Tools, _serialize_arguments, _needs_serialization
13 from composio.exceptions import ToolVersionRequiredError
14
15 +from tests.conftest import mock_http_client
16 +
17
18 @pytest.fixture(autouse=True)
19 def disable_telemetry():
@@ -52,7 +54,7 @@ class TestToolExecution:
54
55 def test_get_raw_tool_router_meta_tools_fetches_all_pages(self):
56 """Test that ToolRouter session tools are fetched across all pages."""
55 - mock_client = Mock()
57 + mock_client = mock_http_client()
58 mock_provider = Mock()
59 tools = Tools(client=mock_client, provider=mock_provider)
60
@@ -82,7 +84,7 @@ class TestToolExecution:
84 def test_tool_execution_uses_toolkit_version(self):
85 """Test that tool execution resolves toolkit version correctly."""
86 # Mock client and provider
85 - mock_client = Mock()
87 + mock_client = mock_http_client()
88 mock_provider = Mock()
89 mock_provider.name = "test_provider"
90
@@ -128,7 +130,7 @@ class TestToolExecution:
130 def test_tool_execution_with_explicit_version(self):
131 """Test that explicit version overrides toolkit version."""
132 # Mock client and provider
131 - mock_client = Mock()
133 + mock_client = mock_http_client()
134 mock_provider = Mock()
135 mock_provider.name = "test_provider"
136
@@ -177,7 +179,7 @@ class TestToolExecution:
179 def test_tool_execution_unknown_toolkit_fallback(self):
180 """Test that unknown toolkit falls back to 'latest'."""
181 # Mock client and provider
180 - mock_client = Mock()
182 + mock_client = mock_http_client()
183 mock_provider = Mock()
184 mock_provider.name = "test_provider"
185
@@ -226,7 +228,7 @@ class TestToolExecution:
228 def test_tool_execution_with_global_version_string(self):
229 """Test that global version string is used for all toolkits."""
230 # Mock client and provider
229 - mock_client = Mock()
231 + mock_client = mock_http_client()
232 mock_provider = Mock()
233 mock_provider.name = "test_provider"
234
@@ -275,7 +277,7 @@ class TestToolExecution:
277 # version: body.version ?? getToolkitVersion(tool.toolkit?.slug ?? 'unknown', this.toolkitVersions)
278
279 # Mock client and provider
278 - mock_client = Mock()
280 + mock_client = mock_http_client()
281 mock_provider = Mock()
282 mock_provider.name = "test_provider"
283
@@ -353,7 +355,7 @@ class TestToolExecution:
355 def test_execute_raises_error_when_version_is_latest_without_skip_flag(self):
356 """Test that execute raises ToolVersionRequiredError when version is 'latest' without skip flag."""
357 # Mock client and provider
356 - mock_client = Mock()
358 + mock_client = mock_http_client()
359 mock_provider = Mock()
360 mock_provider.name = "test_provider"
361
@@ -382,7 +384,7 @@ class TestToolExecution:
384 def test_execute_allows_latest_with_dangerously_skip_version_check(self):
385 """Test that execute allows 'latest' version when dangerously_skip_version_check is True."""
386 # Mock client and provider
385 - mock_client = Mock()
387 + mock_client = mock_http_client()
388 mock_provider = Mock()
389 mock_provider.name = "test_provider"
390
@@ -429,7 +431,7 @@ class TestToolExecution:
431 def test_execute_with_specific_version_no_error(self):
432 """Test that execute works with specific version without raising error."""
433 # Mock client and provider
432 - mock_client = Mock()
434 + mock_client = mock_http_client()
435 mock_provider = Mock()
436 mock_provider.name = "test_provider"
437
@@ -475,7 +477,7 @@ class TestToolExecution:
477 def test_execute_uses_instance_toolkit_versions(self):
478 """Test that execute method uses instance-level toolkit versions."""
479 # Mock client and provider
478 - mock_client = Mock()
480 + mock_client = mock_http_client()
481 mock_provider = Mock()
482 mock_provider.name = "test_provider"
483
@@ -524,7 +526,7 @@ class TestToolExecution:
526 def test_execute_version_parameter_overrides_toolkit_versions(self):
527 """Test that explicit version parameter overrides instance toolkit versions."""
528 # Mock client and provider
527 - mock_client = Mock()
529 + mock_client = mock_http_client()
530 mock_provider = Mock()
531 mock_provider.name = "test_provider"
532
@@ -574,7 +576,7 @@ class TestToolExecution:
576 def test_execute_with_connected_account_id(self):
577 """Test that execute passes connected_account_id correctly."""
578 # Mock client and provider
577 - mock_client = Mock()
579 + mock_client = mock_http_client()
580 mock_provider = Mock()
581 mock_provider.name = "test_provider"
582
@@ -621,7 +623,7 @@ class TestToolExecution:
623 def test_execute_with_custom_auth_params(self):
624 """Test that execute passes custom_auth_params correctly."""
625 # Mock client and provider
624 - mock_client = Mock()
626 + mock_client = mock_http_client()
627 mock_provider = Mock()
628 mock_provider.name = "test_provider"
629
@@ -669,7 +671,7 @@ class TestToolExecution:
671 def test_execute_with_user_id_and_text(self):
672 """Test that execute passes user_id and text parameters correctly."""
673 # Mock client and provider
672 - mock_client = Mock()
674 + mock_client = mock_http_client()
675 mock_provider = Mock()
676 mock_provider.name = "test_provider"
677
@@ -720,7 +722,7 @@ class TestToolExecution:
722 from composio.core.models._modifiers import before_execute
723
724 # Mock client and provider
723 - mock_client = Mock()
725 + mock_client = mock_http_client()
726 mock_provider = Mock()
727 mock_provider.name = "test_provider"
728
@@ -776,7 +778,7 @@ class TestToolExecution:
778 from composio.core.models._modifiers import after_execute
779
780 # Mock client and provider
779 - mock_client = Mock()
781 + mock_client = mock_http_client()
782 mock_provider = Mock()
783 mock_provider.name = "test_provider"
784
@@ -958,7 +960,7 @@ class TestToolExecution:
960 """``before_file_upload`` in ``modifiers`` is composed into substitute_file_uploads."""
961 from composio.core.models._modifiers import before_file_upload
962
961 - mock_client = Mock()
963 + mock_client = mock_http_client()
964 mock_provider = Mock()
965 mock_provider.name = "test_provider"
966
@@ -1019,7 +1021,7 @@ class TestToolExecution:
1021 import os
1022
1023 # Mock client and provider
1022 - mock_client = Mock()
1024 + mock_client = mock_http_client()
1025 mock_provider = Mock()
1026 mock_provider.name = "test_provider"
1027
@@ -1074,7 +1076,7 @@ class TestToolExecution:
1076 import os
1077
1078 # Mock client and provider
1077 - mock_client = Mock()
1079 + mock_client = mock_http_client()
1080 mock_provider = Mock()
1081 mock_provider.name = "test_provider"
1082
@@ -1109,7 +1111,7 @@ class TestToolExecution:
1111 def test_execute_with_custom_connection_data(self):
1112 """Test that execute passes custom_connection_data correctly."""
1113 # Mock client and provider
1112 - mock_client = Mock()
1114 + mock_client = mock_http_client()
1115 mock_provider = Mock()
1116 mock_provider.name = "test_provider"
1117
@@ -1213,7 +1215,7 @@ class TestSerializeArguments:
1215 def test_execute_tool_serializes_pydantic_arguments(self):
1216 """Regression test for PLEN-1514: Pydantic models in arguments must be
1217 serialized to plain dicts before being sent to the API."""
1216 - mock_client = Mock()
1218 + mock_client = mock_http_client()
1219 mock_provider = Mock()
1220 mock_provider.name = "test_provider"
1221