From 0ae1a884a5b30526093431c696263369294c37c1 Mon Sep 17 00:00:00 2001
From: Omar Gerardo
Date: Wed, 26 Aug 2026 21:07:58 +0800
Subject: [PATCH 01/11] fix(providers): bound provider concurrency and stop
counting 429s as failures
ResilientProvider wrapped the LLM provider with a circuit breaker and nothing
else. There was no semaphore, no queue and no concurrency ceiling anywhere on
the provider path, so every captured observation fired compress() immediately.
Under multi-subagent load that is dozens of simultaneous upstream calls, and the
provider answered exactly as you would expect:
OpenAI API error (429): {"error":"too many concurrent requests"}
Those 429s were then fed to the breaker. At the configured threshold of three
failures in sixty seconds it opened, and for the next thirty seconds every
compression failed fast with circuit_breaker_open while the provider was
perfectly healthy and merely busy. Observed in production: continuous
circuit_breaker_open on compression, so observations were captured but never
compressed.
Two changes, and the second matters as much as the first.
Bound the number of in-flight calls, default four and overridable per instance
or with AGENTMEMORY_MAX_PROVIDER_CONCURRENCY. The semaphore hands a released
slot directly to the next waiter instead of decrementing and letting waiters
race for the opening, and releases in a finally so a throw cannot leak a slot
and deadlock everything queued behind it.
Stop recording a rate-limit response as a breaker failure. A 429 says slow down,
not that the provider is broken; treating backpressure as a fault is what
converted a busy upstream into a thirty-second outage. Genuine failures still
open the breaker, and the breaker is still checked before queueing so an open
circuit fails fast rather than occupying a slot.
Tests cover peak concurrency under a burst of 24 calls, slot release on the
error path, that 429s leave the breaker closed, and that real errors still open
it. Each was run against the unmodified source first: peak concurrency measured
24 against a limit of 3, and the breaker measured open where it should have been
closed.
---
src/providers/circuit-breaker.ts | 2 +-
src/providers/resilient.ts | 84 ++++++++++++++++++++-
test/resilient-provider.test.ts | 125 +++++++++++++++++++++++++++++++
3 files changed, 206 insertions(+), 5 deletions(-)
create mode 100644 test/resilient-provider.test.ts
diff --git a/src/providers/circuit-breaker.ts b/src/providers/circuit-breaker.ts
index bcb27e416f..95e753bf3c 100644
--- a/src/providers/circuit-breaker.ts
+++ b/src/providers/circuit-breaker.ts
@@ -1,6 +1,6 @@
import type { CircuitBreakerState } from "../types.js";
-interface CircuitBreakerOptions {
+export interface CircuitBreakerOptions {
failureThreshold?: number;
failureWindowMs?: number;
recoveryTimeoutMs?: number;
diff --git a/src/providers/resilient.ts b/src/providers/resilient.ts
index 95ece40c96..a2c51151fc 100644
--- a/src/providers/resilient.ts
+++ b/src/providers/resilient.ts
@@ -1,25 +1,101 @@
import type { MemoryProvider, CircuitBreakerState } from "../types.js";
-import { CircuitBreaker } from "./circuit-breaker.js";
+import { CircuitBreaker, type CircuitBreakerOptions } from "./circuit-breaker.js";
+
+const DEFAULT_MAX_CONCURRENT = 4;
+
+/**
+ * Bounds how many calls are inside the provider at once.
+ *
+ * Without this, every captured observation fired a compress() immediately and
+ * unbounded, so load meant dozens of simultaneous upstream calls and the
+ * provider answered with `429 too many concurrent requests`.
+ *
+ * release() hands its slot directly to the next waiter rather than decrementing
+ * and letting it race for the opening, so the limit holds under a burst.
+ */
+class Semaphore {
+ private active = 0;
+ private waiting: Array<() => void> = [];
+
+ constructor(private readonly limit: number) {}
+
+ async acquire(): Promise {
+ if (this.active < this.limit) {
+ this.active++;
+ return;
+ }
+ await new Promise((resolve) => this.waiting.push(resolve));
+ }
+
+ release(): void {
+ const next = this.waiting.shift();
+ if (next) next();
+ else this.active--;
+ }
+}
+
+/**
+ * A 429 says "slow down", not "you are broken".
+ *
+ * Counting it as a circuit-breaker failure turns backpressure into an outage:
+ * three of them inside the failure window open the breaker, and then every
+ * compression fails fast for the whole recovery timeout even though the
+ * provider is healthy and merely busy.
+ */
+function isRateLimited(err: unknown): boolean {
+ const message = err instanceof Error ? err.message : String(err);
+ return (
+ /\b429\b/.test(message) ||
+ /rate.?limit|too many (concurrent )?requests/i.test(message)
+ );
+}
+
+function resolveMaxConcurrent(configured: number | undefined): number {
+ const candidate =
+ configured ??
+ Number(process.env["AGENTMEMORY_MAX_PROVIDER_CONCURRENCY"] ?? NaN);
+ if (!Number.isFinite(candidate)) return DEFAULT_MAX_CONCURRENT;
+ const whole = Math.floor(candidate);
+ return whole >= 1 ? whole : DEFAULT_MAX_CONCURRENT;
+}
+
+export interface ResilientProviderOptions {
+ maxConcurrent?: number;
+ breaker?: CircuitBreakerOptions;
+}
export class ResilientProvider implements MemoryProvider {
- private breaker = new CircuitBreaker();
+ private breaker: CircuitBreaker;
+ private gate: Semaphore;
name: string;
- constructor(private inner: MemoryProvider) {
+ constructor(
+ private inner: MemoryProvider,
+ options: ResilientProviderOptions = {},
+ ) {
+ this.breaker = new CircuitBreaker(options.breaker);
+ this.gate = new Semaphore(resolveMaxConcurrent(options.maxConcurrent));
this.name = `resilient(${inner.name})`;
}
private async call(fn: () => Promise): Promise {
+ // Checked before queueing. An open breaker should fail fast rather than
+ // occupy a slot that a call with a chance of succeeding could use.
if (!this.breaker.isAllowed) {
throw new Error("circuit_breaker_open");
}
+ await this.gate.acquire();
try {
const result = await fn();
this.breaker.recordSuccess();
return result;
} catch (err) {
- this.breaker.recordFailure();
+ if (!isRateLimited(err)) this.breaker.recordFailure();
throw err;
+ } finally {
+ // In `finally` so a throw cannot leak the slot and deadlock every call
+ // queued behind it.
+ this.gate.release();
}
}
diff --git a/test/resilient-provider.test.ts b/test/resilient-provider.test.ts
new file mode 100644
index 0000000000..70dd9aa705
--- /dev/null
+++ b/test/resilient-provider.test.ts
@@ -0,0 +1,125 @@
+import { describe, it, expect } from "vitest";
+import { ResilientProvider } from "../src/providers/resilient.js";
+import type { MemoryProvider } from "../src/types.js";
+
+// Tracks how many calls are inside the provider at once, which is the thing the
+// upstream API actually rejects. Counting total calls would not discriminate.
+function countingProvider(
+ behaviour: (n: number) => Promise = async () => "ok",
+): MemoryProvider & { peak: number; calls: number } {
+ let inFlight = 0;
+ const state = {
+ name: "counting",
+ peak: 0,
+ calls: 0,
+ async compress(): Promise {
+ inFlight++;
+ state.calls++;
+ if (inFlight > state.peak) state.peak = inFlight;
+ try {
+ return await behaviour(state.calls);
+ } finally {
+ inFlight--;
+ }
+ },
+ async summarize(): Promise {
+ return state.compress();
+ },
+ };
+ return state;
+}
+
+function rateLimited(): Error {
+ return new Error('OpenAI API error (429): {"error":"too many concurrent requests"}');
+}
+
+describe("ResilientProvider concurrency", () => {
+ it("never runs more than the configured number of calls at once", async () => {
+ const inner = countingProvider(
+ () => new Promise((resolve) => setTimeout(() => resolve("ok"), 5)),
+ );
+ const provider = new ResilientProvider(inner, { maxConcurrent: 3 });
+
+ await Promise.all(
+ Array.from({ length: 24 }, () => provider.compress("sys", "user")),
+ );
+
+ // The provider fired all 24 at once before this bound existed, which is
+ // exactly what the upstream 429 complains about.
+ expect(inner.peak).toBeLessThanOrEqual(3);
+ expect(inner.calls).toBe(24);
+ });
+
+ it("still completes every call while bounded", async () => {
+ const inner = countingProvider();
+ const provider = new ResilientProvider(inner, { maxConcurrent: 2 });
+
+ const results = await Promise.all(
+ Array.from({ length: 10 }, () => provider.compress("sys", "user")),
+ );
+
+ expect(results).toHaveLength(10);
+ expect(results.every((r) => r === "ok")).toBe(true);
+ });
+
+ it("releases its slot when a call throws", async () => {
+ const inner = countingProvider(async (n) => {
+ if (n <= 2) throw new Error("boom");
+ return "ok";
+ });
+ const provider = new ResilientProvider(inner, {
+ maxConcurrent: 1,
+ breaker: { failureThreshold: 100 },
+ });
+
+ const settled = await Promise.allSettled(
+ Array.from({ length: 5 }, () => provider.compress("sys", "user")),
+ );
+
+ // A slot leaked on the error path would deadlock the remaining calls.
+ expect(settled).toHaveLength(5);
+ expect(settled.filter((s) => s.status === "fulfilled")).toHaveLength(3);
+ });
+});
+
+describe("ResilientProvider rate limiting", () => {
+ it("does not open the breaker on 429s", async () => {
+ // A 429 means slow down, not that the provider is broken. Counting it as a
+ // breaker failure converts backpressure into a 30s outage in which every
+ // compression fails fast.
+ const inner = countingProvider(async (n) => {
+ if (n <= 5) throw rateLimited();
+ return "ok";
+ });
+ const provider = new ResilientProvider(inner, {
+ maxConcurrent: 1,
+ breaker: { failureThreshold: 3 },
+ });
+
+ for (let i = 0; i < 5; i++) {
+ await provider.compress("sys", "user").catch(() => undefined);
+ }
+
+ expect(provider.circuitState.state).toBe("closed");
+ await expect(provider.compress("sys", "user")).resolves.toBe("ok");
+ });
+
+ it("still opens the breaker on genuine failures", async () => {
+ const inner = countingProvider(async () => {
+ throw new Error("upstream exploded");
+ });
+ const provider = new ResilientProvider(inner, {
+ maxConcurrent: 1,
+ breaker: { failureThreshold: 3 },
+ });
+
+ for (let i = 0; i < 3; i++) {
+ await provider.compress("sys", "user").catch(() => undefined);
+ }
+
+ expect(provider.circuitState.state).toBe("open");
+ await expect(provider.compress("sys", "user")).rejects.toThrow(
+ "circuit_breaker_open",
+ );
+ });
+});
From b794904b64bf779f86a8a24d83ff30742b38bf20 Mon Sep 17 00:00:00 2001
From: Omar Gerardo
Date: Wed, 26 Aug 2026 21:32:09 +0800
Subject: [PATCH 02/11] refactor(providers): read the concurrency limit through
getEnvVar
Reading the process environment directly bypassed the user-level agentmemory
config file, which is the surface every sibling provider goes through
(minimax.ts, providers/index.ts and _fetch.ts all use getEnvVar). Same line
count, and it closes a real gap: an operator setting the limit there would have
seen it silently ignored.
Drop the breaker options passthrough. Nothing in production supplies it, all
three constructions in providers/index.ts are bare, and every test that passed
it was restating a default. CircuitBreakerOptions goes back to being private.
Collapse the one-field options interface into an inline type, merge the two
rate-limit regexes into one with an identical truth table, and cut the comments
that restated the commit message. The release-handoff note stays: it is design
rationale, not narrative.
Fold the completion assertion into the concurrency test, which already proved it
by resolving all 24 calls, and drop the maxConcurrent arguments that were no-ops
against sequentially awaited calls. The one in the slot-release test stays,
because at the default of 4 a leaked slot would not deadlock and that test would
pass despite the bug.
---
src/providers/circuit-breaker.ts | 2 +-
src/providers/resilient.ts | 41 +++++++++++---------------------
test/resilient-provider.test.ts | 38 +++++++----------------------
3 files changed, 23 insertions(+), 58 deletions(-)
diff --git a/src/providers/circuit-breaker.ts b/src/providers/circuit-breaker.ts
index 95e753bf3c..bcb27e416f 100644
--- a/src/providers/circuit-breaker.ts
+++ b/src/providers/circuit-breaker.ts
@@ -1,6 +1,6 @@
import type { CircuitBreakerState } from "../types.js";
-export interface CircuitBreakerOptions {
+interface CircuitBreakerOptions {
failureThreshold?: number;
failureWindowMs?: number;
recoveryTimeoutMs?: number;
diff --git a/src/providers/resilient.ts b/src/providers/resilient.ts
index a2c51151fc..dd6c4dc223 100644
--- a/src/providers/resilient.ts
+++ b/src/providers/resilient.ts
@@ -1,17 +1,15 @@
import type { MemoryProvider, CircuitBreakerState } from "../types.js";
-import { CircuitBreaker, type CircuitBreakerOptions } from "./circuit-breaker.js";
+import { CircuitBreaker } from "./circuit-breaker.js";
+import { getEnvVar } from "../config.js";
const DEFAULT_MAX_CONCURRENT = 4;
/**
* Bounds how many calls are inside the provider at once.
*
- * Without this, every captured observation fired a compress() immediately and
- * unbounded, so load meant dozens of simultaneous upstream calls and the
- * provider answered with `429 too many concurrent requests`.
- *
- * release() hands its slot directly to the next waiter rather than decrementing
- * and letting it race for the opening, so the limit holds under a burst.
+ * release() hands its slot directly to the next waiter rather than
+ * decrementing and letting waiters race for the opening, so the limit holds
+ * under a burst.
*/
class Semaphore {
private active = 0;
@@ -34,36 +32,25 @@ class Semaphore {
}
}
-/**
- * A 429 says "slow down", not "you are broken".
- *
- * Counting it as a circuit-breaker failure turns backpressure into an outage:
- * three of them inside the failure window open the breaker, and then every
- * compression fails fast for the whole recovery timeout even though the
- * provider is healthy and merely busy.
- */
+// 429 is backpressure, not a fault. Counting it opened the breaker on a healthy
+// provider and failed every compression for the recovery window.
function isRateLimited(err: unknown): boolean {
const message = err instanceof Error ? err.message : String(err);
- return (
- /\b429\b/.test(message) ||
- /rate.?limit|too many (concurrent )?requests/i.test(message)
- );
+ return /\b429\b|rate.?limit|too many (concurrent )?requests/i.test(message);
}
+// Option is the test seam, env is the operator knob on Railway, constant is the
+// default. getEnvVar rather than process.env so ~/.agentmemory/.env is honoured,
+// which is how every sibling provider reads config.
function resolveMaxConcurrent(configured: number | undefined): number {
const candidate =
configured ??
- Number(process.env["AGENTMEMORY_MAX_PROVIDER_CONCURRENCY"] ?? NaN);
+ Number(getEnvVar("AGENTMEMORY_MAX_PROVIDER_CONCURRENCY") ?? NaN);
if (!Number.isFinite(candidate)) return DEFAULT_MAX_CONCURRENT;
const whole = Math.floor(candidate);
return whole >= 1 ? whole : DEFAULT_MAX_CONCURRENT;
}
-export interface ResilientProviderOptions {
- maxConcurrent?: number;
- breaker?: CircuitBreakerOptions;
-}
-
export class ResilientProvider implements MemoryProvider {
private breaker: CircuitBreaker;
private gate: Semaphore;
@@ -71,9 +58,9 @@ export class ResilientProvider implements MemoryProvider {
constructor(
private inner: MemoryProvider,
- options: ResilientProviderOptions = {},
+ options: { maxConcurrent?: number } = {},
) {
- this.breaker = new CircuitBreaker(options.breaker);
+ this.breaker = new CircuitBreaker();
this.gate = new Semaphore(resolveMaxConcurrent(options.maxConcurrent));
this.name = `resilient(${inner.name})`;
}
diff --git a/test/resilient-provider.test.ts b/test/resilient-provider.test.ts
index 70dd9aa705..4f7b028a13 100644
--- a/test/resilient-provider.test.ts
+++ b/test/resilient-provider.test.ts
@@ -40,25 +40,13 @@ describe("ResilientProvider concurrency", () => {
);
const provider = new ResilientProvider(inner, { maxConcurrent: 3 });
- await Promise.all(
+ const results = await Promise.all(
Array.from({ length: 24 }, () => provider.compress("sys", "user")),
);
- // The provider fired all 24 at once before this bound existed, which is
- // exactly what the upstream 429 complains about.
expect(inner.peak).toBeLessThanOrEqual(3);
+ // Bounding must not drop work: every call still ran and still resolved.
expect(inner.calls).toBe(24);
- });
-
- it("still completes every call while bounded", async () => {
- const inner = countingProvider();
- const provider = new ResilientProvider(inner, { maxConcurrent: 2 });
-
- const results = await Promise.all(
- Array.from({ length: 10 }, () => provider.compress("sys", "user")),
- );
-
- expect(results).toHaveLength(10);
expect(results.every((r) => r === "ok")).toBe(true);
});
@@ -67,16 +55,14 @@ describe("ResilientProvider concurrency", () => {
if (n <= 2) throw new Error("boom");
return "ok";
});
- const provider = new ResilientProvider(inner, {
- maxConcurrent: 1,
- breaker: { failureThreshold: 100 },
- });
+ // maxConcurrent 1 is load-bearing here: at the default of 4 a leaked slot
+ // would not deadlock, and the test would pass despite the bug.
+ const provider = new ResilientProvider(inner, { maxConcurrent: 1 });
const settled = await Promise.allSettled(
Array.from({ length: 5 }, () => provider.compress("sys", "user")),
);
- // A slot leaked on the error path would deadlock the remaining calls.
expect(settled).toHaveLength(5);
expect(settled.filter((s) => s.status === "fulfilled")).toHaveLength(3);
});
@@ -84,18 +70,13 @@ describe("ResilientProvider concurrency", () => {
describe("ResilientProvider rate limiting", () => {
it("does not open the breaker on 429s", async () => {
- // A 429 means slow down, not that the provider is broken. Counting it as a
- // breaker failure converts backpressure into a 30s outage in which every
- // compression fails fast.
const inner = countingProvider(async (n) => {
if (n <= 5) throw rateLimited();
return "ok";
});
- const provider = new ResilientProvider(inner, {
- maxConcurrent: 1,
- breaker: { failureThreshold: 3 },
- });
+ const provider = new ResilientProvider(inner);
+ // Five, against a default failure threshold of three.
for (let i = 0; i < 5; i++) {
await provider.compress("sys", "user").catch(() => undefined);
}
@@ -108,10 +89,7 @@ describe("ResilientProvider rate limiting", () => {
const inner = countingProvider(async () => {
throw new Error("upstream exploded");
});
- const provider = new ResilientProvider(inner, {
- maxConcurrent: 1,
- breaker: { failureThreshold: 3 },
- });
+ const provider = new ResilientProvider(inner);
for (let i = 0; i < 3; i++) {
await provider.compress("sys", "user").catch(() => undefined);
From 91d0e03ef61245d31676f90b4de49e15dae2619a Mon Sep 17 00:00:00 2001
From: Omar Gerardo
Date: Wed, 26 Aug 2026 21:49:43 +0800
Subject: [PATCH 03/11] fix(providers): stop the rate-limit filter blinding the
breaker, and cap the queue
Four defects a review surfaced in the concurrency bound.
The rate-limit filter matched too broadly. Providers interpolate the whole
upstream body into the error message, so a genuine 500 whose body carried a link
to /docs/guides/rate-limits was classified as backpressure and never reached the
breaker, leaving it blind to a provider that was actually broken. Matching on
status codes and API error codes instead, with rate[ _]limit for prose and the
rate_limit_error / rate_limit_exceeded codes, which does not match the
hyphenated form in a URL. There is now a test that fails on the old pattern.
Quota exhaustion arrives as a 429 as well, but it is a persistent state rather
than backpressure, so excusing it meant the breaker could never open for a
provider that would not recover on its own. Billing and insufficient_quota
messages are checked first and fall through as genuine failures.
529 overloaded_error is Anthropic's form of the same busy signal and matched
nothing, so the exact problem this change exists to fix survived on that path.
The default limit moves from 4 to 6 to match CHUNK_CONCURRENCY_DEFAULT in
summarize.ts. That value is tuned so a ~100-chunk session finishes inside the
180s invocation budget at roughly 8s per call, and a global gate of 4 both
pushed it past that budget and silently turned SUMMARIZE_CHUNK_CONCURRENCY into
a no-op above 4 while still logging the requested value.
The breaker is re-checked after acquiring a slot. A call that passed the first
check may wait while the running calls fail and open the circuit, and without
this it is still sent to a provider already known to be down, where each further
failure pushes the recovery window further out.
The waiting queue is capped. A queued call holds its prompts alive, compression
is dispatched fire-and-forget so no backpressure reaches the producer, and an
unbounded queue is a memory leak on a service that is already memory-constrained.
---
src/providers/resilient.ts | 40 ++++++++++++++++++++++--
test/resilient-provider.test.ts | 55 +++++++++++++++++++++++++++++++++
2 files changed, 93 insertions(+), 2 deletions(-)
diff --git a/src/providers/resilient.ts b/src/providers/resilient.ts
index dd6c4dc223..535e727e48 100644
--- a/src/providers/resilient.ts
+++ b/src/providers/resilient.ts
@@ -2,7 +2,17 @@ import type { MemoryProvider, CircuitBreakerState } from "../types.js";
import { CircuitBreaker } from "./circuit-breaker.js";
import { getEnvVar } from "../config.js";
-const DEFAULT_MAX_CONCURRENT = 4;
+// Matches CHUNK_CONCURRENCY_DEFAULT in src/functions/summarize.ts on purpose.
+// That value is tuned so a ~100-chunk session finishes inside the 180s
+// invocation budget at roughly 8s per call; a global gate below it would push
+// that past the budget and silently make SUMMARIZE_CHUNK_CONCURRENCY a no-op
+// above the gate. Raise them together, never one alone.
+const DEFAULT_MAX_CONCURRENT = 6;
+
+// A queued call still holds its prompts alive, so an unbounded queue is a
+// memory leak on a service that is already memory-constrained. Compression is
+// dispatched fire-and-forget, so nothing upstream applies backpressure for us.
+const MAX_QUEUED = 512;
/**
* Bounds how many calls are inside the provider at once.
@@ -22,6 +32,9 @@ class Semaphore {
this.active++;
return;
}
+ if (this.waiting.length >= MAX_QUEUED) {
+ throw new Error("provider_queue_full");
+ }
await new Promise((resolve) => this.waiting.push(resolve));
}
@@ -36,7 +49,22 @@ class Semaphore {
// provider and failed every compression for the recovery window.
function isRateLimited(err: unknown): boolean {
const message = err instanceof Error ? err.message : String(err);
- return /\b429\b|rate.?limit|too many (concurrent )?requests/i.test(message);
+ // Quota exhaustion and billing failures also come back as 429, but they are
+ // persistent states rather than backpressure. Excusing them would mean the
+ // breaker could never open for a provider that will not recover on its own,
+ // so they are checked first and fall through to a genuine failure.
+ if (/insufficient_quota|exceeded your current quota|billing/i.test(message)) {
+ return false;
+ }
+ // Status codes and API error codes only. `rate.?limit` also matched the
+ // hyphenated form in a docs URL, so a genuine 500 whose body linked to
+ // /docs/guides/rate-limits was excused and the breaker stayed blind to a
+ // provider that was actually broken. `rate[ _]limit` covers prose and the
+ // rate_limit_error / rate_limit_exceeded codes without matching the URL.
+ // 529 / overloaded_error is Anthropic's form of the same backpressure signal.
+ return /\b429\b|\b529\b|rate[ _]limit|too many (concurrent )?requests|overloaded_error/i.test(
+ message,
+ );
}
// Option is the test seam, env is the operator knob on Railway, constant is the
@@ -72,6 +100,14 @@ export class ResilientProvider implements MemoryProvider {
throw new Error("circuit_breaker_open");
}
await this.gate.acquire();
+ // Re-checked after queueing. A call that passed the first check may have
+ // waited while the running calls failed and opened the breaker; without
+ // this it would still be sent to a provider already known to be down, and
+ // each such failure pushes the recovery window further out.
+ if (!this.breaker.isAllowed) {
+ this.gate.release();
+ throw new Error("circuit_breaker_open");
+ }
try {
const result = await fn();
this.breaker.recordSuccess();
diff --git a/test/resilient-provider.test.ts b/test/resilient-provider.test.ts
index 4f7b028a13..8f7d89832e 100644
--- a/test/resilient-provider.test.ts
+++ b/test/resilient-provider.test.ts
@@ -101,3 +101,58 @@ describe("ResilientProvider rate limiting", () => {
);
});
});
+
+describe("ResilientProvider rate-limit classification", () => {
+ it("still opens the breaker when a real failure merely mentions a rate limit", async () => {
+ // The filter matches on message text, and providers interpolate the whole
+ // upstream body. A 500 whose body carries a docs link like
+ // /docs/guides/rate-limits would otherwise be excused forever, leaving the
+ // breaker permanently blind to a genuinely broken provider.
+ const inner = countingProvider(async () => {
+ throw new Error(
+ "HTTP 500 upstream failure, see https://example.com/docs/guides/rate-limits",
+ );
+ });
+ const provider = new ResilientProvider(inner);
+
+ for (let i = 0; i < 3; i++) {
+ await provider.compress("sys", "user").catch(() => undefined);
+ }
+
+ expect(provider.circuitState.state).toBe("open");
+ });
+
+ it("opens the breaker on quota exhaustion even though it arrives as a 429", async () => {
+ // Quota exhaustion and billing failures use the same status as
+ // backpressure, but they do not resolve on their own. Excusing them means
+ // the breaker can never open for a provider that will stay broken.
+ const inner = countingProvider(async () => {
+ throw new Error(
+ 'API error (429): {"error":{"code":"insufficient_quota","message":"You exceeded your current quota"}}',
+ );
+ });
+ const provider = new ResilientProvider(inner);
+
+ for (let i = 0; i < 3; i++) {
+ await provider.compress("sys", "user").catch(() => undefined);
+ }
+
+ expect(provider.circuitState.state).toBe("open");
+ });
+
+ it("treats an overloaded provider as backpressure", async () => {
+ // Anthropic signals the same "busy, retry" condition as 529
+ // overloaded_error rather than 429.
+ const inner = countingProvider(async (n) => {
+ if (n <= 5) throw new Error('{"type":"overloaded_error"} (529)');
+ return "ok";
+ });
+ const provider = new ResilientProvider(inner);
+
+ for (let i = 0; i < 5; i++) {
+ await provider.compress("sys", "user").catch(() => undefined);
+ }
+
+ expect(provider.circuitState.state).toBe("closed");
+ });
+});
From c17064b221c7aac3d7afb284b446954fa3ec585c Mon Sep 17 00:00:00 2001
From: Omar Gerardo
Date: Wed, 26 Aug 2026 22:10:46 +0800
Subject: [PATCH 04/11] fix(providers): a rate-limited probe must still fail
the half-open probe
Excusing rate limits left half-open as a state the breaker could enter and never
leave. isAllowed returns true unconditionally in half-open, and the probe's
outcome is recorded nowhere else, so a probe that came back 429 recorded neither
success nor failure: the breaker stayed half-open and admitted every subsequent
call indefinitely, while reporting half-open to the health endpoint. A probe
that came back rate-limited has still failed as a probe, so record it.
The test for this initially passed against the broken code. It relied on a
constructor option that no longer exists, so the 30s default recovery window
applied, a few milliseconds of sleep never reached half-open, the probe never
happened, and the assertion held trivially. It now moves the clock past the
window with fake timers, and reverting the fix fails it.
---
src/providers/resilient.ts | 9 +++++++-
test/resilient-provider.test.ts | 37 ++++++++++++++++++++++++++++++++-
2 files changed, 44 insertions(+), 2 deletions(-)
diff --git a/src/providers/resilient.ts b/src/providers/resilient.ts
index 535e727e48..930721e036 100644
--- a/src/providers/resilient.ts
+++ b/src/providers/resilient.ts
@@ -108,12 +108,19 @@ export class ResilientProvider implements MemoryProvider {
this.gate.release();
throw new Error("circuit_breaker_open");
}
+ // Read after the isAllowed checks, which are what move open -> half-open.
+ const probing = this.breaker.getState().state === "half-open";
try {
const result = await fn();
this.breaker.recordSuccess();
return result;
} catch (err) {
- if (!isRateLimited(err)) this.breaker.recordFailure();
+ // Backpressure normally must not open the breaker. The half-open probe is
+ // the exception: nothing else records an outcome for it, so excusing a
+ // rate-limited probe leaves the breaker sitting in half-open admitting
+ // every call, with no path back to either open or closed. A probe that
+ // came back rate-limited has still failed as a probe.
+ if (probing || !isRateLimited(err)) this.breaker.recordFailure();
throw err;
} finally {
// In `finally` so a throw cannot leak the slot and deadlock every call
diff --git a/test/resilient-provider.test.ts b/test/resilient-provider.test.ts
index 8f7d89832e..24077d7ff2 100644
--- a/test/resilient-provider.test.ts
+++ b/test/resilient-provider.test.ts
@@ -1,4 +1,4 @@
-import { describe, it, expect } from "vitest";
+import { describe, it, expect, vi } from "vitest";
import { ResilientProvider } from "../src/providers/resilient.js";
import type { MemoryProvider } from "../src/types.js";
@@ -156,3 +156,38 @@ describe("ResilientProvider rate-limit classification", () => {
expect(provider.circuitState.state).toBe("closed");
});
});
+
+describe("ResilientProvider half-open probe", () => {
+ it("does not get stuck in half-open when the probe is rate limited", async () => {
+ // Nothing else records an outcome for the probe, so excusing a
+ // rate-limited one leaves the breaker in half-open admitting every call,
+ // with no path back to open or closed. Half-open must never be a state you
+ // can enter and not leave.
+ let mode: "fail" | "ratelimit" = "fail";
+ const inner = countingProvider(async () => {
+ throw mode === "fail"
+ ? new Error("upstream exploded")
+ : new Error("API error (429): rate limited");
+ });
+ const provider = new ResilientProvider(inner);
+
+ for (let i = 0; i < 3; i++) {
+ await provider.compress("sys", "user").catch(() => undefined);
+ }
+ expect(provider.circuitState.state).toBe("open");
+
+ // Move the clock past the 30s recovery window so the next call is the
+ // probe. Sleeping a few milliseconds instead would leave the breaker still
+ // open, the probe would never happen, and this test would pass without
+ // exercising anything — it did exactly that before this was fixed.
+ vi.useFakeTimers();
+ vi.setSystemTime(Date.now() + 31_000);
+ try {
+ mode = "ratelimit";
+ await provider.compress("sys", "user").catch(() => undefined);
+ expect(provider.circuitState.state).not.toBe("half-open");
+ } finally {
+ vi.useRealTimers();
+ }
+ });
+});
From 5d91a93e6de2cca3e0c0df73aaecb032296efa1f Mon Sep 17 00:00:00 2001
From: Omar Gerardo
Date: Wed, 26 Aug 2026 22:51:03 +0800
Subject: [PATCH 05/11] test(providers): pin the post-acquire breaker recheck
and tighten the probe assertion
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The half-open probe test asserted `not.toBe("half-open")`, which is weaker than
the invariant it protects. It also accepts "closed" — a rate-limited probe
mistaken for full recovery, which is the worse bug — and it would pass vacuously
if the clock advance failed to take, because the breaker would still be open and
the probe would never dispatch. It now asserts the probe actually ran and that
the state is exactly open.
The post-acquire breaker recheck had no coverage at all. Added a test that fills
the single slot, queues calls behind it, and requires the queued ones to be
turned away with circuit_breaker_open rather than reaching a provider already
known to be down. Reverting the recheck fails it.
---
test/resilient-provider.test.ts | 45 ++++++++++++++++++++++++++++++++-
1 file changed, 44 insertions(+), 1 deletion(-)
diff --git a/test/resilient-provider.test.ts b/test/resilient-provider.test.ts
index 24077d7ff2..22253cce14 100644
--- a/test/resilient-provider.test.ts
+++ b/test/resilient-provider.test.ts
@@ -185,9 +185,52 @@ describe("ResilientProvider half-open probe", () => {
try {
mode = "ratelimit";
await provider.compress("sys", "user").catch(() => undefined);
- expect(provider.circuitState.state).not.toBe("half-open");
+
+ // Assert the probe actually dispatched. Without this the test passes
+ // vacuously if the clock advance does not take: the breaker would still
+ // be open, the first isAllowed check would throw before reaching fn(),
+ // and "open" !== "half-open" would hold while nothing was exercised.
+ expect(inner.calls).toBe(4);
+ // Must be exactly open. `not.toBe("half-open")` would also accept
+ // "closed", which is the worse bug — a rate-limited probe mistaken for
+ // full recovery.
+ expect(provider.circuitState.state).toBe("open");
} finally {
vi.useRealTimers();
}
});
+
+ it("fails a call queued before the breaker opened, without calling the provider", async () => {
+ // The post-acquire re-check. A call admitted while the breaker was closed
+ // can wait behind others that fail and open it; without the re-check it is
+ // still handed to a provider already known to be down.
+ let release!: () => void;
+ const gate = new Promise((r) => {
+ release = r;
+ });
+ const inner = countingProvider(async (n) => {
+ if (n === 1) {
+ await gate;
+ throw new Error("upstream exploded");
+ }
+ throw new Error("upstream exploded");
+ });
+ const provider = new ResilientProvider(inner, { maxConcurrent: 1 });
+
+ // One call occupies the only slot; three more queue behind it.
+ const first = provider.compress("sys", "user").catch((e) => e);
+ const queued = Array.from({ length: 3 }, () =>
+ provider.compress("sys", "user").catch((e: Error) => e),
+ );
+ release();
+ const results = [await first, ...(await Promise.all(queued))];
+
+ // Three failures open the breaker, so the last queued call must be turned
+ // away at the re-check rather than reaching the provider.
+ expect(provider.circuitState.state).toBe("open");
+ expect(inner.calls).toBeLessThan(4);
+ expect(
+ results.some((r) => (r as Error).message === "circuit_breaker_open"),
+ ).toBe(true);
+ });
});
From caafc59eaac63e6b2678b3db82b4c833fd4759d8 Mon Sep 17 00:00:00 2001
From: Omar Gerardo
Date: Thu, 27 Aug 2026 01:10:40 +0800
Subject: [PATCH 06/11] refactor(providers): drop what-narrating comments, name
the backpressure check
AGENTS.md asks for clear naming over comments that restate what the code
does. Five blocks in resilient.ts were doing exactly that: the Semaphore
doc narrated acquire and release, the resolveMaxConcurrent header restated
`configured ?? env ?? default`, and the pre-queue and `finally` comments
restated the two lines sitting under them.
isRateLimited becomes isBackpressure so the call site states the policy the
deleted header used to explain. The new name is also the accurate one, since
the quota and billing carve-out returns false for 429s that are not
backpressure. The function is module-local, so the rename is two lines.
The surviving comments record why a line exists rather than what it does,
which no identifier can carry: the summarize.ts concurrency coupling, the
queue bound, the quota carve-out, the docs-URL regex regression, the
post-queue breaker recheck, and the half-open probe exception.
Every other removed line is a comment, so behavior is unchanged.
---
src/providers/resilient.ts | 20 ++------------------
1 file changed, 2 insertions(+), 18 deletions(-)
diff --git a/src/providers/resilient.ts b/src/providers/resilient.ts
index 930721e036..b273abeacf 100644
--- a/src/providers/resilient.ts
+++ b/src/providers/resilient.ts
@@ -14,13 +14,6 @@ const DEFAULT_MAX_CONCURRENT = 6;
// dispatched fire-and-forget, so nothing upstream applies backpressure for us.
const MAX_QUEUED = 512;
-/**
- * Bounds how many calls are inside the provider at once.
- *
- * release() hands its slot directly to the next waiter rather than
- * decrementing and letting waiters race for the opening, so the limit holds
- * under a burst.
- */
class Semaphore {
private active = 0;
private waiting: Array<() => void> = [];
@@ -45,9 +38,7 @@ class Semaphore {
}
}
-// 429 is backpressure, not a fault. Counting it opened the breaker on a healthy
-// provider and failed every compression for the recovery window.
-function isRateLimited(err: unknown): boolean {
+function isBackpressure(err: unknown): boolean {
const message = err instanceof Error ? err.message : String(err);
// Quota exhaustion and billing failures also come back as 429, but they are
// persistent states rather than backpressure. Excusing them would mean the
@@ -67,9 +58,6 @@ function isRateLimited(err: unknown): boolean {
);
}
-// Option is the test seam, env is the operator knob on Railway, constant is the
-// default. getEnvVar rather than process.env so ~/.agentmemory/.env is honoured,
-// which is how every sibling provider reads config.
function resolveMaxConcurrent(configured: number | undefined): number {
const candidate =
configured ??
@@ -94,8 +82,6 @@ export class ResilientProvider implements MemoryProvider {
}
private async call(fn: () => Promise): Promise {
- // Checked before queueing. An open breaker should fail fast rather than
- // occupy a slot that a call with a chance of succeeding could use.
if (!this.breaker.isAllowed) {
throw new Error("circuit_breaker_open");
}
@@ -120,11 +106,9 @@ export class ResilientProvider implements MemoryProvider {
// rate-limited probe leaves the breaker sitting in half-open admitting
// every call, with no path back to either open or closed. A probe that
// came back rate-limited has still failed as a probe.
- if (probing || !isRateLimited(err)) this.breaker.recordFailure();
+ if (probing || !isBackpressure(err)) this.breaker.recordFailure();
throw err;
} finally {
- // In `finally` so a throw cannot leak the slot and deadlock every call
- // queued behind it.
this.gate.release();
}
}
From 6a22a6eaf24de0a7508c959caac1ddc0b98d2efd Mon Sep 17 00:00:00 2001
From: Omar Gerardo
Date: Thu, 27 Aug 2026 02:36:49 +0800
Subject: [PATCH 07/11] docs(providers): document
AGENTMEMORY_MAX_PROVIDER_CONCURRENCY
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The gate this branch adds is global, so it silently caps
SUMMARIZE_CHUNK_CONCURRENCY — which summarize.ts explicitly tells operators to
raise for high-throughput providers ("Novita / DeepInfra / DeepSeek typically
allow 100+ concurrent"). With no entry in the env block, an operator following
that advice sets 100, gets 6, and has nothing to point at. providers/index.ts
constructs ResilientProvider bare at all three call sites, so
options.maxConcurrent is a test seam and this variable is the only lever
production has.
Placed beside AGENTMEMORY_LLM_TIMEOUT_MS, the other outbound-call tuning knob,
and states the coupling rather than only the default.
SUMMARIZE_CHUNK_CONCURRENCY and SUMMARIZE_CHUNK_SIZE are themselves absent from
the env block. Documenting them is left out of scope here.
---
.env.example | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/.env.example b/.env.example
index e325877f3a..bc6124fa0f 100644
--- a/.env.example
+++ b/.env.example
@@ -69,6 +69,13 @@
# OPENAI_TIMEOUT_MS alias for back-compat with v0.9.17 (precedence).
# AGENTMEMORY_LLM_TIMEOUT_MS=60000 # Default: 60 000 ms (60 s)
+# Calls in flight inside the provider, shared by every LLM caller (compression,
+# summarize chunks, consolidation). Up to 512 more wait in a queue; past that a
+# call fails with provider_queue_full. Raise SUMMARIZE_CHUNK_CONCURRENCY and this
+# together, since a chunk concurrency above the gate has no effect. 429 and 529
+# rate-limit responses do not count toward the circuit breaker.
+# AGENTMEMORY_MAX_PROVIDER_CONCURRENCY=6 # Default: 6
+
# Opt-in Claude-subscription fallback (spawns @anthropic-ai/claude-agent-sdk
# child sessions). Off by default — the agent-sdk fallback can trigger
# Stop-hook recursion when invoked from inside Claude Code.
From 0eee13e8bfb9ce957c62604160accdf526198987 Mon Sep 17 00:00:00 2001
From: Omar Gerardo
Date: Fri, 30 Oct 2026 12:13:46 +0800
Subject: [PATCH 08/11] fix(providers): register
AGENTMEMORY_MAX_PROVIDER_CONCURRENCY with the env surface
Pass the variable through the worker compose allowlist and the three compose
files, the same way AGENTMEMORY_LLM_TIMEOUT_MS is passed, so Docker and Coolify
deployments can set it. Regenerate the config skill reference. Correct the
template comment: the cap is per worker and spans the whole fallback chain, and
quota/billing 429s and a failed half-open probe still count toward the breaker.
---
.env.example | 12 +++++++-----
deploy/coolify/docker-compose.yml | 1 +
deploy/runtime/worker-compose.yaml | 1 +
docker-compose.yml | 1 +
plugin/skills/agentmemory-config/REFERENCE.md | 3 ++-
src/cli/compose-project.ts | 3 ++-
6 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/.env.example b/.env.example
index bc6124fa0f..4fd4ab3fc7 100644
--- a/.env.example
+++ b/.env.example
@@ -69,11 +69,13 @@
# OPENAI_TIMEOUT_MS alias for back-compat with v0.9.17 (precedence).
# AGENTMEMORY_LLM_TIMEOUT_MS=60000 # Default: 60 000 ms (60 s)
-# Calls in flight inside the provider, shared by every LLM caller (compression,
-# summarize chunks, consolidation). Up to 512 more wait in a queue; past that a
-# call fails with provider_queue_full. Raise SUMMARIZE_CHUNK_CONCURRENCY and this
-# together, since a chunk concurrency above the gate has no effect. 429 and 529
-# rate-limit responses do not count toward the circuit breaker.
+# Max LLM calls in flight per worker, shared by every caller (compression,
+# summarize chunks, consolidation) and by the whole FALLBACK_PROVIDERS chain.
+# Up to 512 more wait in a queue; past that a call fails with
+# provider_queue_full. Raise SUMMARIZE_CHUNK_CONCURRENCY and this together,
+# since a chunk concurrency above the gate has no effect. Rate-limit errors
+# (429, 529, rate_limit, overloaded_error) do not count toward the circuit
+# breaker, except quota or billing 429s and a failed half-open probe.
# AGENTMEMORY_MAX_PROVIDER_CONCURRENCY=6 # Default: 6
# Opt-in Claude-subscription fallback (spawns @anthropic-ai/claude-agent-sdk
diff --git a/deploy/coolify/docker-compose.yml b/deploy/coolify/docker-compose.yml
index a229cb7692..7caa33f48a 100644
--- a/deploy/coolify/docker-compose.yml
+++ b/deploy/coolify/docker-compose.yml
@@ -82,6 +82,7 @@ services:
OPENROUTER_EMBEDDING_MODEL: "${OPENROUTER_EMBEDDING_MODEL:-}"
OPENROUTER_EMBEDDING_DIMENSIONS: "${OPENROUTER_EMBEDDING_DIMENSIONS:-}"
AGENTMEMORY_LLM_TIMEOUT_MS: "${AGENTMEMORY_LLM_TIMEOUT_MS:-}"
+ AGENTMEMORY_MAX_PROVIDER_CONCURRENCY: "${AGENTMEMORY_MAX_PROVIDER_CONCURRENCY:-}"
AGENTMEMORY_CAPTURE_MAX_ATTEMPTS: "${AGENTMEMORY_CAPTURE_MAX_ATTEMPTS:-}"
AGENTMEMORY_CAPTURE_RETRY_INTERVAL_MS: "${AGENTMEMORY_CAPTURE_RETRY_INTERVAL_MS:-}"
AGENTMEMORY_CAPTURE_DEDUP_HOURS: "${AGENTMEMORY_CAPTURE_DEDUP_HOURS:-}"
diff --git a/deploy/runtime/worker-compose.yaml b/deploy/runtime/worker-compose.yaml
index c1c1092887..cdc8394d40 100644
--- a/deploy/runtime/worker-compose.yaml
+++ b/deploy/runtime/worker-compose.yaml
@@ -141,6 +141,7 @@ containers:
OPENROUTER_EMBEDDING_MODEL: "${OPENROUTER_EMBEDDING_MODEL:-}"
OPENROUTER_EMBEDDING_DIMENSIONS: "${OPENROUTER_EMBEDDING_DIMENSIONS:-}"
AGENTMEMORY_LLM_TIMEOUT_MS: "${AGENTMEMORY_LLM_TIMEOUT_MS:-}"
+ AGENTMEMORY_MAX_PROVIDER_CONCURRENCY: "${AGENTMEMORY_MAX_PROVIDER_CONCURRENCY:-}"
AGENTMEMORY_CAPTURE_MAX_ATTEMPTS: "${AGENTMEMORY_CAPTURE_MAX_ATTEMPTS:-}"
AGENTMEMORY_CAPTURE_RETRY_INTERVAL_MS: "${AGENTMEMORY_CAPTURE_RETRY_INTERVAL_MS:-}"
AGENTMEMORY_CAPTURE_DEDUP_HOURS: "${AGENTMEMORY_CAPTURE_DEDUP_HOURS:-}"
diff --git a/docker-compose.yml b/docker-compose.yml
index cd236d8243..64232d7b34 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -88,6 +88,7 @@ services:
OPENROUTER_EMBEDDING_MODEL: "${OPENROUTER_EMBEDDING_MODEL:-}"
OPENROUTER_EMBEDDING_DIMENSIONS: "${OPENROUTER_EMBEDDING_DIMENSIONS:-}"
AGENTMEMORY_LLM_TIMEOUT_MS: "${AGENTMEMORY_LLM_TIMEOUT_MS:-}"
+ AGENTMEMORY_MAX_PROVIDER_CONCURRENCY: "${AGENTMEMORY_MAX_PROVIDER_CONCURRENCY:-}"
AGENTMEMORY_CAPTURE_MAX_ATTEMPTS: "${AGENTMEMORY_CAPTURE_MAX_ATTEMPTS:-}"
AGENTMEMORY_CAPTURE_RETRY_INTERVAL_MS: "${AGENTMEMORY_CAPTURE_RETRY_INTERVAL_MS:-}"
AGENTMEMORY_CAPTURE_DEDUP_HOURS: "${AGENTMEMORY_CAPTURE_DEDUP_HOURS:-}"
diff --git a/plugin/skills/agentmemory-config/REFERENCE.md b/plugin/skills/agentmemory-config/REFERENCE.md
index 7d58384e26..ab1360a1b9 100644
--- a/plugin/skills/agentmemory-config/REFERENCE.md
+++ b/plugin/skills/agentmemory-config/REFERENCE.md
@@ -3,7 +3,7 @@
Generated by scanning `src/` for `AGENTMEMORY_*` usage. Do not edit the block below by hand; run `npm run skills:gen` after adding or removing a variable. Internal markers ending in two underscores are excluded.
-Configuration is read from the environment and from `~/.agentmemory/.env` (no `export` prefix). 75 recognized variables:
+Configuration is read from the environment and from `~/.agentmemory/.env` (no `export` prefix). 76 recognized variables:
- `AGENTMEMORY_AGENT_SCOPE`
- `AGENTMEMORY_ALLOW_AGENT_SDK`
@@ -51,6 +51,7 @@ Configuration is read from the environment and from `~/.agentmemory/.env` (no `e
- `AGENTMEMORY_INJECT_CONTEXT`
- `AGENTMEMORY_LLM_NOTHINK`
- `AGENTMEMORY_LLM_TIMEOUT_MS`
+- `AGENTMEMORY_MAX_PROVIDER_CONCURRENCY`
- `AGENTMEMORY_MCP_BLOCK`
- `AGENTMEMORY_METRICS_PORT`
- `AGENTMEMORY_PRE_COMPACT_BUDGET`
diff --git a/src/cli/compose-project.ts b/src/cli/compose-project.ts
index b84896aa10..6c0b1fb549 100644
--- a/src/cli/compose-project.ts
+++ b/src/cli/compose-project.ts
@@ -65,7 +65,8 @@ const AGENTMEMORY_WORKER_ENV_ALLOWLIST = new Set([
"CLAUDE_MEMORY_LINE_BUDGET", "CLAUDE_PROJECT_PATH", "AGENTMEMORY_SUPPRESS_COST_WARNING",
"FALLBACK_PROVIDERS", "OPENAI_API_VERSION", "OPENAI_REASONING_EFFORT", "OPENAI_TIMEOUT_MS",
"MINIMAX_BASE_URL", "OPENROUTER_EMBEDDING_MODEL", "OPENROUTER_EMBEDDING_DIMENSIONS",
- "AGENTMEMORY_LLM_TIMEOUT_MS", "AGENTMEMORY_CAPTURE_MAX_ATTEMPTS",
+ "AGENTMEMORY_LLM_TIMEOUT_MS", "AGENTMEMORY_MAX_PROVIDER_CONCURRENCY",
+ "AGENTMEMORY_CAPTURE_MAX_ATTEMPTS",
"AGENTMEMORY_CAPTURE_RETRY_INTERVAL_MS", "AGENTMEMORY_CAPTURE_DEDUP_HOURS",
"AGENTMEMORY_CAPTURE_INBOX_MAX", "AGENTMEMORY_CAPTURE_DEAD_MAX", "AGENTMEMORY_CAPTURE_EVENTS_MAX",
"AGENTMEMORY_CAPTURE_SPOOL", "AGENTMEMORY_CAPTURE_SPOOL_DIR",
From 91c6752614497fb9301ec793c8c5005b81af0b39 Mon Sep 17 00:00:00 2001
From: Omar Gerardo
Date: Fri, 30 Oct 2026 12:14:32 +0800
Subject: [PATCH 09/11] test(providers): pin the queue cap and that overflow
never trips the breaker
provider_queue_full is thrown before the call reaches the provider, so it must
not be recorded as a breaker failure. The test fails if MAX_QUEUED is raised
past the burst. Also fix a stale "default of 4" comment; the default is 6.
---
test/resilient-provider.test.ts | 27 ++++++++++++++++++++++++++-
1 file changed, 26 insertions(+), 1 deletion(-)
diff --git a/test/resilient-provider.test.ts b/test/resilient-provider.test.ts
index 22253cce14..792aa5eb13 100644
--- a/test/resilient-provider.test.ts
+++ b/test/resilient-provider.test.ts
@@ -55,7 +55,7 @@ describe("ResilientProvider concurrency", () => {
if (n <= 2) throw new Error("boom");
return "ok";
});
- // maxConcurrent 1 is load-bearing here: at the default of 4 a leaked slot
+ // maxConcurrent 1 is load-bearing here: at the default of 6 a leaked slot
// would not deadlock, and the test would pass despite the bug.
const provider = new ResilientProvider(inner, { maxConcurrent: 1 });
@@ -66,6 +66,31 @@ describe("ResilientProvider concurrency", () => {
expect(settled).toHaveLength(5);
expect(settled.filter((s) => s.status === "fulfilled")).toHaveLength(3);
});
+
+ it("rejects calls past the queue cap without tripping the breaker", async () => {
+ let release!: () => void;
+ const gate = new Promise((resolve) => {
+ release = () => resolve("ok");
+ });
+ const inner = countingProvider(() => gate);
+ const provider = new ResilientProvider(inner, { maxConcurrent: 1 });
+
+ // One call in flight plus 512 queued fills the gate; the rest overflow.
+ const calls = Array.from({ length: 516 }, () =>
+ provider.compress("sys", "user"),
+ );
+ const overflow = await Promise.allSettled(calls.slice(513));
+ release();
+ const admitted = await Promise.allSettled(calls.slice(0, 513));
+
+ expect(overflow.every((s) => s.status === "rejected")).toBe(true);
+ expect(
+ overflow.map((s) => (s as PromiseRejectedResult).reason.message),
+ ).toEqual(["provider_queue_full", "provider_queue_full", "provider_queue_full"]);
+ expect(admitted.every((s) => s.status === "fulfilled")).toBe(true);
+ expect(inner.calls).toBe(513);
+ expect(provider.circuitState.state).toBe("closed");
+ });
});
describe("ResilientProvider rate limiting", () => {
From 34d29d07517fd7e065afd5e3129afbf2d4e9e1cd Mon Sep 17 00:00:00 2001
From: Omar Gerardo
Date: Fri, 30 Oct 2026 12:14:33 +0800
Subject: [PATCH 10/11] chore(providers): run docs:sync after the provider
tests push the count past 4,100
---
AGENTS.md | 4 ++--
README.md | 4 ++--
READMEs/README.ar-SA.md | 4 ++--
READMEs/README.bn-BD.md | 4 ++--
READMEs/README.cs-CZ.md | 4 ++--
READMEs/README.da-DK.md | 4 ++--
READMEs/README.de-DE.md | 4 ++--
READMEs/README.el-GR.md | 4 ++--
READMEs/README.es-ES.md | 4 ++--
READMEs/README.fi-FI.md | 4 ++--
READMEs/README.fr-FR.md | 4 ++--
READMEs/README.he-IL.md | 4 ++--
READMEs/README.hi-IN.md | 4 ++--
READMEs/README.hu-HU.md | 4 ++--
READMEs/README.id-ID.md | 4 ++--
READMEs/README.it-IT.md | 4 ++--
READMEs/README.ja-JP.md | 4 ++--
READMEs/README.ko-KR.md | 4 ++--
READMEs/README.nb-NO.md | 4 ++--
READMEs/README.nl-NL.md | 4 ++--
READMEs/README.pl-PL.md | 4 ++--
READMEs/README.pt-BR.md | 4 ++--
READMEs/README.pt-PT.md | 4 ++--
READMEs/README.ro-RO.md | 4 ++--
READMEs/README.ru-RU.md | 4 ++--
READMEs/README.sv-SE.md | 4 ++--
READMEs/README.th-TH.md | 4 ++--
READMEs/README.tl-PH.md | 4 ++--
READMEs/README.tr-TR.md | 4 ++--
READMEs/README.uk-UA.md | 4 ++--
READMEs/README.ur-PK.md | 4 ++--
READMEs/README.vi-VN.md | 4 ++--
READMEs/README.zh-CN.md | 4 ++--
READMEs/README.zh-TW.md | 4 ++--
assets/tags/light/stat-tests.svg | 4 ++--
assets/tags/stat-tests.svg | 4 ++--
scripts/docs-sync.state.json | 2 +-
37 files changed, 73 insertions(+), 73 deletions(-)
diff --git a/AGENTS.md b/AGENTS.md
index 6c88f558e2..c53122c1e1 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -101,7 +101,7 @@ Hook scripts in `src/hooks/` are standalone Node.js scripts (no iii-sdk import).
## Testing
-- Before every commit run, in order: `npm run build`, `npm run skills:gen`, `npm run docs:sync`, `npm run skills:check`, `npm test` (4,000+ tests). Commit anything the generators changed. CI runs the same build, skills check and tests.
+- Before every commit run, in order: `npm run build`, `npm run skills:gen`, `npm run docs:sync`, `npm run skills:check`, `npm test` (4,100+ tests). Commit anything the generators changed. CI runs the same build, skills check and tests.
- Before any npm publish: `npm run release:gate` must pass. It installs the packed tarballs into a clean home and runs capture, recovery, restart, export/import, MCP and status checks against the installed CLI (see CONTRIBUTING.md, Release process)
- Mock pattern: `vi.mock("iii-sdk")` with mock `sdk.trigger`, `kv.get/set/list`
- Test files go in `test/` with `.test.ts` extension
@@ -114,4 +114,4 @@ Hook scripts in `src/hooks/` are standalone Node.js scripts (no iii-sdk import).
- 6 MCP resources, 3 MCP prompts
- 12 hooks, 17 skills
- 322+ iii functions
-- 4,000+ tests
+- 4,100+ tests
diff --git a/README.md b/README.md
index 0cc41b258a..b371b080e4 100644
--- a/README.md
+++ b/README.md
@@ -69,7 +69,7 @@
-
+
@@ -1307,7 +1307,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization:
```bash
npm run dev # Hot reload
npm run build # Production build
-npm test # 4,000+ tests
+npm test # 4,100+ tests
npm run test:integration # API tests (requires running services)
```
diff --git a/READMEs/README.ar-SA.md b/READMEs/README.ar-SA.md
index 3199b8a8d7..432c2446ec 100644
--- a/READMEs/README.ar-SA.md
+++ b/READMEs/README.ar-SA.md
@@ -71,7 +71,7 @@
-
+
@@ -1242,7 +1242,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization:
```bash
npm run dev # Hot reload
npm run build # Production build
-npm test # 4,000+ tests
+npm test # 4,100+ tests
npm run test:integration # API tests (requires running services)
```
diff --git a/READMEs/README.bn-BD.md b/READMEs/README.bn-BD.md
index 8fe8425a88..8a85ba1375 100644
--- a/READMEs/README.bn-BD.md
+++ b/READMEs/README.bn-BD.md
@@ -69,7 +69,7 @@
-
+
@@ -1255,7 +1255,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization:
```bash
npm run dev # Hot reload
npm run build # Production build
-npm test # 4,000+ tests
+npm test # 4,100+ tests
npm run test:integration # API tests (requires running services)
```
diff --git a/READMEs/README.cs-CZ.md b/READMEs/README.cs-CZ.md
index d0960e654a..6733e9778b 100644
--- a/READMEs/README.cs-CZ.md
+++ b/READMEs/README.cs-CZ.md
@@ -69,7 +69,7 @@
-
+
@@ -1241,7 +1241,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization:
```bash
npm run dev # Hot reload
npm run build # Production build
-npm test # 4,000+ tests
+npm test # 4,100+ tests
npm run test:integration # API tests (requires running services)
```
diff --git a/READMEs/README.da-DK.md b/READMEs/README.da-DK.md
index 0c124bb1b3..986f11e1c0 100644
--- a/READMEs/README.da-DK.md
+++ b/READMEs/README.da-DK.md
@@ -69,7 +69,7 @@
-
+
@@ -1249,7 +1249,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization:
```bash
npm run dev # Hot reload
npm run build # Production build
-npm test # 4,000+ tests
+npm test # 4,100+ tests
npm run test:integration # API tests (requires running services)
```
diff --git a/READMEs/README.de-DE.md b/READMEs/README.de-DE.md
index 25d246df90..7a7aee598b 100644
--- a/READMEs/README.de-DE.md
+++ b/READMEs/README.de-DE.md
@@ -69,7 +69,7 @@
-
+
@@ -1247,7 +1247,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization:
```bash
npm run dev # Hot reload
npm run build # Production build
-npm test # 4,000+ tests
+npm test # 4,100+ tests
npm run test:integration # API tests (requires running services)
```
diff --git a/READMEs/README.el-GR.md b/READMEs/README.el-GR.md
index 9fdaf0a8ed..da436a98c1 100644
--- a/READMEs/README.el-GR.md
+++ b/READMEs/README.el-GR.md
@@ -69,7 +69,7 @@
-
+
@@ -1241,7 +1241,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization:
```bash
npm run dev # Hot reload
npm run build # Production build
-npm test # 4,000+ tests
+npm test # 4,100+ tests
npm run test:integration # API tests (requires running services)
```
diff --git a/READMEs/README.es-ES.md b/READMEs/README.es-ES.md
index 9e646f18ae..9a2add4427 100644
--- a/READMEs/README.es-ES.md
+++ b/READMEs/README.es-ES.md
@@ -69,7 +69,7 @@
-
+
@@ -1243,7 +1243,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization:
```bash
npm run dev # Hot reload
npm run build # Production build
-npm test # 4,000+ tests
+npm test # 4,100+ tests
npm run test:integration # API tests (requires running services)
```
diff --git a/READMEs/README.fi-FI.md b/READMEs/README.fi-FI.md
index 0af45964b9..f0d7093a4f 100644
--- a/READMEs/README.fi-FI.md
+++ b/READMEs/README.fi-FI.md
@@ -69,7 +69,7 @@
-
+
@@ -1241,7 +1241,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization:
```bash
npm run dev # Hot reload
npm run build # Production build
-npm test # 4,000+ tests
+npm test # 4,100+ tests
npm run test:integration # API tests (requires running services)
```
diff --git a/READMEs/README.fr-FR.md b/READMEs/README.fr-FR.md
index 6e8a3510ae..60ed0f017a 100644
--- a/READMEs/README.fr-FR.md
+++ b/READMEs/README.fr-FR.md
@@ -69,7 +69,7 @@
-
+
@@ -1250,7 +1250,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization:
```bash
npm run dev # Hot reload
npm run build # Production build
-npm test # 4,000+ tests
+npm test # 4,100+ tests
npm run test:integration # API tests (requires running services)
```
diff --git a/READMEs/README.he-IL.md b/READMEs/README.he-IL.md
index 6cd626a723..580e9069b0 100644
--- a/READMEs/README.he-IL.md
+++ b/READMEs/README.he-IL.md
@@ -71,7 +71,7 @@
-
+
@@ -1242,7 +1242,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization:
```bash
npm run dev # Hot reload
npm run build # Production build
-npm test # 4,000+ tests
+npm test # 4,100+ tests
npm run test:integration # API tests (requires running services)
```
diff --git a/READMEs/README.hi-IN.md b/READMEs/README.hi-IN.md
index c8fbebef85..04eb563111 100644
--- a/READMEs/README.hi-IN.md
+++ b/READMEs/README.hi-IN.md
@@ -69,7 +69,7 @@
-
+
@@ -1256,7 +1256,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization:
```bash
npm run dev # Hot reload
npm run build # Production build
-npm test # 4,000+ tests
+npm test # 4,100+ tests
npm run test:integration # API tests (requires running services)
```
diff --git a/READMEs/README.hu-HU.md b/READMEs/README.hu-HU.md
index 864dbdb03c..2951739da5 100644
--- a/READMEs/README.hu-HU.md
+++ b/READMEs/README.hu-HU.md
@@ -69,7 +69,7 @@
-
+
@@ -1239,7 +1239,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization:
```bash
npm run dev # Hot reload
npm run build # Production build
-npm test # 4,000+ tests
+npm test # 4,100+ tests
npm run test:integration # API tests (requires running services)
```
diff --git a/READMEs/README.id-ID.md b/READMEs/README.id-ID.md
index 37ee206858..b9b300ebfc 100644
--- a/READMEs/README.id-ID.md
+++ b/READMEs/README.id-ID.md
@@ -69,7 +69,7 @@
-
+
@@ -1256,7 +1256,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization:
```bash
npm run dev # Hot reload
npm run build # Production build
-npm test # 4,000+ tests
+npm test # 4,100+ tests
npm run test:integration # API tests (requires running services)
```
diff --git a/READMEs/README.it-IT.md b/READMEs/README.it-IT.md
index 8bf8a07fc9..76c4267bd3 100644
--- a/READMEs/README.it-IT.md
+++ b/READMEs/README.it-IT.md
@@ -69,7 +69,7 @@
-
+
@@ -1249,7 +1249,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization:
```bash
npm run dev # Hot reload
npm run build # Production build
-npm test # 4,000+ tests
+npm test # 4,100+ tests
npm run test:integration # API tests (requires running services)
```
diff --git a/READMEs/README.ja-JP.md b/READMEs/README.ja-JP.md
index ce2d9dee07..5f3bd8dd2d 100644
--- a/READMEs/README.ja-JP.md
+++ b/READMEs/README.ja-JP.md
@@ -69,7 +69,7 @@
-
+
@@ -1255,7 +1255,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization:
```bash
npm run dev # Hot reload
npm run build # Production build
-npm test # 4,000+ tests
+npm test # 4,100+ tests
npm run test:integration # API tests (requires running services)
```
diff --git a/READMEs/README.ko-KR.md b/READMEs/README.ko-KR.md
index 9958760be9..75ea0ac701 100644
--- a/READMEs/README.ko-KR.md
+++ b/READMEs/README.ko-KR.md
@@ -69,7 +69,7 @@
-
+
@@ -1254,7 +1254,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization:
```bash
npm run dev # Hot reload
npm run build # Production build
-npm test # 4,000+ tests
+npm test # 4,100+ tests
npm run test:integration # API tests (requires running services)
```
diff --git a/READMEs/README.nb-NO.md b/READMEs/README.nb-NO.md
index 56ebebc6ba..59f55f0809 100644
--- a/READMEs/README.nb-NO.md
+++ b/READMEs/README.nb-NO.md
@@ -69,7 +69,7 @@
-
+
@@ -1247,7 +1247,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization:
```bash
npm run dev # Hot reload
npm run build # Production build
-npm test # 4,000+ tests
+npm test # 4,100+ tests
npm run test:integration # API tests (requires running services)
```
diff --git a/READMEs/README.nl-NL.md b/READMEs/README.nl-NL.md
index 569d1fb29c..d5f8c62a3d 100644
--- a/READMEs/README.nl-NL.md
+++ b/READMEs/README.nl-NL.md
@@ -69,7 +69,7 @@
-
+
@@ -1243,7 +1243,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization:
```bash
npm run dev # Hot reload
npm run build # Production build
-npm test # 4,000+ tests
+npm test # 4,100+ tests
npm run test:integration # API tests (requires running services)
```
diff --git a/READMEs/README.pl-PL.md b/READMEs/README.pl-PL.md
index bdbe4eea32..d20aa558c1 100644
--- a/READMEs/README.pl-PL.md
+++ b/READMEs/README.pl-PL.md
@@ -69,7 +69,7 @@
-
+
@@ -1239,7 +1239,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization:
```bash
npm run dev # Hot reload
npm run build # Production build
-npm test # 4,000+ tests
+npm test # 4,100+ tests
npm run test:integration # API tests (requires running services)
```
diff --git a/READMEs/README.pt-BR.md b/READMEs/README.pt-BR.md
index b076d8d82e..c6c37e69f3 100644
--- a/READMEs/README.pt-BR.md
+++ b/READMEs/README.pt-BR.md
@@ -69,7 +69,7 @@
-
+
@@ -1247,7 +1247,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization:
```bash
npm run dev # Hot reload
npm run build # Production build
-npm test # 4,000+ tests
+npm test # 4,100+ tests
npm run test:integration # API tests (requires running services)
```
diff --git a/READMEs/README.pt-PT.md b/READMEs/README.pt-PT.md
index 36ff810e19..0b57b1b8db 100644
--- a/READMEs/README.pt-PT.md
+++ b/READMEs/README.pt-PT.md
@@ -69,7 +69,7 @@
-
+
@@ -1243,7 +1243,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization:
```bash
npm run dev # Hot reload
npm run build # Production build
-npm test # 4,000+ tests
+npm test # 4,100+ tests
npm run test:integration # API tests (requires running services)
```
diff --git a/READMEs/README.ro-RO.md b/READMEs/README.ro-RO.md
index 890afccaef..3e1f4c5870 100644
--- a/READMEs/README.ro-RO.md
+++ b/READMEs/README.ro-RO.md
@@ -69,7 +69,7 @@
-
+
@@ -1235,7 +1235,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization:
```bash
npm run dev # Hot reload
npm run build # Production build
-npm test # 4,000+ tests
+npm test # 4,100+ tests
npm run test:integration # API tests (requires running services)
```
diff --git a/READMEs/README.ru-RU.md b/READMEs/README.ru-RU.md
index af94d55bbb..3ea4e5de29 100644
--- a/READMEs/README.ru-RU.md
+++ b/READMEs/README.ru-RU.md
@@ -69,7 +69,7 @@
-
+
@@ -1241,7 +1241,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization:
```bash
npm run dev # Hot reload
npm run build # Production build
-npm test # 4,000+ tests
+npm test # 4,100+ tests
npm run test:integration # API tests (requires running services)
```
diff --git a/READMEs/README.sv-SE.md b/READMEs/README.sv-SE.md
index a130b39bd2..3c3e72e866 100644
--- a/READMEs/README.sv-SE.md
+++ b/READMEs/README.sv-SE.md
@@ -69,7 +69,7 @@
-
+
@@ -1249,7 +1249,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization:
```bash
npm run dev # Hot reload
npm run build # Production build
-npm test # 4,000+ tests
+npm test # 4,100+ tests
npm run test:integration # API tests (requires running services)
```
diff --git a/READMEs/README.th-TH.md b/READMEs/README.th-TH.md
index b549a34e6a..76671822b6 100644
--- a/READMEs/README.th-TH.md
+++ b/READMEs/README.th-TH.md
@@ -69,7 +69,7 @@
-
+
@@ -1242,7 +1242,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization:
```bash
npm run dev # Hot reload
npm run build # Production build
-npm test # 4,000+ tests
+npm test # 4,100+ tests
npm run test:integration # API tests (requires running services)
```
diff --git a/READMEs/README.tl-PH.md b/READMEs/README.tl-PH.md
index 2d4dcfe47d..ff68ebdba6 100644
--- a/READMEs/README.tl-PH.md
+++ b/READMEs/README.tl-PH.md
@@ -69,7 +69,7 @@
-
+
@@ -1251,7 +1251,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization:
```bash
npm run dev # Hot reload
npm run build # Production build
-npm test # 4,000+ tests
+npm test # 4,100+ tests
npm run test:integration # API tests (requires running services)
```
diff --git a/READMEs/README.tr-TR.md b/READMEs/README.tr-TR.md
index 0b08152ae9..a5d36b5299 100644
--- a/READMEs/README.tr-TR.md
+++ b/READMEs/README.tr-TR.md
@@ -69,7 +69,7 @@
-
+
@@ -1241,7 +1241,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization:
```bash
npm run dev # Hot reload
npm run build # Production build
-npm test # 4,000+ tests
+npm test # 4,100+ tests
npm run test:integration # API tests (requires running services)
```
diff --git a/READMEs/README.uk-UA.md b/READMEs/README.uk-UA.md
index ad26bff5c1..4033a79f17 100644
--- a/READMEs/README.uk-UA.md
+++ b/READMEs/README.uk-UA.md
@@ -69,7 +69,7 @@
-
+
@@ -1242,7 +1242,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization:
```bash
npm run dev # Hot reload
npm run build # Production build
-npm test # 4,000+ tests
+npm test # 4,100+ tests
npm run test:integration # API tests (requires running services)
```
diff --git a/READMEs/README.ur-PK.md b/READMEs/README.ur-PK.md
index 62602b9130..53f941522e 100644
--- a/READMEs/README.ur-PK.md
+++ b/READMEs/README.ur-PK.md
@@ -71,7 +71,7 @@
-
+
@@ -1246,7 +1246,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization:
```bash
npm run dev # Hot reload
npm run build # Production build
-npm test # 4,000+ tests
+npm test # 4,100+ tests
npm run test:integration # API tests (requires running services)
```
diff --git a/READMEs/README.vi-VN.md b/READMEs/README.vi-VN.md
index 3a7879a3f5..2be083144f 100644
--- a/READMEs/README.vi-VN.md
+++ b/READMEs/README.vi-VN.md
@@ -69,7 +69,7 @@
-
+
@@ -1251,7 +1251,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization:
```bash
npm run dev # Hot reload
npm run build # Production build
-npm test # 4,000+ tests
+npm test # 4,100+ tests
npm run test:integration # API tests (requires running services)
```
diff --git a/READMEs/README.zh-CN.md b/READMEs/README.zh-CN.md
index b12e7fe2fd..a96226f914 100644
--- a/READMEs/README.zh-CN.md
+++ b/READMEs/README.zh-CN.md
@@ -69,7 +69,7 @@
-
+
@@ -1252,7 +1252,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization:
```bash
npm run dev # Hot reload
npm run build # Production build
-npm test # 4,000+ tests
+npm test # 4,100+ tests
npm run test:integration # API tests (requires running services)
```
diff --git a/READMEs/README.zh-TW.md b/READMEs/README.zh-TW.md
index bfd866fee0..5ed8dc3dce 100644
--- a/READMEs/README.zh-TW.md
+++ b/READMEs/README.zh-TW.md
@@ -69,7 +69,7 @@
-
+
@@ -1244,7 +1244,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization:
```bash
npm run dev # Hot reload
npm run build # Production build
-npm test # 4,000+ tests
+npm test # 4,100+ tests
npm run test:integration # API tests (requires running services)
```
diff --git a/assets/tags/light/stat-tests.svg b/assets/tags/light/stat-tests.svg
index 915e1bab9d..7248bfad00 100644
--- a/assets/tags/light/stat-tests.svg
+++ b/assets/tags/light/stat-tests.svg
@@ -1,5 +1,5 @@
-