Adom Hydrogen
Public Made by Adomby adom
The whole Adom experience as one signed native app: your editor, your AI agent, and the full electronics design toolchain, running locally on your own machine.
WslDistro workspace: one runaway thread can take down the whole VM. Add memory guardrails (earlyoom, per-thread cgroup cap, .wslconfig headroom)
What happened
2026-09-11, my box, WslDistro runtime. A Claude Code thread ran a 14-job C++ build of KiCad (14 × cc1plus with a precompiled header, ~1.5 GB each) and at the same time a Python script that held a couple of GB of numpy image data. The VM is 16 GB with 4 GB swap. The kernel killed two of the processes (exit 137 / 144), then WSL itself went down: every terminal, code-server, every AI thread, all at once. Hydrogen had to bring the workspace back.
The agent was being greedy, but the point is that nothing in the workspace stops a single thread from taking the whole VM with it.
Why it can
In the WslDistro runtime the workspace is the VM, so there is no container cgroup around it. Checked from inside:
/sys/fs/cgroup/memory.maxdoes not exist: nothing is limited.- no
earlyoom/oomd: the kernel OOM killer only acts after the VM is already thrashing, and WSL2 tends to hang or reset before that. ulimit -v/-munlimited.%USERPROFILE%\.wslconfigonly hasnetworkingMode=mirrored: nomemory=,swap=orautoMemoryReclaim.- the RAM bar in the title bar shows usage against
mem_limit_mb(16384 = the VM), but that limit is only reported, not enforced.
Both systemd (PID 1, systemd=true in /etc/wsl.conf) and cgroup v2 (nsdelegate) are available, so all of the fixes below are possible without changing the runtime.
Proposed guardrails, most value first
- earlyoom in the distro (golden image, or a setup step:
apt install earlyoom, enable the unit). Kill the largest process at ~8 % free RAM / 50 % free swap, before the VM thrashes.--prefer '(cc1plus|ld|lld|rustc|python3|node)' --avoid '(code-server|sshd|systemd|adom|hydrogen)'so a compiler dies before the editor. Its-nhook could raise a Hydrogen toast ("earlyoom killed cc1plus, 2.1 GB"). This alone turns today's crash into one killed compiler. - Per-thread memory cap. Spawn each AI thread / terminal under
systemd-run --scope -p MemoryMax=<~70 % of the VM> -p MemorySwapMax=<some>(or oneadom-threads.slicewithMemoryHigh/MemoryMax). A runaway thread is OOM-killed inside its own cgroup; other threads and code-server survive. The stats tooltip could show the per-thread cap next to the VM total. .wslconfigheadroom. Hydrogen already writesguiApplications=falsemerge-safely; do the same formemory=(host RAM minus ~6 GB, floor 8 GB),swap=(≥ 8 GB) andautoMemoryReclaim=gradualwhen the user has not set them. Keeps Windows and Hydrogen responsive when the VM saturates, so the restart card can appear instead of everything freezing.- UI. RAM bar red plus a toast at ~90 %, and the "restart needed" badge when the VM has actually gone (I do not know whether that path already covers a VM reset, it may).
- Agent side. One line in the workspace CLAUDE.md telling agents to size parallel builds from RAM (
-j$((RAM_GB/2))) and not to stack memory-heavy jobs. Soft, but free.
Reproduce
stress-ng --vm 8 --vm-bytes 90% --timeout 60 in any thread, or the real thing: a ninja -j14 KiCad build plus a numpy script over a few 7200×3300 PNGs.
Happy to test earlyoom thresholds and the systemd-run wrapper on my box; tell me which of 1–3 Hydrogen wants to own.