mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-22 16:51:28 +02:00
fix(mcp): include events at the subscription start boundary
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
a140d533a6
commit
6aa0962d4f
3 files changed
+8
-4
No files matched your search
@@ -447,9 +447,9 @@ describe.skipIf(!support.supported)("public MCP OAuth and tool boundary", () =>
|
||||
}
|
||||
});
|
||||
|
||||
it("retains changes occurring while callback ownership is being verified", async () => {
|
||||
it("retains changes at the subscription start while callback ownership is being verified", async () => {
|
||||
const f = await eventFixture();
|
||||
f.duringVerification(async () => { await f.activity(); });
|
||||
f.duringVerification(async () => { f.advance(-100); await f.activity(); });
|
||||
await f.service.subscribe(f.principal, f.input);
|
||||
await f.service.tick();
|
||||
expect(f.received.filter(r => r.body.eventId)).toHaveLength(1);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createHash } from "node:crypto";
|
||||
import { and, asc, count, eq, gt, isNotNull, isNull, lt, lte, or, sql } from "drizzle-orm";
|
||||
import { and, asc, count, eq, gt, gte, isNotNull, isNull, lt, lte, or, sql } from "drizzle-orm";
|
||||
import { z } from "zod";
|
||||
import { companies, activityLog, mcpEventDeliveries as deliveries, mcpEventSubscriptions as subscriptions, type Db } from "@paperclipai/db";
|
||||
import { ISSUE_STATUSES } from "@paperclipai/shared";
|
||||
@@ -141,7 +141,7 @@ export function createPublicMcpEvents(db: Db, oauth: PublicMcpOAuth, api: ApiDis
|
||||
const rows = await db.select({ activity: activityLog }).from(activityLog)
|
||||
.leftJoin(deliveries, and(eq(deliveries.subscriptionId, s.id), eq(deliveries.activityId, activityLog.id)))
|
||||
.where(and(eq(activityLog.companyId, s.companyId), eq(activityLog.entityType, "issue"), eq(activityLog.entityId, s.taskId),
|
||||
gt(activityLog.createdAt, s.startsAt), lt(activityLog.createdAt, s.expiresAt), isNull(deliveries.id)))
|
||||
gte(activityLog.createdAt, s.startsAt), lt(activityLog.createdAt, s.expiresAt), isNull(deliveries.id)))
|
||||
.orderBy(asc(activityLog.createdAt), asc(activityLog.id)).limit(100);
|
||||
for (const { activity } of rows) {
|
||||
const details = activity.details ?? {};
|
||||
|
||||
Reference in new issue
Block a user