Skip to content

Commit 7c41695

Browse files
100menotu001clawsweeper[bot]Takhoffman
authored
fix(feishu): return subagent thread delivery origin (#83190)
Summary: - The PR returns a Feishu/Lark deliveryOrigin from subagent_spawning after successful thread-bound session binding, adds DM/topic/sender-scoped topic hook assertions, and adds a changelog entry. - Reproducibility: yes. by source inspection. Current main's Feishu subagent_spawning hook binds the child con ... eneric session-spawn path only directly routes the initial child run when result.deliveryOrigin is present. Automerge notes: - PR branch already contained follow-up commit before automerge: fix(feishu): return subagent thread delivery origin Validation: - ClawSweeper review passed for head 44a6200. - Required merge gates passed before the squash merge. Prepared head SHA: 44a6200 Review: #83190 (comment) Co-authored-by: OpenClaw Contributor <100menotu001@users.noreply.github.com> Co-authored-by: clawsweeper <274271284+clawsweeper[bot]@users.noreply.github.com> Approved-by: takhoffman Co-authored-by: takhoffman <781889+takhoffman@users.noreply.github.com>
1 parent 59b85d4 commit 7c41695

3 files changed

Lines changed: 47 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Docs: https://docs.openclaw.ai
2727

2828
### Fixes
2929

30+
- Feishu: return bound subagent delivery origins from session thread setup so Feishu subagent completions route back to the same DM or topic. (#83190) Thanks @100menotu001.
3031
- CLI/update: tailor post-update Gateway recovery hints by platform, showing systemd, LaunchAgent, Scheduled Task, or generic service-manager guidance instead of macOS-only recovery text. (#83096) Thanks @rubencu.
3132
- Plugins: apply a default 15-second timeout to legacy `before_agent_start` hooks so hung plugin handlers no longer block agent startup. Fixes #48534. (#83136) Thanks @therahul-yo.
3233
- Feishu: refresh inbound session delivery context for DM, group, and broadcast turns so later replies do not inherit stale WebChat routing. Fixes #78274.

extensions/feishu/src/subagent-hooks.test.ts

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,15 @@ describe("feishu subagent hook handlers", () => {
5454
{},
5555
);
5656

57-
expect(result).toEqual({ status: "ok", threadBindingReady: true });
57+
expect(result).toEqual({
58+
status: "ok",
59+
threadBindingReady: true,
60+
deliveryOrigin: {
61+
channel: "feishu",
62+
accountId: "work",
63+
to: "user:ou_sender_1",
64+
},
65+
});
5866

5967
const deliveryTargetHandler = getRequiredHookHandler(handlers, "subagent_delivery_target");
6068
await expect(
@@ -141,7 +149,16 @@ describe("feishu subagent hook handlers", () => {
141149
{},
142150
);
143151

144-
expect(result).toEqual({ status: "ok", threadBindingReady: true });
152+
expect(result).toEqual({
153+
status: "ok",
154+
threadBindingReady: true,
155+
deliveryOrigin: {
156+
channel: "feishu",
157+
accountId: "work",
158+
to: "chat:oc_group_chat",
159+
threadId: "om_topic_root",
160+
},
161+
});
145162
await expect(
146163
deliveryHandler(
147164
{
@@ -204,7 +221,16 @@ describe("feishu subagent hook handlers", () => {
204221
},
205222
);
206223

207-
expect(reboundResult).toEqual({ status: "ok", threadBindingReady: true });
224+
expect(reboundResult).toEqual({
225+
status: "ok",
226+
threadBindingReady: true,
227+
deliveryOrigin: {
228+
channel: "feishu",
229+
accountId: "work",
230+
to: "chat:oc_group_chat",
231+
threadId: "om_topic_root",
232+
},
233+
});
208234
const childBindings = manager.listBySessionKey("agent:main:subagent:sender-child");
209235
expect(childBindings).toHaveLength(1);
210236
expect(childBindings[0]?.conversationId).toBe(

extensions/feishu/src/subagent-hooks.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,16 @@ type FeishuSubagentEndedEvent = {
270270
};
271271

272272
type FeishuSubagentSpawningResult =
273-
| { status: "ok"; threadBindingReady?: boolean }
273+
| {
274+
status: "ok";
275+
threadBindingReady?: boolean;
276+
deliveryOrigin?: {
277+
channel: "feishu";
278+
accountId?: string;
279+
to?: string;
280+
threadId?: string | number;
281+
};
282+
}
274283
| { status: "error"; error: string }
275284
| undefined;
276285

@@ -347,6 +356,13 @@ export async function handleFeishuSubagentSpawning(
347356
return {
348357
status: "ok" as const,
349358
threadBindingReady: true,
359+
deliveryOrigin: resolveFeishuDeliveryOrigin({
360+
conversationId: binding.conversationId,
361+
parentConversationId: binding.parentConversationId,
362+
accountId: binding.accountId,
363+
deliveryTo: binding.deliveryTo,
364+
deliveryThreadId: binding.deliveryThreadId,
365+
}),
350366
};
351367
} catch (err) {
352368
return {

0 commit comments

Comments
 (0)