Files
OmniRoute/scripts/check-permissions.sh
soyelmismo 74ba399e04 fix: address Gemini code review on OOM fix PR #2965
1. check-permissions.sh: swap NODE_OPTIONS flag order so runtime
   OMNIROUTE_MEMORY_MB override wins (last flag takes precedence)

2. comboMetrics.ts: evictOldestMetric(targetMap) now accepts the
   target map as parameter; cleanup timer iterates BOTH metrics
   AND shadowMetrics; null lastUsedAt falls back to Date.now()
   instead of epoch 0 (prevents premature eviction of intent-only
   entries)

3. providerRegistry.ts: remove Proxy wrapper — adds CPU/complexity
   overhead with zero memory savings since _REGISTRY_EAGER is
   already fully allocated and generator functions iterate all
   entries at startup. Simple re-export instead.

4. usage.ts: use per-cache TTL constants in cleanup timer
   (ANTIGRAVITY_MODELS_CACHE_TTL_MS=1min, others=5min) instead of
   single 10min SUB_CACHE_TTL_MS for all caches.

5. Add 18 unit tests for comboMetrics memory management covering:
   basic CRUD, shadow metrics, intent tracking, eviction at capacity,
   strategy tracking, and reset operations.
2026-05-30 22:13:59 -05:00

20 lines
747 B
Bash
Executable File

#!/bin/sh
set -e
# ── Memory limit override ──────────────────────────────────────────────
# If OMNIROUTE_MEMORY_MB is set, build NODE_OPTIONS dynamically so the
# user can tune heap size via environment without editing the Dockerfile.
if [ -n "$OMNIROUTE_MEMORY_MB" ]; then
export NODE_OPTIONS="${NODE_OPTIONS:-} --max-old-space-size=${OMNIROUTE_MEMORY_MB}"
fi
if [ -d "/app/data" ] && [ ! -w "/app/data" ]; then
echo "WARNING: /app/data is not writable by the current user (UID $(id -u))."
echo "Run this on the Docker host to fix:"
echo " sudo chown -R 1000:1000 ./data"
echo " chmod -R u+rwX ./data"
exit 1
fi
exec "$@"