Skip to content

feat(gateway): lazy-load channel plugins with opt-out config #65444

Description

@andyk-ms

Problem

Gateway startup takes ~50 seconds on Windows. Profiling shows all channel plugins (Telegram, Discord x2, etc.) initialize simultaneously at boot, even if no messages are pending.

Proposal

Add a \channels.lazyConnect\ config option:

\\yaml
channels:
lazyConnect: true # default: true
\\

  • \ rue\ (default): Channel connects on first inbound/outbound message, not at boot. Gateway is
    eady\ once core is loaded; channels connect lazily.
  • **\ alse**: Current behaviour — all channels init at startup.

Expected Impact

  • 10-15s startup reduction on multi-channel setups
  • Particularly impactful on Windows where Node.js module loading is slower
  • First message per channel sees a ~1s connect delay (acceptable trade-off)

Implementation Notes

  • Channel plugin \init()\ should be split into
    egister()\ (immediate, sets up routing) and \connect()\ (deferred, establishes socket/API connection)
  • On first message route to a lazy channel, call \connect()\ then forward
  • Status endpoint should show channels as
    egistered\ vs \connected\

Environment

  • Windows 10, Node v24.14.0, OpenClaw 4.11
  • 3 channel plugins: Telegram + 2x Discord
  • Measured: 50s cold start → estimated 35s with lazy load

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:crash-loopCrash, hang, restart loop, or process-level availability failure.issue-rating: 🌊 off-meta tidepoolIssue quality rating does not apply to this item.staleMarked 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