Skip to content

[Bug]: Cron jobs deliver to wrong chat — ignores Telegram topic thread routing #19365

Description

@Lukavyi

Summary

When a cron job has delivery.to configured to target a specific Telegram topic (e.g. 63448508:topic:1234), the message is delivered to the last active topic (the most recent thread from session history) instead of the configured one. The :topic: suffix in delivery.to is never parsed, so the explicitly configured messageThreadId is lost and replaced by whatever thread was last active in the session.

Steps to reproduce

  1. Create a cron job with delivery.to = "63448508:topic:1234" and delivery.channel = "telegram"
  2. Have a conversation in a different topic (e.g. topic 5678) so it becomes the last active one
  3. Wait for the cron job to fire
  4. The message appears in topic 5678 (last active), not in topic 1234 (configured)

Expected behavior

The cron delivery should parse :topic:NNN from the to field, extract the messageThreadId, and deliver to the configured topic thread — regardless of which topic was last active.

Actual behavior

:topic:NNN is not parsed in resolveSessionDeliveryTarget(). The delivery falls back to lastThreadId from session history, which points to whichever topic had the most recent conversation — not the one specified in the cron config.

Environment

  • Source (main branch)

lobster-biscuit

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions