Bug Description
When triggering /new from Feishu (via native Feishu message), the session reply appears in the web UI dashboard instead of being delivered back to the Feishu conversation.
Steps to reproduce:
- Have OpenClaw configured with Feishu channel
- From a Feishu DM, send
/new
- The new session greeting appears in web UI, not in Feishu
Expected behavior:
The /new session should respect the Feishu delivery context and reply back to the Feishu conversation.
Actual behavior:
The reply is delivered to the web UI dashboard, completely missing the Feishu channel.
Root Cause Analysis
After examining the gateway source code (gateway-cli-DzTv3_FS.js), the issue is in how new sessions are created:
1. Session creation clears deliveryContext
When isNewSession = true, the gateway explicitly clears all delivery context (lines ~1321-1332):
...isNewSession && {
lastChannel: void 0,
lastTo: void 0,
lastAccountId: void 0,
lastThreadId: void 0,
deliveryContext: void 0 // ← cleared
}
2. No channel hint passed to session resolution
resolveExplicitAgentSessionKey does not use the channel hint from the incoming request. It directly returns agent:main:main regardless of whether the request came from Feishu, Telegram, etc.
3. Routing decision fails
resolveChatSendOriginatingRoute (around line 11847) uses:
const routeChannelCandidate = normalizeMessageChannel(
params.entry?.deliveryContext?.channel ?? params.entry?.lastChannel
);
When both are void 0, routeChannelCandidate is undefined, causing:
return {
originatingChannel: INTERNAL_MESSAGE_CHANNEL, // "internal"
explicitDeliverRoute: false
};
Reply goes to internal webchat instead of Feishu.
Related Issues / Similar Fixes
This is similar to #48204 (Telegram/DM topic session keys), which was fixed in 2026.3.22:
Telegram/DM topic session keys: route named-account DM topics through the same per-account base session key across inbound messages, native commands, and session-state lookups so /status and thread recovery stop creating phantom sessions.
And #47797 (Control UI/session routing):
Control UI/session routing: preserve established external delivery routes when webchat views or sends in externally originated sessions.
The same pattern should apply to Feishu /new commands.
Environment
- OpenClaw version: 2026.3.23
- Channel: Feishu (websocket mode)
- OS: macOS
- Node: v25.6.0
Suggested Fix
When creating a new session from a channel-specific context (Feishu DM), the gateway should:
- Preserve the
deliveryContext from the incoming message when creating the new session
- OR derive the session shape from the channel hint (e.g.,
agent:main:feishu:direct:ou_xxx for Feishu DMs)
- Ensure
resolveChatSendOriginatingRoute can find the Feishu delivery target
The /new command handler should inherit the channel context from the message that triggered it.
Bug Description
When triggering
/newfrom Feishu (via native Feishu message), the session reply appears in the web UI dashboard instead of being delivered back to the Feishu conversation.Steps to reproduce:
/newExpected behavior:
The
/newsession should respect the Feishu delivery context and reply back to the Feishu conversation.Actual behavior:
The reply is delivered to the web UI dashboard, completely missing the Feishu channel.
Root Cause Analysis
After examining the gateway source code (gateway-cli-DzTv3_FS.js), the issue is in how new sessions are created:
1. Session creation clears deliveryContext
When
isNewSession = true, the gateway explicitly clears all delivery context (lines ~1321-1332):2. No channel hint passed to session resolution
resolveExplicitAgentSessionKeydoes not use thechannelhint from the incoming request. It directly returnsagent:main:mainregardless of whether the request came from Feishu, Telegram, etc.3. Routing decision fails
resolveChatSendOriginatingRoute(around line 11847) uses:When both are
void 0,routeChannelCandidateis undefined, causing:Reply goes to internal webchat instead of Feishu.
Related Issues / Similar Fixes
This is similar to #48204 (Telegram/DM topic session keys), which was fixed in 2026.3.22:
And #47797 (Control UI/session routing):
The same pattern should apply to Feishu
/newcommands.Environment
Suggested Fix
When creating a new session from a channel-specific context (Feishu DM), the gateway should:
deliveryContextfrom the incoming message when creating the new sessionagent:main:feishu:direct:ou_xxxfor Feishu DMs)resolveChatSendOriginatingRoutecan find the Feishu delivery targetThe
/newcommand handler should inherit the channel context from the message that triggered it.