From 787b6ebd3a7d5d41dd705500cb915dddece8b10c Mon Sep 17 00:00:00 2001 From: teknium1 <127238744+teknium1@users.noreply.github.com> Date: Fri, 18 Sep 2026 04:32:12 -0700 Subject: [PATCH] fix(acp): drop the redundant copy_context around asyncio.to_thread Review follow-up: asyncio.to_thread already runs its callable inside contextvars.copy_context(), so wrapping _register_pinned in a second copy was a no-op. The cwd pin set inside the worker still does not leak back to the caller (tests/acp_adapter/test_server.py pin assertion unchanged, still green). --- acp_adapter/server.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/acp_adapter/server.py b/acp_adapter/server.py index c3fb6a0f36..406e44e6a2 100644 --- a/acp_adapter/server.py +++ b/acp_adapter/server.py @@ -425,7 +425,7 @@ class HermesACPAgent(SlashCommandsMixin, acp.Agent): set_session_cwd(state.cwd) register_mcp_servers(configs) - await asyncio.to_thread(contextvars.copy_context().run, _register_pinned) + await asyncio.to_thread(_register_pinned) # to_thread already runs in a copied context except Exception: logger.warning("Session %s: failed to register ACP MCP servers", state.session_id, exc_info=True) return