π fix: channel reliability β init errors, enabled flag, typed constants#76
π fix: channel reliability β init errors, enabled flag, typed constants#76
Conversation
A bad bot token (e.g. Telegram 404) no longer kills the whole server. Each channel now logs a warning and is skipped on init failure, letting the admin panel and other channels start normally.
The Save button lives inside x-show="enabled", so disabling a channel hid the form before the user could click Save. Now the Enable toggle calls saveChannel() immediately so the disabled state is persisted.
Two bugs fixed: - loadChannelConfig now returns nil for disabled channels, so they are skipped at startup (enabled=false was previously ignored) - admin.Server now holds a stop-function registry; updateChannel calls Stop() on the running channel when enabled is set to false via the UI
Added Platform* constants to internal/channel/model.go and replaced all
bare string literals ("telegram", "qq", "feishu", "weixin", "cli") across
channel packages, admin handlers, and gateway.
There was a problem hiding this comment.
π‘ Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 81d3181d7a
βΉοΈ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with π.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| return | ||
| } | ||
| if !ch.Enabled { | ||
| s.stopChannel(platform) |
There was a problem hiding this comment.
Treat manual channel stops as non-fatal in server loop
Calling s.stopChannel(platform) when a channel is disabled now invokes each bot's Stop(), but runServer still treats any non-nil Start return as a fatal error. For QQ, Feishu, and Weixin, Stop() cancels an internal context and Start() returns context.Canceled, so disabling one of these channels through /api/channels/{platform} will cause the errgroup to fail and shut down the whole server instead of only stopping that channel.
Useful? React with πΒ / π.
π Coverage ReportTotal coverage: 44.5% Per-package breakdown |
β¦ts (#76) * π fix: degrade channel init errors to warnings so app keeps running A bad bot token (e.g. Telegram 404) no longer kills the whole server. Each channel now logs a warning and is skipped on init failure, letting the admin panel and other channels start normally. * π fix: auto-save channel enabled state when toggling Enable The Save button lives inside x-show="enabled", so disabling a channel hid the form before the user could click Save. Now the Enable toggle calls saveChannel() immediately so the disabled state is persisted. * π fix: make channel enabled flag actually stop channels Two bugs fixed: - loadChannelConfig now returns nil for disabled channels, so they are skipped at startup (enabled=false was previously ignored) - admin.Server now holds a stop-function registry; updateChannel calls Stop() on the running channel when enabled is set to false via the UI * β»οΈ refactor: replace channel name string literals with typed constants Added Platform* constants to internal/channel/model.go and replaced all bare string literals ("telegram", "qq", "feishu", "weixin", "cli") across channel packages, admin handlers, and gateway.
Summary
x-show="enabled", so disabling a channel couldn't be persisted)enabledflag actually stop running channels βloadChannelConfignow returns nil for disabled channels;admin.Serverholds a stop-function registry and callsStop()when a channel is disabled via the UI"telegram","qq","feishu","weixin","cli") withPlatform*typed constants across channel packages, admin handlers, and gatewayTest plan