Skip to content

armgit / mem0

Public Imported from GitHub
0

The Memory Layer for AI Agents - Drop-in memory infrastructure for AI agents and apps. Context that persists. Built for production.

fix(zapier): raise the add_memory poll budget past the real API latency tail (#6680)

Kartik1ac3aa7256bd
diff --git a/AGENTS.md b/AGENTS.md
index c892e7929..a74c0beda 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -27,7 +27,7 @@ This is a **polyglot monorepo** containing Python and TypeScript packages, CLIs,
| `integrations/openclaw/` | `@mem0/openclaw-mem0` — OpenClaw plugin for Claude Code / AI editors |
| `integrations/pi-agent-plugin/` | `@mem0/pi-agent-plugin` — Pi Agent plugin |
| `integrations/vercel-ai-sdk/` | `@mem0/vercel-ai-provider` — Vercel AI SDK memory provider |
-| `integrations/zapier-mem0/` | `zapier-mem0` — Zapier Platform CLI app (deploys to Zapier, not npm); add / search / get / delete memories |
+| `integrations/zapier-mem0/` | `@mem0/zapier` — Zapier Platform CLI app (deploys to Zapier, not npm); add / search / get / delete memories |
| `server/` | FastAPI REST server for self-hosted Mem0 (Docker: FastAPI + PostgreSQL/pgvector + Neo4j) |
| `skills/` | Claude Code skill definitions. Reference skills (SDK knowledge, always-on): `mem0/`, `mem0-cli/`, `mem0-vercel-ai-sdk/`. Pipeline skills (run on demand): `mem0-integrate/`, `mem0-test-integration/`, `mem0-oss-to-platform/` |
| `docs/` | Documentation site (Mintlify) |
diff --git a/integrations/zapier-mem0/src/creates/add_memory.ts b/integrations/zapier-mem0/src/creates/add_memory.ts
index 9a2dcc69a..a9260cd16 100644
--- a/integrations/zapier-mem0/src/creates/add_memory.ts
+++ b/integrations/zapier-mem0/src/creates/add_memory.ts
@@ -2,8 +2,8 @@ import type { ZObject, Bundle, AddResponse, EventResponse } from '../types';
import { captureEvent } from '../telemetry';
const POLL_INTERVAL_MS = 1500;
-// Bounded so the poll budget stays under Zapier's per-step execution timeout.
-const MAX_POLL_ATTEMPTS = 12;
+// Bounded to a 60s poll budget, under Zapier's per-step execution timeout.
+const MAX_POLL_ATTEMPTS = 40;
// Polls GET /v1/event/{id}/ until the async memory-addition event resolves.
const pollEvent = async (z: ZObject, eventId: string): Promise<EventResponse> => {
diff --git a/integrations/zapier-mem0/test/unit.test.ts b/integrations/zapier-mem0/test/unit.test.ts
index 66f472019..1b638f7f6 100644
--- a/integrations/zapier-mem0/test/unit.test.ts
+++ b/integrations/zapier-mem0/test/unit.test.ts
@@ -58,6 +58,25 @@ describe('add_memory (offline)', () => {
expect((res as any).status).toBe('SUCCEEDED');
});
+ it('keeps polling past the old 12-attempt budget when the API is slow', async () => {
+ jest.useFakeTimers();
+ const pendingPolls = Array.from({ length: 20 }, () => ({ data: { status: 'PENDING' } }));
+ const z = makeZ([
+ { data: { event_id: 'e1', status: 'PENDING' } },
+ ...pendingPolls,
+ { data: { status: 'SUCCEEDED', results: [{ id: 'm1' }] } },
+ ]);
+ const resultPromise = addMemory.operation.perform(z, {
+ inputData: { content: 'hi', user_id: 'u1', waitForCompletion: 'true' },
+ } as any);
+ for (let i = 0; i < pendingPolls.length; i++) {
+ await jest.advanceTimersByTimeAsync(1500);
+ }
+ const res = await resultPromise;
+ expect((res as any).status).toBe('SUCCEEDED');
+ jest.useRealTimers();
+ });
+
it('throws a clear error on invalid JSON metadata', async () => {
const z = makeZ();
await expect(