openclaw-test-heap-leaks
Investigate OpenClaw pnpm test memory growth, Vitest OOMs, RSS spikes, and heap snapshot deltas.
Skill by openclaw
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/openclaw-openclaw-test-heap-leaks
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: testing, marketing
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
- Runs as
- Node.js package
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/openclaw-test-heap-leaks
What's inside
- Skill name
openclaw-test-heap-leaks- Description
- Investigate OpenClaw pnpm test memory growth, Vitest OOMs, RSS spikes, and heap snapshot deltas.
- License
- MIT
- Instructions
- 112 lines in SKILL.md · view on GitHub
Before installing
- Ships executable scripts
Agent Skills spec issues
- files: referenced but missing: scripts/test-projects.mts, scripts/test-projects.test-support.mjs, scripts/test-group-report.mts, scripts/run-vitest-profile.mts, scripts/embedded-run-abort-leak.ts
Files (3)
- SKILL.md
- openai.yaml · agents/
- heapsnapshot-delta.mjs · scripts/
SKILL.md (first lines)
# 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](#validating-runtime-fixes-not-test-memory) below — that uses a dedicated harness rather than the unit-test profiling workflow.
## Workflow
1. 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:
```bash
pnpm test:perf:groups \
--config test/vitest/vitest.unit-fast.config.ts \
--allow-failures \
--output .artifacts/test-perf/unit-fast-memory.json
```
- For 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 test` execution is planned by `scripts/test-projects.mts`. Record the printed Vitest config or shard and preserve that shape when the report is configuration- or worker-budget-specific.
2. 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 `.heapprofile` output is not a `.heapsnapshot`; do not pass it to the snapshot delta helper.
- When a dedicated harness or another known producer emits repeated `.heapsnapshot` files, 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.
3. 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.
4. 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.ts` is 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.
5. 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`, and `scripts/run-vitest-profile.mts` are the current execution, grouped-RSS, and profile entrypoints.
- The `[test] starting ...` lines identify the Vitest config or shard to reproduce.
- `.artifacts/vitest-shard-timings.json` stores 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 first. Large positive growth in module-transform artifacts points to shared-process lifetime or project ownership; large positive growth in runtime objects suggests a real leak. If the names alone do not settle it, open the same snapshot pair in DevTools and inspect retainers/dominators for the top rows before declaring root cause.
## Validating runtime fixes (not test-memory)
The workflow above is for diagnosing Vitest worker memory growth. For
validating that a runtime/closure fix actually releases captured state, use the
dedicated harness:
- `pnpm leak:embedded-run` — runs `scripts/embedded-run-abort-leak.ts`. Loops N
aborted runs in a function-shaped scope mimicking `runEmbeddedAttempt`,
writes heap snapshots, and reports a PASS/FAIL verdict on retention growth
using `FinalizationRegistry` for tracked-instance counting plus RSS delta.
Modes:
- `closure-extracted` (default) — production fix shape (helper at module scope).
- `closure-inline` — pre-fix shape (closure inside the runner scope). Use as a
sensitivity check: if it passes you've broken the harness, not fixed a bug.
- `synthetic-leak` — deliberately retains via a module-level bucket. Use to
confirm the harness can detect leaks before trusting a PASS on a real fix.
Snapshots land in `.tmp/embedded-run-abort-leak/`. Diff with the same script
as above:
```
node .agents/skills/openclaw-test-heap-leaks/scripts/heapsnapshot-delta.mjs \
.tmp/embedded-run-abort-leak/baseline-*.heapsnapshot \
.tmp/embedded-run-abort-leak/batch-N-*.heapsnapshot --top 30
```
When fixing a different runtime leak, add a new harness alongside this one
rather than retrofitting it. The fixture function should mimic the lexical
scope of the function where the leak lives, not be a generic abort-loop.
## Output Expectations
When using this skill, report:
- The exact reproduce command.
- Which Vitest config or target was reproduced, and which PID was compared when snapshots were available.
- The dominant retained object families from the heap profile or snapshot delta, when available.
- Whether the issue is a likely real leak or likely shared-worker retained module growth, plus whether retainers/dominators confirmed it.
- The concrete fix or impact-reduction patch.
- What you verified, and what snapshot overhead prevented you from verifying.From openclaw/openclaw, MIT.
More from openclaw/openclaw
- 0.767score
openclaw-live-updater
openclaw
Maintain the canonical live OpenClaw main checkout, macOS LaunchAgent-managed Gateway, local macOS app, exact-head main CI, and recurring full release…
SkillAFreshness: A★ 392.9KClaude Code +9 - 0.766score
feishu-doc
openclaw
Feishu document read/write workflows.
SkillAFreshness: A★ 392.9KClaude Code +9 - 0.764score
slack-e2e
openclaw
Test Slack with Convex-leased user OAuth or QA bots; check credentials, exercise owned messages, prove Gateway behavior, and distinguish API evidence from…
SkillAFreshness: A★ 392.9KClaude Code +9 - 0.764score
openclaw-release-validation
openclaw
Guide human release testing on an isolated OCM copy or approved in-place gateway, collect feedback, or refresh the release campaign.
SkillAFreshness: A★ 392.9KClaude Code +9 - 0.764score
auto-qa
openclaw
Run OpenClaw-wide autonomous QA and live/stress campaigns across independent subsystem lanes, with verified fixes and a resumable evidence report.
SkillAFreshness: A★ 392.9KClaude Code +9 - 0.764score
plugin-sdk-impact
openclaw
Count Plugin SDK consumers across live ClawHub releases and bundled OpenClaw plugins before deprecation, removal, or behavior changes; supports public…
SkillAFreshness: A★ 392.9KClaude Code +9 - 0.764score
discord-e2e
openclaw
Test Discord with Convex-leased QA bots: check credentials without a Gateway, exercise owned messages, or prove OpenClaw replies, files, threads, reactions…
SkillAFreshness: A★ 392.9KClaude Code +9 - 0.764score
proof-video
openclaw
Capture and annotate PR screenshots and videos with measured arrows, outlines, alignment guides, spacing brackets, captions, zoom, and speed cues.
SkillAFreshness: A★ 392.9KClaude Code +9 - 0.764score
claw-score
openclaw
Audit or refresh OpenClaw maturity scorecard docs from root taxonomy, maturity scores, and QA evidence artifacts without using maintainer discrawl data or…
SkillAFreshness: A★ 392.9KClaude Code +9 - 0.764score
openclaw-pr-maintainer
openclaw
Review, triage, repair, or land OpenClaw issues and pull requests with current-source evidence and the native maintainer workflow.
SkillAFreshness: A★ 392.9KClaude Code +9 - 0.764score
prototype-openclaw-tui
openclaw
Build throwaway, fixture-driven OpenClaw Clack or Pi TUI prototypes and compare multiple interactive variants side by side in tmux without running the full…
SkillAFreshness: A★ 392.9KClaude Code +9 - 0.764score
solid
openclaw
Write, refactor, review, or test Solid 2 UI in OpenClaw (Control UI, plugin views, Canvas hosts), including state ownership, native custom elements, overlays…
SkillAFreshness: A★ 392.9KClaude Code +9
Compare and alternatives
Featured in
Signals
- Stars
- 392,925
- Forks
- 82,585
- Open issues
- 4,992
- Last commit (this folder)
- Aug 9, 2026 (2 months ago)
- Last release
- Oct 24, 2026 (3 days ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/openclaw/openclaw
- Website
- openclaw.ai
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
Same skill elsewhere
Copies of this SKILL.md published by others; search shows only one of them.
- 0.312score
openclaw-test-heap-leaks
rudofopelomi-cell
Investigate OpenClaw pnpm test memory growth, Vitest OOMs, RSS spikes, and heap snapshot deltas.
SkillBFreshness: BClaude Code +9 - 0.292score
openclaw-test-heap-leaks
chenxingqiang
Investigate OpenClaw pnpm test memory growth, Vitest OOMs, RSS spikes, and heap snapshot deltas.
SkillCFreshness: C★ 1Claude Code +9 - 0.292score
openclaw-test-heap-leaks
JEROME-PRAKASH-L
Investigate OpenClaw pnpm test memory growth, Vitest OOMs, RSS spikes, and heap snapshot deltas.
SkillCFreshness: C★ 1Claude Code +9 - 0.292score
openclaw-test-heap-leaks
niroopn2005-art
Investigate OpenClaw pnpm test memory growth, Vitest OOMs, RSS spikes, and heap snapshot deltas.
SkillCFreshness: C★ 1Claude Code +9 - 0.279score
openclaw-test-heap-leaks
AmirulAndalib
Investigate OpenClaw pnpm test memory growth, Vitest OOMs, RSS spikes, and heap snapshot deltas.
SkillCFreshness: CClaude Code +9
More from openclaw
- 0.767score
openclaw-live-updater
openclaw
Maintain the canonical live OpenClaw main checkout, macOS LaunchAgent-managed Gateway, local macOS app, exact-head main CI, and recurring full release…
SkillAFreshness: A★ 392.9KClaude Code +9 - 0.766score
feishu-doc
openclaw
Feishu document read/write workflows.
SkillAFreshness: A★ 392.9KClaude Code +9 - 0.764score
openclaw-pr-maintainer
openclaw
Review, triage, repair, or land OpenClaw issues and pull requests with current-source evidence and the native maintainer workflow.
SkillAFreshness: A★ 392.9KClaude Code +9 - 0.764score
auto-qa
openclaw
Run OpenClaw-wide autonomous QA and live/stress campaigns across independent subsystem lanes, with verified fixes and a resumable evidence report.
SkillAFreshness: A★ 392.9KClaude Code +9 - 0.764score
claw-score
openclaw
Audit or refresh OpenClaw maturity scorecard docs from root taxonomy, maturity scores, and QA evidence artifacts without using maintainer discrawl data or…
SkillAFreshness: A★ 392.9KClaude Code +9 - 0.764score
discord-e2e
openclaw
Test Discord with Convex-leased QA bots: check credentials without a Gateway, exercise owned messages, or prove OpenClaw replies, files, threads, reactions…
SkillAFreshness: A★ 392.9KClaude Code +9
Cite this page
openclaw-test-heap-leaks skill. Agent Mart. https://agentmart.dev/skills/openclaw-openclaw-test-heap-leaks (last updated 2026-10-24)