-
Notifications
You must be signed in to change notification settings - Fork 21
Description
Problem
When a sub-agent (e.g. sonic) creates a background task via create_task.py, the task completion/cancellation notification is delivered to the main agent's chat instead of the sub-agent's chat where the conversation is happening.
Steps to Reproduce
- User is chatting with sub-agent
sonicin its private Telegram chat soniccreates a background task viapython3 tools/task_tools/create_task.py --name "My Task" "..."- Task runs and eventually completes or gets cancelled
- Notification arrives in main agent's General topic (or main agent's DM), not in
sonic's chat
Root Cause
From the logs:
Task submitted id=c44b3935 name='Regenerate 32 tracks UA+RU' parent=main
All sub-agents share the main agent's task hub. When a sub-agent creates a task, the framework assigns parent=main, so all delivery goes through the main agent's bot — regardless of which sub-agent originated the task.
create_task.py already reads DUCTOR_CHAT_ID and DUCTOR_TOPIC_ID env vars, but since delivery happens via the main bot, the message still appears in the main agent's context, not the sub-agent's.
Expected Behavior
Task completion/cancellation notification should be delivered via the originating sub-agent's bot to the chat where the task was created.
So if the user is chatting with sonic (chat_id = user's Telegram ID via Sonic's bot), the notification should arrive in that same sonic chat.
Environment
- Ductor with 5 sub-agents (clowder, watchfaces, corewatchface, rescue, sonic)
- Sub-agents share the main task hub (no separate
interagent_portper agent inagents.json) - Transport: Telegram
Suggested Fix
Consider supporting parent=sonic in the task hub, so that when a sub-agent creates a task, the hub knows to deliver the result via that sub-agent's bot and chat context.
Alternatively, allow passing a bot_token or agent_name parameter to the task creation API to override delivery routing.