#15671: fix(feishu): Credentials check bug of Feishu bitable tools when using multiple accounts configuration
channel: feishu
stale
size: XS
Cluster:
Feishu Integration Enhancements
## Problem
(A cleaner version of https://github.com/openclaw/openclaw/pull/15637)
When using the multiple accounts configuration described in [the documentation](https://docs.openclaw.ai/channels/feishu#multiple-accounts), the appId and appSecret are defined in the nested under accounts.main. Meanwhile, the [registration function of the bitable tools](https://github.com/openclaw/openclaw/blob/45b9aad0f4384ce16f99885f86a5dd7488638c47/extensions/feishu/src/bitable.ts#L314) checks that both feishuCfg?.appId and feishuCfg?.appSecret exist, which won't under the multi-accounts configuration.
This leads to the registration failure of the bitable tools described in extensions/feishu/src/bitable.ts, causing the agent to be unable to operate in any bitable in feishu.
## Fix
This pr fixes this by adding support to both single- and multi-accounts. When using a single-account configuration, the config is directly passed to createFeishuClient. When one of appId and appSecret is not found, it switches to the multi-accounts configuration and filters accounts with appId and appSecret checks, then use the cfg of the first account with credential to create feishu client.
## Related Issues
https://github.com/openclaw/openclaw/issues/15590
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR updates Feishu bitable tool registration to support both single-account configs (top-level `appId`/`appSecret`) and multi-account configs (credentials nested under `channels.feishu.accounts.*`). It does so by selecting either the top-level Feishu config or the first enabled+configured account returned by `listEnabledFeishuAccounts`, then using that config to create the Feishu client used by the bitable tools.
One issue to address before merge: in multi-account mode the chosen config omits `accountId`, which interacts poorly with `createFeishuClient`'s per-`accountId` cache and can lead to client cache collisions and wrong credentials being used.
<h3>Confidence Score: 4/5</h3>
- Mostly safe to merge, but fix the multi-account client cache collision first.
- Changes are localized to Feishu bitable tool registration and correctly add multi-account credential discovery, but multi-account mode currently drops `accountId`, which can cause `createFeishuClient` to reuse/overwrite the cached client under the default cache key and lead to incorrect credentials being used.
- extensions/feishu/src/bitable.ts
<sub>Last reviewed commit: c8675c1</sub>
<!-- 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
#19871: fix(feishu): support multi-account config in bitable tools
by linbojin · 2026-02-18
89.3%
#23261: fix(feishu): bitable tools fail to register with accounts config pa...
by stakeswky · 2026-02-22
86.8%
#16284: fix(feishu): route tool credentials by account parameter
by Yaxuan42 · 2026-02-14
86.3%
#16337: feat(feishu): sync community plugin updates from clawdbot-feishu v0...
by graydawnc · 2026-02-14
81.4%
#23255: fix(feishu): use listEnabledFeishuAccounts for bitable tool registr...
by SidQin-cyber · 2026-02-22
78.9%
#21484: fix(feishu): scope message deduplication by accountId to support mu...
by guanyu-zhang · 2026-02-20
76.1%
#14674: feat(feishu): add feishu_chat tool for chat info/member queries
by liuweifly · 2026-02-12
75.7%
#10309: fix: use group ID for peer.id in Feishu group messages
by ParsifalC · 2026-02-06
74.5%
#11304: feishu: cache bot info to reduce probe API calls (feishu set low qu...
by jasonthewhale · 2026-02-07
74.2%
#10513: feat(feishu): add quota optimization flags
by BigUncle · 2026-02-06
72.6%