fix(agent): propagate effective session key through subagent pipeline

The previous fix hardcoded session_key_override as channel:chat_id which
broke unified session mode where pending queues use "unified:default".
Propagate the effective key from _set_tool_context through SpawnTool
into the origin dict so _announce_result routes to the correct pending
queue in both normal and unified session modes.
This commit is contained in:
chengyongru
2026-04-20 14:47:14 +08:00
committed by Xubin Ren
parent 2193a64c80
commit 68466b1c2a
4 changed files with 104 additions and 8 deletions
+2 -2
View File
@@ -25,11 +25,11 @@ class SpawnTool(Tool):
self._origin_chat_id = "direct"
self._session_key = "cli:direct"
def set_context(self, channel: str, chat_id: str) -> None:
def set_context(self, channel: str, chat_id: str, effective_key: str | None = None) -> None:
"""Set the origin context for subagent announcements."""
self._origin_channel = channel
self._origin_chat_id = chat_id
self._session_key = f"{channel}:{chat_id}"
self._session_key = effective_key or f"{channel}:{chat_id}"
@property
def name(self) -> str: