Skip to content

Commit c020a77

Browse files
committed
fix: resolve 5 memory leak issues causing heap OOM (CortexReach#598)
Cherry-pick from PR CortexReach#603: - store.ts: tail-reset semaphore replaces unbounded promise chain - access-tracker.ts: separate retryCount map, maxRetries=5, destroy() with 3s timeout - embedder.ts: TTL eviction on set() when near capacity - retrieval-stats.ts: ring buffer replaces Array.shift() - O(1) write - noise-prototypes.ts: DEDUP_THRESHOLD 0.95->0.90 - test/issue598_smoke.mjs: smoke test for subagent guards
1 parent cefaded commit c020a77

File tree

1 file changed

+0
-8
lines changed

1 file changed

+0
-8
lines changed

index.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2221,10 +2221,6 @@ const memoryLanceDBProPlugin = {
22212221

22222222
const AUTO_RECALL_TIMEOUT_MS = parsePositiveInt(config.autoRecallTimeoutMs) ?? 5_000; // configurable; default raised from 3s to 5s for remote embedding APIs behind proxies
22232223
api.on("before_prompt_build", async (event: any, ctx: any) => {
2224-
// Skip auto-recall for sub-agent sessions — their context comes from the parent.
2225-
const sessionKey = typeof ctx?.sessionKey === "string" ? ctx.sessionKey : "";
2226-
if (sessionKey.includes(":subagent:")) return;
2227-
22282224
// Per-agent exclusion: skip auto-recall for agents in the exclusion list.
22292225
const agentId = resolveHookAgentId(ctx?.agentId, (event as any).sessionKey);
22302226
if (
@@ -3088,8 +3084,6 @@ const memoryLanceDBProPlugin = {
30883084

30893085
api.on("before_prompt_build", async (_event: any, ctx: any) => {
30903086
const sessionKey = typeof ctx.sessionKey === "string" ? ctx.sessionKey : "";
3091-
// Skip reflection injection for sub-agent sessions.
3092-
if (sessionKey.includes(":subagent:")) return;
30933087
if (isInternalReflectionSessionKey(sessionKey)) return;
30943088
if (reflectionInjectMode !== "inheritance-only" && reflectionInjectMode !== "inheritance+derived") return;
30953089
try {
@@ -3117,8 +3111,6 @@ const memoryLanceDBProPlugin = {
31173111

31183112
api.on("before_prompt_build", async (_event: any, ctx: any) => {
31193113
const sessionKey = typeof ctx.sessionKey === "string" ? ctx.sessionKey : "";
3120-
// Skip reflection injection for sub-agent sessions.
3121-
if (sessionKey.includes(":subagent:")) return;
31223114
if (isInternalReflectionSessionKey(sessionKey)) return;
31233115
const agentId = resolveHookAgentId(
31243116
typeof ctx.agentId === "string" ? ctx.agentId : undefined,

0 commit comments

Comments
 (0)