Repository navigation
Bug: Bot (Feishu/Telegram/WeCom) sessions fail with 机器人对话处理失败: runtime host rejects explore sessions without a declared mode #4193
Description
Body
Summary
When a user messages the Feishu bot, the bot always replies Maka 暂时无法处理这条消息:机器人对话处理失败 ("Maka cannot process this message: bot conversation processing failed"). The platform connection itself is healthy (the message is received over the long-connection and the error reply is delivered), but no session is ever created in the runtime database.
Environment
- App: Maka desktop (packaged macOS app, arm64), version 0.2.0 (CHANGELOG marks 0.2.0 as "Unreleased")
- Electron 43.4.1 / Node 24.18.1 / Chrome 150.0.7871.224
- Bot platform tested: Feishu (
@larksuiteoapi/node-sdkwebsocket long-connection) - macOS 26.6
Root cause
-
The desktop bot session adapter (
dist/main/runtime-host-bot-session-adapter.js,createRuntimeHostBotSessionAdapter.createSession) creates bot sessions with:deps.client.createSession({ sessionId, workspace: target.workspace, name: input.name, labels: [...input.labels], // e.g. ['bot', 'feishu'] modelTarget: { kind: 'default' }, permissionMode: 'explore', // ← no `mode` is passed });
-
The runtime host's session catalog
prepareCreate(packages/runtime-host/src/server/session-catalog-coordinator.ts) added a new requirement:const mode = input.mode === undefined ? undefined : sessionStartModeSpec(input.mode); if (mode === undefined && input.permissionMode === 'explore') { throw new SessionOperationFailure('invalid_request', 'Session creation requires a declared mode for explore permission'); }
The bot adapter passes
permissionMode: 'explore'but never passesmode, so every bot session creation throws. -
The thrown message
Session creation requires a declared mode for explore permissiondoes not match any category ingeneralizedErrorMessage(timeout / rate-limit / 401 / 403 / 5xx / network), so the bot surfaces the generic fallback机器人对话处理失败— making it look like a Feishu/connection/credentials problem during debugging. -
Desktop chat sessions are unaffected because they use
permissionMode: 'ask'(fromchatDefaults.permissionMode), which does not trigger the check. Only bot sessions (hardcoded toexplore) hit it.
Impact
- All bot channels that create sessions with
permissionMode: 'explore'cannot start conversations. - The bot shows a healthy connection (message received, reply sent) but every conversation attempt fails with the generic error; no session appears in the runtime DB.
SESSION_START_MODE_SPECScurrently only definesdeep_research, so there is no validmodea bot could pass to satisfy the check anyway.
Suggested fix (pick one)
-
A (recommended): Exempt bot-labeled sessions in
prepareCreate, since bots are intentionally read-only/explore:if (mode === undefined && input.permissionMode === 'explore' && !(input.labels?.includes('bot'))) {
-
B: Make the bot session adapter pass a declared
mode(e.g., add a properbot/exploreentry toSESSION_START_MODE_SPECSand pass it increateSession).
Verified workaround
Locally patched option A into the packaged app's app.asar (runtime-host session-catalog-coordinator.js); the Feishu bot then created sessions and replied correctly. This confirms the diagnosis.
Reproduction steps
- Configure a bot channel (e.g., Feishu app with websocket long-connection) and enable it.
- Send a message to the bot.
- Observe the bot replying
Maka 暂时无法处理这条消息:机器人对话处理失败. - In the runtime DB, no session row is created for the bot conversation.
Expected behavior
Bot messages create a session and receive a normal agent reply (as they did before the mode requirement was introduced).
Activity
[-]Bot (Feishu/Telegram/WeCom) sessions fail with 机器人对话处理失败: runtime host rejects explore sessions without a declared mode[/-][+]Bug: Bot (Feishu/Telegram/WeCom) sessions fail with 机器人对话处理失败: runtime host rejects explore sessions without a declared mode[/+]ser163 commentedon Aug 29, 2026
Closed: 将改用 Bug 报告表单重新提交以自动附加
bug标签(API 创建无法打标签)。fix(desktop): declare a mode for Bot sessions