Source: Source pull request number: 735 in rohitg00/agentmemory (URL omitted to avoid GitHub cross-reference)
Title: fix(health): gate memory_critical on real memory pressure
Author: MarvinFS
State: open
Draft: no
Merged: no
Head: MarvinFS/agentmemory:fix/memory-critical-real-pressure @ d23ee8f
Base: main @ fd9e3bd
Labels: (none)
Changed files: 0
Commits: 0
Created: 2026-05-30T18:09:45Z
Updated: 2026-05-30T18:26:07Z
Closed: (not closed)
Merged at: (not merged)
Original PR body:
memory_critical fires whenever heapUsed/heapTotal > 95% && rss > 512MB. A busy Node process keeps its heap near-full by design, so that condition is effectively always true under normal load, producing chronic false-positive critical alerts that drown out real signals.
This adds a real-pressure gate: memory_critical now additionally requires a genuine pressure signal — either this process's absolute RSS has crossed a high ceiling (default 4 GB), or the host as a whole has run low on free RAM (default: < 10% of total free). The warn-level threshold is unchanged.
All bounds are env-overridable via resolveThresholdConfig(), which monitor.ts reads once at startup:
AGENTMEMORY_MEMORY_CRITICAL_RSS_MB (default 4096)
AGENTMEMORY_MEMORY_SYSTEM_FREE_FLOOR_RATIO (default 0.1; set to 0 to disable the system-memory check)
- existing knobs:
AGENTMEMORY_MEMORY_CRITICAL_PERCENT, AGENTMEMORY_MEMORY_WARN_PERCENT, AGENTMEMORY_MEMORY_RSS_FLOOR_MB
Uses only node:os; no new dependencies. test/health-thresholds.test.ts is updated for the new gate. Verified npm run build clean and npm test green on a fresh main checkout.
Summary by CodeRabbit
-
New Features
- Environment-variable overrides for memory threshold configuration (warning/critical levels) and system-free-memory ratio.
- Health monitor now loads threshold config at startup and applies it when evaluating snapshots.
-
Bug Fixes
- More accurate critical memory detection by combining process memory and host free-memory checks.
-
Tests
- Threshold tests updated to cover stricter RSS/system-memory gating and mock restoration.

Local branch:
Fork PR:
Fork decision:
Verification:
Notes:
Source: Source pull request number: 735 in rohitg00/agentmemory (URL omitted to avoid GitHub cross-reference)
Title: fix(health): gate memory_critical on real memory pressure
Author: MarvinFS
State: open
Draft: no
Merged: no
Head: MarvinFS/agentmemory:fix/memory-critical-real-pressure @ d23ee8f
Base: main @ fd9e3bd
Labels: (none)
Changed files: 0
Commits: 0
Created: 2026-05-30T18:09:45Z
Updated: 2026-05-30T18:26:07Z
Closed: (not closed)
Merged at: (not merged)
Original PR body:
memory_criticalfires wheneverheapUsed/heapTotal > 95% && rss > 512MB. A busy Node process keeps its heap near-full by design, so that condition is effectively always true under normal load, producing chronic false-positive critical alerts that drown out real signals.This adds a real-pressure gate:
memory_criticalnow additionally requires a genuine pressure signal — either this process's absolute RSS has crossed a high ceiling (default 4 GB), or the host as a whole has run low on free RAM (default: < 10% of total free). The warn-level threshold is unchanged.All bounds are env-overridable via
resolveThresholdConfig(), whichmonitor.tsreads once at startup:AGENTMEMORY_MEMORY_CRITICAL_RSS_MB(default 4096)AGENTMEMORY_MEMORY_SYSTEM_FREE_FLOOR_RATIO(default 0.1; set to 0 to disable the system-memory check)AGENTMEMORY_MEMORY_CRITICAL_PERCENT,AGENTMEMORY_MEMORY_WARN_PERCENT,AGENTMEMORY_MEMORY_RSS_FLOOR_MBUses only
node:os; no new dependencies.test/health-thresholds.test.tsis updated for the new gate. Verifiednpm run buildclean andnpm testgreen on a freshmaincheckout.Summary by CodeRabbit
New Features
Bug Fixes
Tests
Local branch:
Fork PR:
Fork decision:
Verification:
Notes: