Skip to content

fix(bin): keep memory-capped workers alive after process OOM - #5

Merged
Profreshor merged 3 commits into
mainfrom
fm/crew-oom-continue
Oct 16, 2026
Merged

Profreshor merged 3 commits into
mainfrom
fm/crew-oom-continue

Conversation

@Profreshor

Copy link
Copy Markdown
Owner

Intent

When one program inside a crew worker hits the per-worker memory cap from config/crew-memory-max, the whole worker shuts down, not just the program that used too much. At 10:59 on 2026-10-16 the demand worker's test program went over 6G. The kernel killed only that program, but systemd then stopped the rest of the worker's scope, because its default OOMPolicy is stop. The worker quit and had to be relaunched by hand. The fix is to add OOMPolicy=continue to the launch, so only the oversized program is killed and the worker stays alive.

What Changed

  • Launch memory-capped crew workers with OOMPolicy=continue so an OOM kill removes only the offending process and leaves the worker running.
  • Refuse capped launches on systemd versions older than 243, which do not support the required OOM policy.
  • Document the continuation behavior and systemd requirement, and cover both in the crew memory-cap launch test.

Risk Assessment

✅ Low: The bounded shared launch wrapper applies OOMPolicy=continue to every memory-capped worker launch, while the new systemd 243 preflight prevents unsupported-property failures.

Testing

A real isolated Herdr-lab spawn started the worker in a systemd scope. The host did not enforce MemoryMax, so the required OOM-survival behavior remains untested; the unsupported-systemd preflight behavior was only recorded as a non-live test.

  • Live validation: ⚠️ inconclusive - 1 of 3 scenarios driven live against the product
Scenario Result Live Evidence
Configured crew worker starts in a real memory-capped systemd scope ✅ pass live Live worker probe; real systemd worker scope journal
Unsupported systemd version refuses a capped launch before delivery ⏸️ untested no The prior payload recorded only a non-live test result and did not establish this behavior against the live product.
Oversized child is killed while its worker remains alive ⏸️ untested no The host’s real 64M user scope did not enforce the cap: the 256M child exited 0, so no OOM event could be driven. A host with enforced user-scope MemoryMax is required.
Evidence: Live worker probe

Source: Live worker probe

parent-started pid=2479462

parent-started pid=2479462
Evidence: Real systemd worker scope journal

Source: Real systemd worker scope journal

Oct 16 11:37:12 systemd: Started fm-crew-live-oom-…scope - /bin/sh -c "…bash …/.live-oom-harness.sh".

Oct 16 11:37:12 data-centre systemd[1157]: Started fm-crew-live-oom-s1792172231.2428656.23292.scope - /bin/sh -c "export COMPACT_ADVISER_DISABLE=1; bash ~/.no-mistakes/worktrees/aa96bb817995/01M52W1VPCJZV6EH4V7BWYNPWN/.live-oom-harness.sh".
Evidence: Host OOM-stimulus check

Source: Host OOM-stimulus check

parent-started child-exit=0 parent-survived systemd-run-exit=0

parent-started
child-exit=0
parent-survived
systemd-run-exit=0
- Outcome: ⚠️ 2 warnings across 1 run (8m7s)

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

🔧 **Review** - 1 issue found → auto-fixed ✅
  • ⚠️ bin/fm-spawn.sh:5092 - OOMPolicy for scope units requires systemd v243+, while the existing preflight accepts any systemd-run. A host with an older systemd that previously supported MemoryMax will now reach systemd-run with an unsupported property and fail to start the worker. Require or probe v243+ in the existing preflight and document that requirement.

🔧 Fix applied.
✅ Re-checked - no issues remain.

⚠️ **Test** - 2 warnings
  • ⚠️ Live OOM-continuation could not be demonstrated: a real 64M user scope let a child allocate 256M and exit normally, so this host did not produce the required capped-worker OOM event. Provide a host/user systemd setup where MemoryMax is enforced (including delegated memory-controller support), then re-run the isolated Herdr-lab scenario.
  • ⚠️ live validation verdict: inconclusive (1 of 3 scenarios were driven live against the product); untested: Unsupported systemd version refuses a capped launch before delivery, Oversized child is killed while its worker remains alive
  • Live validation: ⚠️ inconclusive - 1 of 3 scenarios driven live against the product
Scenario Result Live Evidence
Configured crew worker starts in a real memory-capped systemd scope ✅ pass live Live worker probe; real systemd worker scope journal
Unsupported systemd version refuses a capped launch before delivery ⏸️ untested no The prior payload recorded only a non-live test result and did not establish this behavior against the live product.
Oversized child is killed while its worker remains alive ⏸️ untested no The host’s real 64M user scope did not enforce the cap: the 256M child exited 0, so no OOM event could be driven. A host with enforced user-scope MemoryMax is required.
  • bin/fm-herdr-lab.sh provision fm-lab-crew-oom-continu-2344885-28321 with an isolated named lab, followed by a real fm-spawn.sh capped worker launch
  • real systemd-run --user --scope -p MemoryMax=64M -p OOMPolicy=continue OOM-stimulus check
  • tests/fm-spawn-crew-memory-max.test.sh
  • git diff --check c375907662b871fe2643b7100e9f859a8e11a0a9 db2c4e38318371739dbc42ceaff75a810ea2f1cb
  • git diff … | jev find "a change unrelated to OOM behavior for a crew worker memory cap" (no unrelated hunks flagged)
  • bin/fm-herdr-lab.sh teardown fm-lab-crew-oom-continu-2344885-28321 and returned the spawned Treehouse worktree
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-16T17:48:31.296134Z fec9f24 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Profreshor
Profreshor merged commit 7f842b4 into main Oct 16, 2026
Profreshor added a commit that referenced this pull request Oct 16, 2026
Resolve AGENTS.md by keeping upstream's version, which moved the home
layout listing into the operational-home-layout skill, and carry the
config/crew-memory-max entry into that skill's listing instead.
Resolve bin/fm-spawn.sh by keeping both the upstream and fork header
and config-read blocks, and keeping only the systemd-run memory wrap
where upstream moved the launch-home-token block earlier.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant