Skip to content

chore: add structured logging to channel connect/disconnect flows#1003

Merged
Siri-Ray merged 1 commit intomainfrom
chore/channel-connect-logging
Apr 10, 2026
Merged

chore: add structured logging to channel connect/disconnect flows#1003
Siri-Ray merged 1 commit intomainfrom
chore/channel-connect-logging

Conversation

@lefarcen
Copy link
Copy Markdown
Collaborator

@lefarcen lefarcen commented Apr 9, 2026

What

Add structured logging to all channel connect/disconnect operations across the controller.

Why

Channel connect failures (especially Telegram/Discord) were completely silent — proxyFetch timeouts or API errors were caught and returned as 409 JSON responses with zero controller log entries. This made it impossible to diagnose "channel won't connect" from user diagnostics exports.

Discovered while debugging a user report where Telegram/Discord appeared unconfigured despite the user claiming they had set them up.

How

Three files changed:

channel-service.ts — start/success/failure logs for all connect*() methods + disconnectChannel:

  • {slack,discord,telegram,feishu,qqbot,dingtalk,wecom}_connect_{start,success}
  • {slack,discord,telegram,feishu}_connect_verify_failed
  • channel_disconnect_{start,success,not_found}

channel-routes.tschannel_connect_error_<type> in all route catch blocks (covers proxyFetch network errors that throw before service-level logging).

channel-binding-compiler.tscompile_channels_summary log showing input count, compiled channel types with account counts, and skipped channels with skip reasons.

Affected areas

  • Controller channel service (all channel types)
  • Controller channel routes
  • Channel binding compiler

Checklist

  • Logging only, no behavior change
  • pnpm typecheck passes
  • pnpm lint passes
  • No credentials logged (bot tokens redacted)

Channel connect operations (Telegram, Discord, Slack, Feishu, QQ,
DingTalk, WeCom) previously had zero logging — if the upstream token
verification timed out or returned an error, the failure was silently
caught and returned as a 409 JSON response with no controller log entry.

This made it impossible to diagnose "channel won't connect" reports
from user diagnostics exports alone.

Changes:
- channel-service: add start/success/failure logs to all connect*()
  methods and disconnect flow
- channel-routes: add error logs to all route-level catch blocks
  (covers proxyFetch network errors that throw before service-level
  logging)
- channel-binding-compiler: add compile_channels_summary log showing
  which channel types were compiled vs skipped (with skip reason)
@sentry
Copy link
Copy Markdown

sentry Bot commented Apr 9, 2026

Codecov Report

❌ Patch coverage is 24.80620% with 97 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
apps/controller/src/services/channel-service.ts 8.82% 62 Missing ⚠️
apps/controller/src/routes/channel-routes.ts 3.44% 28 Missing ⚠️
...pps/controller/src/lib/channel-binding-compiler.ts 78.12% 7 Missing ⚠️

📢 Thoughts on this report? Let us know!

@Siri-Ray Siri-Ray merged commit 2632b3a into main Apr 10, 2026
15 checks passed
@lefarcen lefarcen mentioned this pull request Apr 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants