Skip to content

[Bug]: Telegram plugin enabled causes agent runs to skip local LLM provider calls entirely #14062

Description

@tauceti82

[Bug]: Telegram plugin enabled causes agent runs to skip local LLM provider calls entirely

Summary

When plugins.telegram.enabled: true and channels.telegram.enabled: true are both configured, Telegram messages trigger agent runs but the local LLM provider is never called. The agent run completes with "Connection error" despite the proxy being reachable and functional for other channels (webchat).

Environment

Configuration

{
  "channels": {
    "telegram": {
      "enabled": true,
      "botToken": "<REDACTED>"
    }
  },
  "plugins": {
    "entries": {
      "telegram": {
        "enabled": true
      }
    }
  },
  "models": {
    "providers": {
      "localProxy": {
        "baseUrl": "http://localhost:1234/anthropic",
        "apiKey": "<REDACTED>",
        "auth": "token",
        "api": "anthropic-messages"
      }
    }
  },
  "agents": {
    "defaults": {
      "model": {
        "primary": "localProxy/anthropic--claude-4.5-sonnet"
      }
    }
  }
}

Steps to Reproduce

  1. Configure both channels.telegram.enabled: true and plugins.telegram.enabled: true
  2. Ensure LLM proxy is running and accessible (verified: works for webchat)
  3. Send a message to the Telegram bot from an authorized user
  4. Observe: Message is received and appears in webchat (shared session)
  5. Observe: Agent run is triggered with messageChannel=telegram
  6. Observe: No LLM provider request is made (confirmed: proxy receives zero requests)
  7. Result: Session history shows assistant turn with "stopReason":"error","errorMessage":"Connection error."

Expected Behavior

  • Telegram message triggers agent run
  • Agent run calls LLM provider (http://localhost:1234/anthropic)
  • LLM response is generated
  • Reply is delivered to Telegram (or at least attempted)

Actual Behavior

  • Telegram message triggers agent run ✅
  • Agent run skips LLM provider call entirely
  • No HTTP request reaches the proxy (verified via proxy logs)
  • Session shows empty assistant turn with "Connection error"
  • No response delivered to Telegram

Diagnostic Evidence

Gateway Logs (plugin enabled, Telegram message sent)

10:51:55 [telegram] update: {"update_id":143725665,"message":{"message_id":29,"from":{"id":3463194322,...},"text":"test"}}
10:51:56 telegram inbound: chatId=3463194322 from=telegram:3463194322 len=83
10:51:56 [agent/embedded] embedded run start: runId=96f071a8-a428-4a7a-a583-c0836d6ad116 sessionId=2e37a42d-7e93-44e1-984c-e7df4a531b1a provider=localproxy model=anthropic--claude-4.5-sonnet thinking=off messageChannel=telegram
10:51:56 [agent/embedded] embedded run agent start: runId=96f071a8-a428-4a7a-a583-c0836d6ad116
10:51:57 [agent/embedded] embedded run agent end: runId=96f071a8-a428-4a7a-a583-c0836d6ad116
10:51:59 [agent/embedded] embedded run agent start: runId=96f071a8-a428-4a7a-a583-c0836d6ad116
10:52:00 [agent/embedded] embedded run agent end: runId=96f071a8-a428-4a7a-a583-c0836d6ad116
10:52:05 [agent/embedded] embedded run agent start: runId=96f071a8-a428-4a7a-a583-c0836d6ad116
10:52:06 [agent/embedded] embedded run agent end: runId=96f071a8-a428-4a7a-a583-c0836d6ad116
10:52:14 [agent/embedded] embedded run agent start: runId=96f071a8-a428-4a7a-a583-c0836d6ad116
10:52:15 [agent/embedded] embedded run agent end: runId=96f071a8-a428-4a7a-a583-c0836d6ad116
10:52:15 [agent/embedded] embedded run done: runId=96f071a8-a428-4a7a-a583-c0836d6ad116 sessionId=2e37a42d-7e93-44e1-984c-e7df4a531b1a durationMs=19511 aborted=false

Key observation: Multiple agent start/end cycles (retry pattern), but no tool calls, no LLM streaming, no HTTP logs.

Gateway Logs (plugin disabled, same message via webchat)

10:57:51 [agent/embedded] embedded run start: runId=467e621d-54db-46d8-a8fc-dc3da828bfbd sessionId=2e37a42d-7e93-44e1-984c-e7df4a531b1a provider=localproxy model=anthropic--claude-4.5-sonnet thinking=off messageChannel=webchat
10:57:51 [agent/embedded] embedded run agent start: runId=467e621d-54db-46d8-a8fc-dc3da828bfbd
10:57:54 [agent/embedded] embedded run tool start: runId=467e621d-54db-46d8-a8fc-dc3da828bfbd tool=exec toolCallId=toolu_bdrk_018Pwh3ij9QjFdkdBom1uuKj
10:57:54 [agent/embedded] embedded run tool end: runId=467e621d-54db-46d8-a8fc-dc3da828bfbd tool=exec toolCallId=toolu_bdrk_018Pwh3ij9QjFdkdBom1uuKj
10:57:56 [ws] → event agent seq=4 clients=1 run=467e621d…bfbd agent=main session=main stream=assistant aseq=5 text=**test
...
10:58:02 [agent/embedded] embedded run done: runId=467e621d-54db-46d8-a8fc-dc3da828bfbd sessionId=2e37a42d-7e93-44e1-984c-e7df4a531b1a durationMs=11686 aborted=false

Key difference: Tool calls execute, streaming output appears, LLM response generated successfully.

Session History (Telegram messages with plugin enabled)

{
  "type":"message",
  "id":"636c41eb",
  "parentId":"87ec5414",
  "timestamp":"2026-02-11T11:13:29.235Z",
  "message":{
    "role":"assistant",
    "content":[],
    "api":"anthropic-messages",
    "provider":"localProxy",
    "model":"anthropic--claude-4.5-sonnet",
    "usage":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0,"totalTokens":0,"cost":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0,"total":0}},
    "stopReason":"error",
    "timestamp":1770808407836,
    "errorMessage":"Connection error."
  }
}

## Workaround

**Disable the Telegram plugin:**

```json
{
  "plugins": {
    "entries": {
      "telegram": {
        "enabled": false
      }
    }
  }
}

Root Cause Hypothesis

When plugins.telegram.enabled: true, the plugin may be:

  1. Intercepting the agent run flow and preventing LLM provider resolution
  2. Overriding the model/provider config for messageChannel=telegram runs
  3. Short-circuiting the request builder before HTTP calls are made
  4. Conflicting with the channel handler causing dual message processing

The LLM provider call is completely skipped (not failing at HTTP level), suggesting an early return or exception in the agent run preparation phase.

Related Issues

Additional Context

  • Both Telegram channel and plugin should NOT need to be enabled simultaneously - unclear from docs what the intended behavior is
  • Plugin appears to handle message reception, but breaks LLM invocation
  • Channel-only mode works for message reception (messages appear in webchat), but replies don't route back to Telegram

Impact

  • Telegram integration is completely non-functional when plugin is enabled
  • Users cannot receive responses via Telegram
  • Creates confusion about correct configuration (channel vs. plugin vs. both)

Request

Please investigate:

  1. Is having both channels.telegram and plugins.telegram enabled a supported configuration?
  2. Why does messageChannel=telegram prevent LLM provider calls?
  3. Should the plugin be deprecated in favor of channel-only mode?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingstaleMarked as stale due to inactivity

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions