← Back to PRs

#14795: fix: skip disabled channel plugins in cross-context messaging checks

by explainanalyze open 2026-02-12 16:58 View on GitHub →
stale size: S
## Problem Fixes #14769 The `message` tool reports `Cross-context messaging denied: action=send target provider "telegram" while bound to "whatsapp"` even when the WhatsApp plugin is `enabled: false` in config. This prevents agents from sending messages to Telegram from sessions that have a stale whatsapp binding. ## Root Cause `resolveGatewayMessageChannel` and `normalizeMessageChannel` in `src/utils/message-channel.ts` did not check whether a channel's plugin was actually enabled. A disabled plugin (e.g. whatsapp with `enabled: false`) was still resolved as a valid channel, causing the cross-context check to bind the session to a non-functional channel. ## Fix - Added `isDisabledPluginChannel()` helper that checks the plugin registry for disabled status - `normalizeMessageChannel()` now returns `undefined` for disabled channel plugins - Added `isGatewayMessageChannelEnabled()` check in `resolveGatewayMessageChannel()` Three layers of defense ensure disabled plugins are never considered for channel binding. ## Tests - Added regression test in `src/utils/message-channel.test.ts` that creates a disabled whatsapp plugin record and asserts `resolveGatewayMessageChannel("whatsapp")` returns `undefined` - Test fails on `main` (confirms it catches the bug), passes with the fix - All existing message-channel tests continue to pass <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR adds a disabled-plugin guard when resolving gateway message channels (`resolveGatewayMessageChannel`) by consulting the active plugin registry’s `plugins` list and rejecting channels whose corresponding `PluginRecord.enabled` is `false`. It also adds a unit test intended to prevent binding sessions to disabled channel plugins. The main issue is that the new regression test doesn’t currently exercise the bug scenario: with `registry.channels` empty, `"whatsapp"` isn’t considered a valid gateway/deliverable channel at all, so `resolveGatewayMessageChannel("whatsapp")` returns `undefined` regardless of the new enabled-check. The test should include a `registry.channels` entry for the whatsapp channel while marking the plugin record disabled, so it would fail on `main` and pass with this change. <h3>Confidence Score: 3/5</h3> - This PR is likely safe, but the added test does not currently validate the intended regression scenario. - The runtime change is small and scoped to gateway-channel resolution, but the accompanying test would pass even without the fix because the registry setup doesn’t make the disabled plugin a valid deliverable/gateway channel. Fixing the test to cover the real scenario would increase confidence. - src/utils/message-channel.test.ts <!-- greptile_other_comments_section --> <sub>(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!</sub> <!-- /greptile_comment -->

Most Similar PRs