Context
The workspace pod (8 GiB memory limit) is repeatedly OOMKilled by VS Code Remote Server
memory growth. Because /sys/fs/cgroup/memory.oom.group = 1, a cgroup OOM kills every
process in the container as a group — the IDE, all tmux sessions, and all parallel agent
runs die together. No cgroup-level limit is reachable without privileged: true
(/sys/fs/cgroup is ro, cgroup.subtree_control is empty, cgroup namespace is private,
uid 10001, CapEff = 0), which DESIGN.md's "Unprivileged by default" stance rules out.
PR #859 ships a userspace watchdog (script-memory-watchdog.sh, scripts.tf, the Memory Headroom agent metadata, and DESIGN.md/CLAUDE.md documentation of why a userspace watchdog
exists at all) in observe-only mode: it measures headroom, logs candidate actions, and
sets no prlimit ceilings and sends no signals.
What headroom means here
memory.current reads misleadingly high even on an idle container, so the watchdog computes:
U = anon + shmem + unevictable + slab_unreclaimable + kernel_stack + pagetables + percpu + sock
H = memory.max - U
Measured at rest: memory.current 97% of limit, coder stat mem 63%, true U 23%,
headroom H 6.12 GiB, memory.pressure full avg10 0.00. A naive memory.current > 85%
trigger would fire permanently on an idle container — U gets it right by roughly a factor
of four.
What's open
The proposed soft RLIMIT_DATA ceilings (server-main.js 1.5 GiB, extensionHost 3 GiB,
tsserver 3.5 GiB, other language servers 1 GiB, fileWatcher 1 GiB, ptyHost never limited)
are a starting proposal derived from role and the 8 GiB budget, not from measurement.
They are not yet agreed and nothing sets them today. Too low silently kills a healthy
extension host mid-edit; too high makes the mechanism inert.
Acceptance criteria
Related
Context
The workspace pod (8 GiB memory limit) is repeatedly OOMKilled by VS Code Remote Server
memory growth. Because
/sys/fs/cgroup/memory.oom.group = 1, a cgroup OOM kills everyprocess in the container as a group — the IDE, all tmux sessions, and all parallel agent
runs die together. No cgroup-level limit is reachable without
privileged: true(
/sys/fs/cgroupisro,cgroup.subtree_controlis empty, cgroup namespace is private,uid 10001,
CapEff = 0), which DESIGN.md's "Unprivileged by default" stance rules out.PR #859 ships a userspace watchdog (
script-memory-watchdog.sh,scripts.tf, theMemory Headroomagent metadata, and DESIGN.md/CLAUDE.md documentation of why a userspace watchdogexists at all) in observe-only mode: it measures headroom, logs candidate actions, and
sets no
prlimitceilings and sends no signals.What headroom means here
memory.currentreads misleadingly high even on an idle container, so the watchdog computes:Measured at rest:
memory.current97% of limit,coder stat mem63%, trueU23%,headroom
H6.12 GiB,memory.pressure full avg100.00. A naivememory.current > 85%trigger would fire permanently on an idle container —
Ugets it right by roughly a factorof four.
What's open
The proposed soft
RLIMIT_DATAceilings (server-main.js 1.5 GiB, extensionHost 3 GiB,tsserver 3.5 GiB, other language servers 1 GiB, fileWatcher 1 GiB, ptyHost never limited)
are a starting proposal derived from role and the 8 GiB budget, not from measurement.
They are not yet agreed and nothing sets them today. Too low silently kills a healthy
extension host mid-edit; too high makes the mechanism inert.
Acceptance criteria
Uand its components, logged by theobserve-only watchdog) with the workspace under normal use.
prlimitthresholds from the observed distribution rather than thestarting proposal.
PR feat: add observe-only memory watchdog to the workspace template #859).
test_modenegative test: drive headroom below the L4 floor from outsidethe
--type=ptyHostsubtree and confirm the VS Code Remote Server tree dies while acoder ssh-attached tmux session and thecoder agentprocess survive, withmemory.events.oom_group_killnot incrementing.Related
ppat/homelab-ops-kubernetes-apps— Coder ServiceMonitor + node-exporterpgscan_*/pgsteal_*fields, needed so headroom/reclaim pressure is visible outside the pod, notjust in the watchdog's own log.