Skip to content

Commit 54ec784

Browse files
authored
fix feishu conflict (#850)
1 parent 03c4098 commit 54ec784

File tree

2 files changed

+28
-18
lines changed

2 files changed

+28
-18
lines changed

electron/utils/channel-config.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,9 @@ async function ensurePluginAllowlist(currentConfig: OpenClawConfig, channelType:
411411
allow: [feishuPluginId],
412412
enabled: true,
413413
entries: {
414-
[feishuPluginId]: { enabled: true }
414+
[feishuPluginId]: { enabled: true },
415+
// Disable the built-in feishu plugin when using openclaw-lark
416+
...(feishuPluginId !== 'feishu' ? { feishu: { enabled: false } } : {}),
415417
}
416418
};
417419
} else {
@@ -432,8 +434,15 @@ async function ensurePluginAllowlist(currentConfig: OpenClawConfig, channelType:
432434
if (!currentConfig.plugins.entries) {
433435
currentConfig.plugins.entries = {};
434436
}
435-
// Remove conflicting feishu entries; keep only the resolved plugin id.
436-
delete currentConfig.plugins.entries['feishu'];
437+
// Remove conflicting feishu plugin entries; keep only the resolved plugin id.
438+
// When the resolved plugin id is NOT 'feishu', explicitly disable the
439+
// built-in feishu plugin (OpenClaw ships one in dist/extensions/feishu/)
440+
// to prevent it from conflicting with the official openclaw-lark plugin.
441+
if (feishuPluginId !== 'feishu') {
442+
currentConfig.plugins.entries['feishu'] = { enabled: false };
443+
} else {
444+
delete currentConfig.plugins.entries['feishu'];
445+
}
437446
for (const candidateId of FEISHU_PLUGIN_ID_CANDIDATES) {
438447
if (candidateId !== feishuPluginId) {
439448
delete currentConfig.plugins.entries[candidateId];

electron/utils/openclaw-auth.ts

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1665,29 +1665,30 @@ export async function sanitizeOpenClawConfig(): Promise<void> {
16651665
}
16661666

16671667

1668-
// ── Remove bare 'feishu' when canonical feishu plugin is present ──
1669-
// The Gateway binary automatically adds bare 'feishu' to plugins.allow
1670-
// because the official plugin registers the 'feishu' channel.
1671-
// However, there's no plugin with id='feishu', so Gateway validation
1672-
// fails with "plugin not found: feishu". Remove it from allow[] and
1673-
// disable the entries.feishu entry to prevent Gateway from re-adding it.
1668+
// ── Disable built-in 'feishu' when official openclaw-lark plugin is active ──
1669+
// OpenClaw ships a built-in 'feishu' extension in dist/extensions/feishu/
1670+
// that conflicts with the official @larksuite/openclaw-lark plugin
1671+
// (id: 'openclaw-lark'). When the canonical feishu plugin is NOT the
1672+
// built-in 'feishu' itself, we must:
1673+
// 1. Remove bare 'feishu' from plugins.allow
1674+
// 2. Always set plugins.entries.feishu = { enabled: false } to explicitly
1675+
// disable the built-in — it loads automatically unless disabled.
16741676
const allowArr2 = Array.isArray(pluginsObj.allow) ? pluginsObj.allow as string[] : [];
16751677
const hasCanonicalFeishu = allowArr2.includes(canonicalFeishuId) || !!pEntries[canonicalFeishuId];
1676-
if (hasCanonicalFeishu) {
1678+
if (hasCanonicalFeishu && canonicalFeishuId !== 'feishu') {
16771679
// Remove bare 'feishu' from plugins.allow
16781680
const bareFeishuIdx = allowArr2.indexOf('feishu');
16791681
if (bareFeishuIdx !== -1) {
16801682
allowArr2.splice(bareFeishuIdx, 1);
1681-
console.log('[sanitize] Removed bare "feishu" from plugins.allow (feishu plugin is configured)');
1683+
console.log('[sanitize] Removed bare "feishu" from plugins.allow (openclaw-lark plugin is configured)');
16821684
modified = true;
16831685
}
1684-
// Disable bare 'feishu' in plugins.entries so Gateway won't re-add it
1685-
if (pEntries.feishu) {
1686-
if (pEntries.feishu.enabled !== false) {
1687-
pEntries.feishu.enabled = false;
1688-
console.log('[sanitize] Disabled bare plugins.entries.feishu (feishu plugin is configured)');
1689-
modified = true;
1690-
}
1686+
// Always ensure the built-in feishu plugin is explicitly disabled.
1687+
// Built-in extensions load automatically unless plugins.entries.<id>.enabled = false.
1688+
if (!pEntries.feishu || pEntries.feishu.enabled !== false) {
1689+
pEntries.feishu = { ...(pEntries.feishu || {}), enabled: false };
1690+
console.log('[sanitize] Disabled built-in feishu plugin (openclaw-lark plugin is configured)');
1691+
modified = true;
16911692
}
16921693
}
16931694

0 commit comments

Comments
 (0)