Openclaw Test Heap Leaks logo

Openclaw Test Heap Leaks

CommunityPopular
SafeAI-Lab-X
openclaw-test-heap-leaks

Investigate `pnpm test` memory growth, Vitest worker OOMs, and suspicious RSS increases in OpenClaw using the `scripts/test-parallel.mjs` heap snapshot tooling. Use when Codex needs to reproduce test-lane memory growth, collect repeated `.heapsnapshot` files, compare snapshots from the same worker PID, distinguish transformed-module retention from real data leaks, and fix or reduce the impact by patching cleanup logic or isolating hotspot tests.

Overview

PublisherSafeAI-Lab-X
RepositoryClawKeeper
Skill nameopenclaw-test-heap-leaks
Stars
1K
Forks
57
Bundled files
2
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 2 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by SafeAI-Lab-X on GitHub. Read the source before you install it.

Installation

Install the Openclaw Test Heap Leaks AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/SafeAI-Lab-X/ClawKeeper/tree/main/legacy/clawkeeper-watcher/.agents/skills/openclaw-test-heap-leaks
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/SafeAI-Lab-X/ClawKeeper.git /tmp/ClawKeeper
mkdir -p .claude/skills
cp -r /tmp/ClawKeeper/legacy/clawkeeper-watcher/.agents/skills/openclaw-test-heap-leaks .claude/skills/openclaw-test-heap-leaks
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Openclaw Test Heap Leaks in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Openclaw Test Heap Leaks on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Openclaw Test Heap Leaks is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

OpenClaw Test Heap Leaks

Use this skill for test-memory investigations. Do not guess from RSS alone when heap snapshots are available.

Workflow

  1. Reproduce the failing shape first.

    • Match the real entrypoint if possible. For Linux CI-style unit failures, start with:
    • pnpm canvas:a2ui:bundle && OPENCLAW_TEST_MEMORY_TRACE=1 OPENCLAW_TEST_HEAPSNAPSHOT_INTERVAL_MS=60000 OPENCLAW_TEST_HEAPSNAPSHOT_DIR=.tmp/heapsnap OPENCLAW_TEST_WORKERS=2 OPENCLAW_TEST_MAX_OLD_SPACE_SIZE_MB=6144 pnpm test
    • Keep OPENCLAW_TEST_MEMORY_TRACE=1 enabled so the wrapper prints per-file RSS summaries alongside the snapshots.
    • If the report is about a specific shard or worker budget, preserve that shape.
  2. Wait for repeated snapshots before concluding anything.

    • Take at least two intervals from the same lane.
    • Compare snapshots from the same PID inside one lane directory such as .tmp/heapsnap/unit-fast/.
    • Use scripts/heapsnapshot-delta.mjs to compare either two files directly or the earliest/latest pair per PID in one lane directory.
  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 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.
  4. Fix the right layer.

    • For retained transformed-module growth in shared workers:
    • Move hotspot files out of unit-fast by updating test/fixtures/test-parallel.behavior.json.
    • Prefer singletonIsolated for files that are safe alone but inflate shared worker heaps.
    • If the file should already have been peeled out by timings but is absent from test/fixtures/test-timings.unit.json, call that out explicitly. Missing timings are a scheduling blind spot.
    • 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 targeted lane or file with heap snapshots enabled if the suite still finishes in reasonable time.
    • If snapshot overhead pushes tests over Vitest timeouts, fall back to the same lane without snapshots and confirm the RSS trend or OOM is reduced.
    • For wrapper-only changes, at minimum verify the expected lanes start and the snapshot files are written.

Heuristics

  • Do not call everything a leak. In this repo, large unit-fast growth can be a worker-lifetime problem rather than an application object leak.
  • scripts/test-parallel.mjs and scripts/test-parallel-memory.mjs are the primary control points for wrapper diagnostics.
  • The lane names printed by [test-parallel] start ... and [test-parallel][mem] summary ... tell you where to focus.
  • When one or two files account for most of the delta and they are missing from timings, reducing impact by isolating them is usually the first pragmatic fix.
  • When the same retained object families grow across multiple intervals in the same worker PID, trust the snapshots over intuition.

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 .tmp/heapsnap/unit-fast
  • Useful flags:
    • --top 40
    • --min-kb 32
    • --pid 16133

Read the top positive deltas first. Large positive growth in module-transform artifacts suggests lane isolation; large positive growth in runtime objects suggests a real leak.

Output Expectations

When using this skill, report:

  • The exact reproduce command.
  • Which lane and PID were compared.
  • The dominant retained object families from the snapshot delta.
  • Whether the issue is a real leak or shared-worker retained module growth.
  • The concrete fix or impact-reduction patch.
  • What you verified, and what snapshot overhead prevented you from verifying.

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Openclaw Test Heap Leaks AI skill do?

Investigate `pnpm test` memory growth, Vitest worker OOMs, and suspicious RSS increases in OpenClaw using the `scripts/test-parallel.mjs` heap snapshot tooling. Use when Codex needs to reproduce test-lane memory growth, collect repeated `.heapsnapshot` files, compare snapshots from the same worker PID, distinguish transformed-module retention from real data leaks, and fix or reduce the impact by patching cleanup logic or isolating hotspot tests.

Why use Openclaw Test Heap Leaks on TypingMind?

Because you install it once and use it with any model. Openclaw Test Heap Leaks is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Openclaw Test Heap Leaks in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/SafeAI-Lab-X/ClawKeeper/tree/main/legacy/clawkeeper-watcher/.agents/skills/openclaw-test-heap-leaks. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Openclaw Test Heap Leaks?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Openclaw Test Heap Leaks?

As many as you like. As long as a model supports skills, you can use Openclaw Test Heap Leaks with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Openclaw Test Heap Leaks AI skill free?

It is published on GitHub by SafeAI-Lab-X. Check the repository for licensing terms. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇