mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-27 23:12:52 +00:00
fix: align routed delivery thread parsing
This commit is contained in:
@@ -1120,8 +1120,8 @@ describe("dispatchPreparedSlackMessage preview fallback", () => {
|
||||
);
|
||||
|
||||
expect(updateLastRouteMock).toHaveBeenCalledWith({
|
||||
storePath: "/tmp/openclaw-store.json",
|
||||
sessionKey: "agent:main:main",
|
||||
agentId: "main",
|
||||
deliveryContext: {
|
||||
channel: "slack",
|
||||
to: "user:U1",
|
||||
@@ -1129,6 +1129,7 @@ describe("dispatchPreparedSlackMessage preview fallback", () => {
|
||||
threadId: "701.000",
|
||||
},
|
||||
ctx: {
|
||||
MessageThreadId: undefined,
|
||||
ReplyToId: "701.000",
|
||||
TransportThreadId: "701.000",
|
||||
SessionKey: "agent:main:main",
|
||||
|
||||
@@ -1950,18 +1950,8 @@ Second paragraph should still reach the agent after Slack's preview cutoff.`;
|
||||
});
|
||||
|
||||
it("preserves Slack thread history when an existing DM session receives a thread reply", async () => {
|
||||
const { storePath } = storeFixture.makeTmpStorePath();
|
||||
fs.writeFileSync(
|
||||
storePath,
|
||||
JSON.stringify(
|
||||
{
|
||||
"agent:main:main": { updatedAt: Date.now() },
|
||||
"agent:main:main:thread:650.000": { updatedAt: Date.now() },
|
||||
},
|
||||
null,
|
||||
2,
|
||||
),
|
||||
);
|
||||
seedExistingSession("agent:main:main");
|
||||
seedExistingSession("agent:main:main:thread:650.000");
|
||||
const replies = vi
|
||||
.fn()
|
||||
.mockResolvedValueOnce({
|
||||
@@ -1978,7 +1968,6 @@ Second paragraph should still reach the agent after Slack's preview cutoff.`;
|
||||
});
|
||||
const slackCtx = createInboundSlackCtx({
|
||||
cfg: {
|
||||
session: { store: storePath },
|
||||
channels: { slack: { enabled: true, replyToMode: "all" } },
|
||||
} as OpenClawConfig,
|
||||
appClient: { conversations: { replies } } as unknown as App["client"],
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { parseSessionThreadInfoFast } from "../../config/sessions/thread-info.js";
|
||||
import { parseThreadSessionSuffix } from "../../routing/session-key.js";
|
||||
import type { MsgContext } from "../templating.js";
|
||||
|
||||
export function resolveRoutedDeliveryThreadId(params: {
|
||||
@@ -11,5 +11,5 @@ export function resolveRoutedDeliveryThreadId(params: {
|
||||
if (params.ctx.TransportThreadId != null) {
|
||||
return params.ctx.TransportThreadId;
|
||||
}
|
||||
return parseSessionThreadInfoFast(params.sessionKey).threadId;
|
||||
return parseThreadSessionSuffix(params.sessionKey).threadId;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user