fix(gateway): preserve route inheritance for legacy channel session keys (openclaw#33919) thanks @Takhoffman

Verified:
- pnpm build
- pnpm check
- pnpm test src/gateway/server-methods/chat.directive-tags.test.ts
- pnpm test:macmini

Co-authored-by: Takhoffman <781889+Takhoffman@users.noreply.github.com>
Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
This commit is contained in:
Tak Hoffman
2026-03-03 22:27:36 -06:00
committed by GitHub
parent f74a04e4ba
commit 8a7d1aa973
3 changed files with 73 additions and 1 deletions

View File

@@ -875,6 +875,8 @@ export const chatHandlers: GatewayRequestHandlers = {
const isChannelScopedSession = sessionPeerShapeCandidates.some((part) =>
CHANNEL_SCOPED_SESSION_SHAPES.has(part),
);
const hasLegacyChannelPeerShape =
!isChannelScopedSession && typeof sessionScopeParts[1] === "string";
// Only inherit prior external route metadata for channel-scoped sessions.
// Channel-agnostic sessions (main, direct:<peer>, etc.) can otherwise
// leak stale routes across surfaces.
@@ -882,7 +884,7 @@ export const chatHandlers: GatewayRequestHandlers = {
sessionChannelHint &&
sessionChannelHint !== INTERNAL_MESSAGE_CHANNEL &&
!isChannelAgnosticSessionScope &&
isChannelScopedSession,
(isChannelScopedSession || hasLegacyChannelPeerShape),
);
const hasDeliverableRoute =
canInheritDeliverableRoute &&