diff --git a/dist/server.js b/dist/server.js index dcc8110..84033b7 100644 --- a/dist/server.js +++ b/dist/server.js @@ -4115,6 +4115,8 @@ async function setupV2(context) { if (item.status === "complete" || item.status === "unmet") continue; try { + if (!await ownsSession(item.sessionID)) + continue; const transcript = await context.session.context({ sessionID: item.sessionID }); if (disposed) return; diff --git a/src/server.ts b/src/server.ts index 72928ac..84955a0 100644 --- a/src/server.ts +++ b/src/server.ts @@ -2868,8 +2868,11 @@ async function setupV2(context: PluginV2.Plugin.Context): Promise { + await createGoal("ses_local", "Recover the local task state") + await createGoal("ses_foreign", "Leave another project's transcript alone") + const location = { directory: "/work/current", workspaceID: "workspace-current" } + const mock = makeMockContext( + {}, + [], + { ses_local: [], ses_foreign: [] }, + location, + { + ses_local: { location }, + ses_foreign: { location: { directory: "/work/other", workspaceID: "workspace-other" } }, + }, + ) + const cleanup = await setupPlugin(mock as never) + + await waitFor(() => mock.sessionGetCalls.includes("ses_local") && mock.sessionGetCalls.includes("ses_foreign")) + await waitFor(() => mock.contextCalls.includes("ses_local")) + expect(mock.contextCalls).toEqual(["ses_local"]) + + mock.stream.end() + await cleanup() +}) + test("V2 continuation proceeds after restart when transcripts show no blocking tasks", async () => { await createGoal("ses_v2", "Verify continuation without recovered tasks") const mock = makeMockContext({}, [], { ses_v2: [] })