mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 20:40:43 +00:00
fix: recover subagent waits after transport drops
Fix subagent recovery and session state reconciliation. Thanks @ZiPengWei.
This commit is contained in:
@@ -892,6 +892,33 @@ describe("normalizeFeishuTarget", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("feishuPlugin.messaging.resolveDeliveryTarget", () => {
|
||||
it("routes direct conversations to user targets", () => {
|
||||
expect(
|
||||
feishuPlugin.messaging?.resolveDeliveryTarget?.({
|
||||
conversationId: "ou_123",
|
||||
}),
|
||||
).toEqual({ to: "user:ou_123" });
|
||||
});
|
||||
|
||||
it("routes group conversations to chat targets", () => {
|
||||
expect(
|
||||
feishuPlugin.messaging?.resolveDeliveryTarget?.({
|
||||
conversationId: "oc_123",
|
||||
}),
|
||||
).toEqual({ to: "chat:oc_123" });
|
||||
});
|
||||
|
||||
it("routes topic conversations to parent chat plus thread id", () => {
|
||||
expect(
|
||||
feishuPlugin.messaging?.resolveDeliveryTarget?.({
|
||||
conversationId: "oc_123:topic:omt_456",
|
||||
parentConversationId: "oc_123",
|
||||
}),
|
||||
).toEqual({ to: "chat:oc_123", threadId: "omt_456" });
|
||||
});
|
||||
});
|
||||
|
||||
describe("looksLikeFeishuId", () => {
|
||||
it("accepts provider-prefixed user targets", () => {
|
||||
expect(looksLikeFeishuId("feishu:user:ou_123")).toBe(true);
|
||||
|
||||
@@ -1134,6 +1134,20 @@ export const feishuPlugin: ChannelPlugin<ResolvedFeishuAccount, FeishuProbeResul
|
||||
setupWizard: feishuSetupWizard,
|
||||
messaging: {
|
||||
normalizeTarget: (raw) => normalizeFeishuTarget(raw) ?? undefined,
|
||||
resolveDeliveryTarget: ({ conversationId, parentConversationId }) => {
|
||||
const directId = parseFeishuDirectConversationId(conversationId);
|
||||
if (directId) {
|
||||
return { to: `user:${directId}` };
|
||||
}
|
||||
const parsed = parseFeishuConversationId({ conversationId, parentConversationId });
|
||||
if (parsed?.topicId) {
|
||||
return {
|
||||
to: `chat:${parentConversationId?.trim() || parsed.chatId}`,
|
||||
threadId: parsed.topicId,
|
||||
};
|
||||
}
|
||||
return { to: `chat:${parsed?.chatId ?? conversationId.trim()}` };
|
||||
},
|
||||
resolveSessionConversation: ({ kind, rawId }) =>
|
||||
resolveFeishuSessionConversation({ kind, rawId }),
|
||||
resolveOutboundSessionRoute: (params) => resolveFeishuOutboundSessionRoute(params),
|
||||
|
||||
Reference in New Issue
Block a user