Openclaw Test Heap Leaks
Investigate OpenClaw pnpm test memory growth, Vitest OOMs, RSS spikes, and heap snapshot deltas.
от hillstreet-ph245 установок в других каталогах
Установить Openclaw Test Heap Leaks в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
OpenClaw Test Heap Leaks
Use this skill for test-memory investigations. Do not guess from RSS alone when heap snapshots are available. Treat snapshot-name deltas as triage evidence, not proof, until retainers or dominators support the call.
Read ../openclaw-test-performance/SKILL.md first for the current test-performance commands and proof routing.
For runtime fixes (e.g., closure leaks in long-running services like the gateway), see Validating runtime fixes below — that uses a dedicated harness rather than the unit-test profiling workflow.
Workflow
Reproduce the failing shape first.
Match the real entrypoint and worker budget. For a broad unit-fast baseline with per-config max RSS and top-file timing, start with:
pnpm test:perf:groups \ --config test/vitest/vitest.unit-fast.config.ts \ --allow-failures \ --output .artifacts/test-perf/unit-fast-memory.jsonFor a suspected file, rerun that file with one worker and collect wall/RSS evidence:
/usr/bin/time -l pnpm test <file> --maxWorkers=1 --reporter=verbose.Current
pnpm testexecution is planned byscripts/test-projects.mts. Record the printed Vitest config or shard and preserve that shape when the report is configuration- or worker-budget-specific.
Collect the strongest available heap evidence.
- Run
pnpm test:perf:profile:runner -- --output-dir .artifacts/test-perf/vitest-runner-profile -- <file>for a CPU profile plus a sampling heap profile of the unit runner. Open the heap profile in DevTools and inspect the largest allocation families. - Sampling
.heapprofileoutput is not a.heapsnapshot; do not pass it to the snapshot delta helper. - When a dedicated harness or another known producer emits repeated
.heapsnapshotfiles, compare snapshots from the same PID with.agents/skills/openclaw-test-heap-leaks/scripts/heapsnapshot-delta.mjs. - If no snapshot or heap profile is available, RSS growth is useful triage evidence, but keep the leak classification inconclusive.
- Run
Classify the growth before choosing a fix.
- If growth is dominated by Vite/Vitest transformed source strings,
Module,system / Context, bytecode, descriptor arrays, or property maps, treat it as likely retained module graph growth in long-lived workers. - If growth is dominated by app objects, caches, buffers, server handles, timers, mock state, sqlite state, or similar runtime objects, treat it as a likely cleanup or lifecycle leak.
- If the names are ambiguous, stop short of a confident label and inspect retainers/dominators in DevTools for the top deltas.
- If growth is dominated by Vite/Vitest transformed source strings,
Fix the right layer.
- For likely retained transformed-module growth in shared workers:
- Inspect the owning Vitest config and the process chunking in
scripts/test-projects.test-support.mjs. Fix process lifetime or project ownership there only when the same-shape evidence shows that shared-worker retention is the cause. test/vitest/vitest.unit-fast-isolated.config.tsis for audited stateful tests that need a fresh module graph. Do not use it as a generic memory-hotspot list.- For real leaks:
- Patch the implicated test or runtime cleanup path.
- Look for missing
afterEach/afterAll, module-reset gaps, retained global state, unreleased DB handles, or listeners/timers that survive the file.
Verify with the most direct proof.
- Re-run the same grouped or scoped command and confirm the max-RSS trend or OOM is reduced.
- When a dedicated producer emits heap profiles or snapshots, repeat the same producer and compare equivalent artifacts.
- For routing or config changes, verify the expected Vitest config or shard starts and the affected tests complete.
Heuristics
- Do not call everything a leak. Growth in a non-isolated shared Vitest project can be a worker-lifetime problem rather than an application object leak.
scripts/test-projects.mts,scripts/test-group-report.mts, andscripts/run-vitest-profile.mtsare the current execution, grouped-RSS, and profile entrypoints.- The
[test] starting ...lines identify the Vitest config or shard to reproduce. .artifacts/vitest-shard-timings.jsonstores config/shard durations for scheduling. It is not a file-level memory-hotspot or behavior manifest.- When the same retained object families grow across multiple intervals in the same worker PID, trust the snapshots over intuition, then confirm ambiguous calls with retainer evidence.
Snapshot Comparison
- Direct comparison:
node .agents/skills/openclaw-test-heap-leaks/scripts/heapsnapshot-delta.mjs before.heapsnapshot after.heapsnapshot
- Auto-select earliest/latest snapshots per PID within one lane:
node .agents/skills/openclaw-test-heap-leaks/scripts/heapsnapshot-delta.mjs --lane-dir <snapshot-directory>
- Useful flags:
--top 40--min-kb 32--pid 16133
Read the top positive deltas fir
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл Openclaw Test Heap Leaks?
Investigate OpenClaw pnpm test memory growth, Vitest OOMs, RSS spikes, and heap snapshot deltas.
Как установить скилл Openclaw Test Heap Leaks?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл Openclaw Test Heap Leaks запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
mcp-builder
AnthropicGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
claude-api
AnthropicReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
algorithmic-art
AnthropicCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
mcp-integration
AnthropicThis skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…