← Back to PRs

#19717: fix: load plugin registry before channel commands run

by MisterGuy420 open 2026-02-18 03:44 View on GitHub →
cli size: XS trusted-contributor
Fixes #19697 ## What changed Added `ensurePluginRegistryLoaded()` call in the `runChannelsCommand` function in `src/cli/channels-cli.ts`. This ensures the plugin registry is loaded before running any channel commands (like `channels add`), which allows Discord and other extension-based channels to be properly discovered and registered. ## AI-assisted contribution This fix was generated by an AI agent (OpenClaw cron: gh-issues-fix) - Testing depth: validated with pnpm build && pnpm check && pnpm test - The fix addresses the root cause described in the issue by ensuring the plugin registry is initialized before channel lookups occur <!-- greptile_comment --> <h3>Greptile Summary</h3> This PR adds a defensive `ensurePluginRegistryLoaded()` call in `runChannelsCommand` so the plugin registry is guaranteed to be loaded before channel subcommands execute. This is a belt-and-suspenders fix — the preAction hook in `src/cli/program/preaction.ts` already loads the registry for all `channels` commands via `PLUGIN_REQUIRED_COMMANDS`. The idempotency guard in `ensurePluginRegistryLoaded()` makes the duplicate call harmless. - The fix applies only to `runChannelsCommand` but misses `runChannelsCommandWithDanger` (used by `login`/`logout`), which similarly depends on the plugin registry for extension-based channels. - The overall change is low-risk due to the existing preAction coverage and the idempotency guard. <h3>Confidence Score: 4/5</h3> - This PR is safe to merge — the change is idempotent and redundant with existing preAction coverage, making it low-risk. - The added call is guarded by an idempotency check and the preAction hook already ensures plugin loading for all channels commands. The only concern is the inconsistency with `runChannelsCommandWithDanger`, but it's not a runtime issue due to the existing preAction hook. - src/cli/channels-cli.ts — `runChannelsCommandWithDanger` should also call `ensurePluginRegistryLoaded()` for consistency. <sub>Last reviewed commit: e6a59d5</sub> <!-- greptile_other_comments_section --> **Context used:** - Context from `dashboard` - CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8)) - Context from `dashboard` - AGENTS.md ([source](https://app.greptile.com/review/custom-context?memory=0d0c8278-ef8e-4d6c-ab21-f5527e322f13)) <!-- /greptile_comment -->

Most Similar PRs