[Feature]: Allow cron / heartbeat / webhook output to enter the matching topic session
Problem or motivation
In a multi-topic Telegram setup where each forum topic is dedicated to a subject (morning brief, daily review, watch feed, etc.), cron jobs push their output via _deliver_cron into the correct topic using chat_id + topic_id. The push is delivered via send_rich() and is visible in Telegram — but it doesn't enter the conversation session of that topic (SessionKey(transport, chat_id, topic_id)).
Concrete consequence: at 7am the morning brief cron pushes a 1000-token brief in topic "morning". At 10am the user asks in the same topic "expand on the 3rd point" — but the agent of that topic is completely amnesic. The brief is visible in Telegram but never entered the session memory. The user has to copy-paste the brief manually (and Telegram's native Reply gesture doesn't help either, see related bug report).
Proposed solution
What I'd love to see is an opt-in flag on cron (and ideally on heartbeat targets and webhook hooks too) like inject_into_session: bool = False. When True, the trigger result would feed the session of the destination topic, in addition to being delivered visually.
I noticed Ductor already has the needs_injection mechanism in the bus, used by background tasks via from_task_result() and inter-agent results — so the infrastructure exists, just not exposed to other trigger types. The lock pool from orchestrator/memory_flush.py (shipped via #77) might also be a useful shared dependency.
I don't know enough about the trigger lifecycle and lock semantics to propose a precise patch — would this kind of opt-in injection fit the design? If the scope feels right but the implementation surface is large, happy to split into smaller PRs (cron first, then heartbeat, then webhook).
Alternatives considered
- Vault-side workaround: cron writes brief to a local file, agent reads it on demand. Works today, but asymmetric (the agent must remember to read), no spontaneous context, fragile.
- Heartbeat polling on a flag file: 24–288 LLM calls per day per topic just to check a flag is prohibitive.
- Local patch on the bus adapters: wiped on every
pipx upgrade.
Why this matters beyond my use case
Anyone with a multi-topic Telegram bot where crons push contextual content (briefs, summaries, alerts) wants the agent of that topic to be able to discuss what was pushed. Today this is impossible without manual copy-paste. The infrastructure already exists in Ductor for background tasks — exposing it consistently to other triggers feels like a small ergonomic gap to close.
Before submitting
- [x] I have searched existing issues and feature requests for duplicates.