bug: Studio-created Feishu connections use user_key, but trusted mode with root_api_key requires root_key, all retrieval tools return Invalid API Key
Summary
When server.auth_mode = trusted and server.root_api_key is configured, all OpenViking retrieval tools (openviking_search, openviking_grep, openviking_list, etc.) invoked through a Studio-created Feishu connection return:
Invalid API Key in trusted mode with Root API Key enabled.Root cause
Studio persists a user-level identity. When a Feishu connection is created via Studio (bot/vikingbot/studio/service.py:55-77), the record stores identity whose api_key is a user_key, and api_key_type defaults to user (see ov_server.py:173).
StudioFeishuChannel builds the VikingClient from that identity (bot/vikingbot/studio/providers/feishu/channel.py:165-166): client = await VikingClient.create(connection=self.record["identity"], ...) So retrieval tools authenticate with the user_key.
Trusted mode with root_api_key rejects anything that is not the root_key (openviking/server/auth/plugins/trusted.py:124-134): if configured_root_api_key: if not hmac.compare_digest(api_key, configured_root_api_key): raise UnauthenticatedError("Invalid API Key in trusted mode with Root API Key enabled.") The user_key fails hmac.compare_digest against root_api_key, so every retrieval call is rejected.
Question
Is this a bug (Studio connections should store the root_key, or ov_server should resolve the appropriate key type for trusted mode), or is it by design that trusted mode with root_api_key does not currently support Studio-created Feishu connections?
Expected behavior
One of:
- Studio-created connections should use api_key_type = root when the server is in trusted + root_key mode; or
- TrustedAuthPlugin should accept a valid user_key via APIKeyManager even when root_api_key is configured; or
- Documented as unsupported with a clear error message guiding the user to switch to api_key mode or disable root_api_key.
Reproduction
- Configure server.auth_mode = trusted and set server.root_api_key.
- Start openviking-server --with-bot.
- Onboard a Feishu connection via Studio (scan QR or manual).
- In the Feishu group, @mention the bot and trigger any retrieval tool.
- Observe Invalid API Key on every tool call.
Environment
- OpenViking v0.4.22 (commit e871676)
- Relevant code:
- openviking/server/auth/plugins/trusted.py:124-134
- bot/vikingbot/openviking_mount/ov_server.py:173
- bot/vikingbot/studio/providers/feishu/channel.py:165-166
- bot/vikingbot/studio/service.py:55-77
Source: volcengine/OpenViking