mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 07:30:43 +00:00
fix(hooks): fail open without thread ownership routing
This commit is contained in:
@@ -71,6 +71,16 @@ describe("thread-ownership plugin", () => {
|
||||
expect(globalThis.fetch).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("fails open when Slack thread routing has no canonical conversation id", async () => {
|
||||
const result = await hooks.message_sending(
|
||||
{ content: "hello", replyToId: "1234.5678", metadata: {}, to: "" },
|
||||
{ channelId: "slack", conversationId: "" },
|
||||
);
|
||||
|
||||
expect(result).toBeUndefined();
|
||||
expect(globalThis.fetch).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("claims ownership successfully", async () => {
|
||||
vi.mocked(globalThis.fetch).mockResolvedValue(
|
||||
new Response(JSON.stringify({ owner: "test-agent" }), { status: 200 }),
|
||||
|
||||
@@ -112,7 +112,7 @@ export default definePluginEntry({
|
||||
normalizeOptionalString(event.metadata?.channelId) ||
|
||||
normalizeOptionalString(event.to) ||
|
||||
"";
|
||||
if (!threadTs) {
|
||||
if (!threadTs || !channelId) {
|
||||
return undefined;
|
||||
}
|
||||
if (abTestChannels.size > 0 && !abTestChannels.has(channelId)) {
|
||||
|
||||
Reference in New Issue
Block a user