From 257da5ca07ef69a32972ddf9a085ee6bedeefe36 Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Wed, 2 Sep 2026 03:34:33 -0700 Subject: [PATCH] fix(gateway): route /review and /reload-skills executor hops through the scoped helper MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sibling sites of the bare loop.run_in_executor(None, …) class fixed for /insights, /debug and /goal draft: the worker started with an empty context, so get_hermes_home()-relative reads (skills.external_dirs, disabled skills, the reviewer subagent's home and secret scope) resolved the launch home instead of the routed profile under multiplex. --- gateway/slash_commands.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/gateway/slash_commands.py b/gateway/slash_commands.py index 67a9bdb353..162f231b13 100644 --- a/gateway/slash_commands.py +++ b/gateway/slash_commands.py @@ -3079,8 +3079,6 @@ class GatewaySlashCommandsMixin: set_current_session_key, ) - loop = asyncio.get_running_loop() - def _dispatch(): token = set_current_session_key(quick_key) try: @@ -3091,7 +3089,10 @@ class GatewaySlashCommandsMixin: reset_current_session_key(token) try: - result = await loop.run_in_executor(None, _dispatch) + # _run_in_executor_with_context, not a bare hop: the reviewer + # subagent is spawned from the worker and inherits its context, + # so a bare hop would run it under the launch home / no secret scope. + result = await self._run_in_executor_with_context(_dispatch) except ValueError as exc: return str(exc) except Exception as exc: @@ -6016,11 +6017,12 @@ class GatewaySlashCommandsMixin: is written to the session transcript out-of-band, so message alternation is preserved. """ - loop = asyncio.get_running_loop() try: from agent.skill_commands import reload_skills - result = await loop.run_in_executor(None, reload_skills) + # _run_in_executor_with_context, not a bare hop: the rescan walks + # get_hermes_home()/skills, a contextvar override under multiplex. + result = await self._run_in_executor_with_context(reload_skills) added = result.get("added", []) # [{"name", "description"}, ...] removed = result.get("removed", []) # [{"name", "description"}, ...] total = result.get("total", 0)