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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user