mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-11 03:34:33 +00:00
fix(sessions): preserve idle reset timestamp on inbound metadata
This commit is contained in:
committed by
Peter Steinberger
parent
3eec79bd6c
commit
a467517b2b
@@ -108,4 +108,41 @@ describe("session store key normalization", () => {
|
||||
expect(store[CANONICAL_KEY]?.sessionId).toBe("legacy-session");
|
||||
expect(store[MIXED_CASE_KEY]).toBeUndefined();
|
||||
});
|
||||
|
||||
it("preserves updatedAt when recording inbound metadata for an existing session", async () => {
|
||||
await fs.writeFile(
|
||||
storePath,
|
||||
JSON.stringify(
|
||||
{
|
||||
[CANONICAL_KEY]: {
|
||||
sessionId: "existing-session",
|
||||
updatedAt: 1111,
|
||||
chatType: "direct",
|
||||
channel: "webchat",
|
||||
origin: {
|
||||
provider: "webchat",
|
||||
chatType: "direct",
|
||||
from: "WebChat:User-1",
|
||||
to: "webchat:user-1",
|
||||
},
|
||||
},
|
||||
},
|
||||
null,
|
||||
2,
|
||||
),
|
||||
"utf-8",
|
||||
);
|
||||
clearSessionStoreCacheForTest();
|
||||
|
||||
await recordSessionMetaFromInbound({
|
||||
storePath,
|
||||
sessionKey: CANONICAL_KEY,
|
||||
ctx: createInboundContext(),
|
||||
});
|
||||
|
||||
const store = loadSessionStore(storePath, { skipCache: true });
|
||||
expect(store[CANONICAL_KEY]?.sessionId).toBe("existing-session");
|
||||
expect(store[CANONICAL_KEY]?.updatedAt).toBe(1111);
|
||||
expect(store[CANONICAL_KEY]?.origin?.provider).toBe("webchat");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user