fix: scope thread sessions and discord starter fetch

This commit is contained in:
Peter Steinberger
2026-01-07 19:42:50 +01:00
parent 7e5cef29a0
commit 0d021391a9
7 changed files with 84 additions and 61 deletions

View File

@@ -39,7 +39,7 @@ describe("initSessionState thread forking", () => {
);
const storePath = path.join(root, "sessions.json");
const parentSessionKey = "slack:channel:C1";
const parentSessionKey = "agent:main:slack:channel:C1";
await saveSessionStore(storePath, {
[parentSessionKey]: {
sessionId: parentSessionId,
@@ -52,7 +52,7 @@ describe("initSessionState thread forking", () => {
session: { store: storePath },
} as ClawdbotConfig;
const threadSessionKey = "slack:thread:C1:123";
const threadSessionKey = "agent:main:slack:channel:C1:thread:123";
const threadLabel = "Slack thread #general: starter";
const result = await initSessionState({
ctx: {
@@ -70,7 +70,10 @@ describe("initSessionState thread forking", () => {
expect(result.sessionEntry.sessionFile).toBeTruthy();
expect(result.sessionEntry.displayName).toBe(threadLabel);
const newSessionFile = result.sessionEntry.sessionFile!;
const newSessionFile = result.sessionEntry.sessionFile;
if (!newSessionFile) {
throw new Error("Missing session file for forked thread");
}
const [headerLine] = (await fs.readFile(newSessionFile, "utf-8"))
.split(/\r?\n/)
.filter((line) => line.trim().length > 0);