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).
This commit is contained in:
teknium1
2026-09-18 04:32:12 -07:00
committed by Teknium
parent 021a4bfa9b
commit 787b6ebd3a

View File

@@ -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