fix feishu conflict (#850)

This commit is contained in:
paisley
2026-04-14 13:31:25 +08:00
committed by GitHub
Unverified
parent 03c40985e1
commit 54ec784545
2 changed files with 28 additions and 18 deletions

View File

@@ -411,7 +411,9 @@ async function ensurePluginAllowlist(currentConfig: OpenClawConfig, channelType:
allow: [feishuPluginId], allow: [feishuPluginId],
enabled: true, enabled: true,
entries: { entries: {
[feishuPluginId]: { enabled: true } [feishuPluginId]: { enabled: true },
// Disable the built-in feishu plugin when using openclaw-lark
...(feishuPluginId !== 'feishu' ? { feishu: { enabled: false } } : {}),
} }
}; };
} else { } else {
@@ -432,8 +434,15 @@ async function ensurePluginAllowlist(currentConfig: OpenClawConfig, channelType:
if (!currentConfig.plugins.entries) { if (!currentConfig.plugins.entries) {
currentConfig.plugins.entries = {}; currentConfig.plugins.entries = {};
} }
// Remove conflicting feishu entries; keep only the resolved plugin id. // Remove conflicting feishu plugin entries; keep only the resolved plugin id.
delete currentConfig.plugins.entries['feishu']; // When the resolved plugin id is NOT 'feishu', explicitly disable the
// built-in feishu plugin (OpenClaw ships one in dist/extensions/feishu/)
// to prevent it from conflicting with the official openclaw-lark plugin.
if (feishuPluginId !== 'feishu') {
currentConfig.plugins.entries['feishu'] = { enabled: false };
} else {
delete currentConfig.plugins.entries['feishu'];
}
for (const candidateId of FEISHU_PLUGIN_ID_CANDIDATES) { for (const candidateId of FEISHU_PLUGIN_ID_CANDIDATES) {
if (candidateId !== feishuPluginId) { if (candidateId !== feishuPluginId) {
delete currentConfig.plugins.entries[candidateId]; delete currentConfig.plugins.entries[candidateId];

View File

@@ -1665,29 +1665,30 @@ export async function sanitizeOpenClawConfig(): Promise<void> {
} }
// ── Remove bare 'feishu' when canonical feishu plugin is present ── // ── Disable built-in 'feishu' when official openclaw-lark plugin is active ──
// The Gateway binary automatically adds bare 'feishu' to plugins.allow // OpenClaw ships a built-in 'feishu' extension in dist/extensions/feishu/
// because the official plugin registers the 'feishu' channel. // that conflicts with the official @larksuite/openclaw-lark plugin
// However, there's no plugin with id='feishu', so Gateway validation // (id: 'openclaw-lark'). When the canonical feishu plugin is NOT the
// fails with "plugin not found: feishu". Remove it from allow[] and // built-in 'feishu' itself, we must:
// disable the entries.feishu entry to prevent Gateway from re-adding it. // 1. Remove bare 'feishu' from plugins.allow
// 2. Always set plugins.entries.feishu = { enabled: false } to explicitly
// disable the built-in — it loads automatically unless disabled.
const allowArr2 = Array.isArray(pluginsObj.allow) ? pluginsObj.allow as string[] : []; const allowArr2 = Array.isArray(pluginsObj.allow) ? pluginsObj.allow as string[] : [];
const hasCanonicalFeishu = allowArr2.includes(canonicalFeishuId) || !!pEntries[canonicalFeishuId]; const hasCanonicalFeishu = allowArr2.includes(canonicalFeishuId) || !!pEntries[canonicalFeishuId];
if (hasCanonicalFeishu) { if (hasCanonicalFeishu && canonicalFeishuId !== 'feishu') {
// Remove bare 'feishu' from plugins.allow // Remove bare 'feishu' from plugins.allow
const bareFeishuIdx = allowArr2.indexOf('feishu'); const bareFeishuIdx = allowArr2.indexOf('feishu');
if (bareFeishuIdx !== -1) { if (bareFeishuIdx !== -1) {
allowArr2.splice(bareFeishuIdx, 1); allowArr2.splice(bareFeishuIdx, 1);
console.log('[sanitize] Removed bare "feishu" from plugins.allow (feishu plugin is configured)'); console.log('[sanitize] Removed bare "feishu" from plugins.allow (openclaw-lark plugin is configured)');
modified = true; modified = true;
} }
// Disable bare 'feishu' in plugins.entries so Gateway won't re-add it // Always ensure the built-in feishu plugin is explicitly disabled.
if (pEntries.feishu) { // Built-in extensions load automatically unless plugins.entries.<id>.enabled = false.
if (pEntries.feishu.enabled !== false) { if (!pEntries.feishu || pEntries.feishu.enabled !== false) {
pEntries.feishu.enabled = false; pEntries.feishu = { ...(pEntries.feishu || {}), enabled: false };
console.log('[sanitize] Disabled bare plugins.entries.feishu (feishu plugin is configured)'); console.log('[sanitize] Disabled built-in feishu plugin (openclaw-lark plugin is configured)');
modified = true; modified = true;
}
} }
} }