Fix doctor bundled runtime dependency ordering#69896
Conversation
🔒 Aisle Security AnalysisWe found 1 potential security issue(s) in this PR:
1. 🔵 Channel doctor silently skips configured plugins when plugin discovery throws (broad exception swallowing)
DescriptionSeveral Impact:
Vulnerable code: function safeGetLoadedChannelPlugin(id: string) {
try {
return getLoadedChannelPlugin(id);
} catch {
return undefined;
}
}
function safeListReadOnlyChannelPlugins(cfg: OpenClawConfig) {
try {
return resolveReadOnlyChannelPluginsForConfig(cfg, {
includePersistedAuthState: false,
}).plugins;
} catch {
return [];
}
}RecommendationDo not silently ignore plugin discovery failures during doctor runs. Options (in increasing strictness):
Example (log + propagate warning): function safeGetLoadedChannelPlugin(id: string, warnings: string[]) {
try {
return getLoadedChannelPlugin(id);
} catch (err) {
warnings.push(`Failed to load channel plugin '${id}' for doctor: ${String(err)}`);
return undefined;
}
}Also consider catching only expected error types and rethrowing unknown ones. Analyzed PR: #69896 at commit Last updated on: 2026-04-22T01:22:53Z |
Greptile SummaryThis PR fixes the ordering of doctor checks so that configured channel doctor logic runs against lightweight read-only/setup adapters rather than full bundled channel runtimes, allowing bundled runtime-dep repair to execute before any full runtime import is attempted. The fallback chain ( Confidence Score: 5/5Safe to merge — the ordering fix is well-scoped, correctly tested, and all call sites are updated consistently. All findings are P2 or lower. The logic correctly threads the new read-only-first path through every caller of listChannelDoctorEntries that has access to a config, and the two allowlist helpers that lack a config still avoid full-runtime loading via the setup-plugin fallback. No files require special attention. Reviews (1): Last reviewed commit: "document doctor runtime dep fix" | Re-trigger Greptile |
There was a problem hiding this comment.
Pull request overview
Updates the doctor channel adapter selection to avoid importing full bundled channel runtimes before bundled dependency repair can run, while documenting the ordering invariant.
Changes:
- Switch configured-channel doctor checks to prefer read-only/setup channel adapters (and make adapter lookup failures non-fatal).
- Update channel-doctor compatibility mutation tests to cover the new adapter resolution behavior and failure mode.
- Document the invariant in the doctor docs and add a changelog entry.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/commands/doctor/shared/channel-doctor.ts | Uses read-only/setup adapters for configured channel doctor checks and makes adapter lookup failures non-fatal. |
| src/commands/doctor/shared/channel-doctor.test.ts | Adjusts mocks and adds coverage for read-only adapter usage and non-fatal lookup failures. |
| docs/gateway/doctor.md | Documents the doctor ordering invariant (setup/read-only adapters before bundled runtime dependency checks). |
| CHANGELOG.md | Adds an entry describing the doctor/plugins ordering fix. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 66bca9d060
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 086d58aff3
ℹ️ 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".
| const bundledSetupPlugin = safeGetBundledChannelSetupPlugin(id); | ||
| return bundledSetupPlugin ? [bundledSetupPlugin] : []; |
There was a problem hiding this comment.
Fall back to runtime doctor when setup adapter has no doctor
The selected-channel fallback now stops at getBundledChannelSetupPlugin(id), which means channels whose setup plugin omits doctor silently lose all doctor hooks when they are not already loaded. This is observable for bundled channels like extensions/bluebubbles/src/channel.setup.ts and extensions/mattermost/src/channel.setup.ts (no doctor) while their runtime plugins still provide doctor adapters (extensions/bluebubbles/src/channel.ts:100, extensions/mattermost/src/channel.ts:288). In fresh packaged installs (where runtime loading may fail before dependency repair), channel compatibility and warning/repair logic for those channels is skipped instead of running.
Useful? React with 👍 / 👎.
Summary
Tests
pnpm test src/commands/doctor/shared/channel-doctor.test.tspnpm format:check src/commands/doctor/shared/channel-doctor.ts src/commands/doctor/shared/channel-doctor.test.ts docs/gateway/doctor.mdpnpm check:changedscripts/committer 'fix doctor channel runtime dep ordering' ...reran stagedpnpm check:changed --staged