Skip to content

fix(test): retain OOM fixture buffers across garbage collection - #160276

Merged
steipete merged 1 commit into
mainfrom
deslop/l134-plugin-retention-gc
Sep 28, 2026
Merged

steipete merged 1 commit into
mainfrom
deslop/l134-plugin-retention-gc

Conversation

@steipete

@steipete steipete commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

The cgroup OOM integration test can time out under Bun because garbage collection releases its supposedly live buffer workload before aggregate memory crosses the limit.

User Impact

No product behavior changes. The existing CI regression now keeps its intended memory workload alive until the kernel terminates it.

Why This Change Was Made

Root the existing allocation array on globalThis in each disposable child process. Allocation count and size, the 256 MiB limit, deadlines, exit-137 assertion and scope-removal assertion are unchanged. The empty interval callback kept the original process alive without keeping its buffers reachable.

Found while repairing inherited CI after #160032. The separate plugin-retention repair landed concurrently in #160200; its identical implementation is used from main rather than duplicated here. This PR changes only the OOM fixture.

Evidence

Blacksmith Testbox tbx_01m3kaa3vxetwymptnwwzfq894, using checksum-pinned CI Bun 1.4.3-canary.1+6b9148b17:

  • The original 753-file core-unit-fast-2 selection failed this test with Managed command timed out after 15000ms while all plugin-retention cases passed.
  • A paired Bun -e probe using the same 16 × 8 MiB allocation showed 0 live buffers after native GC with the original local array, versus 16 with the explicit root.
  • 20 complete file runs passed all 8 tests via OPENCLAW_VITEST_RUNTIME=bun pnpm test test/scripts/managed-memory.integration.test.ts --maxWorkers=1. Mean wall 12.62 s; range 12.32–14.15 s, including runner preparation. The unchanged file also covers real signal propagation, cancellation grace and process-tree cleanup.
  • Negative control: a temporary nonbinding 1 GiB limit made the OOM case fail with the original 15-second timeout. The committed limit remains 256 MiB; the test still detects missing OOM behavior.
  • Three original-shard replays passed 8,795 tests each, retaining all 753 file selections and existing skips (83.42 / 123.51 / 161.46 s wall).
  • Node retention, module recovery, instance cleanup, retirement and the memory fixture passed 48 tests across 5 files (68.68 s).
  • Independent Codex P0–P2 review is scoped-clean. The preceding campaign also proved the upstream-equivalent plugin-retention fix with 20 runs and both real-leak negative controls.

That campaign ran on the channel-merge base with the now-upstream-equivalent retention repair. Before publication, this branch was rebased onto fresh main and the duplicate retention patch was dropped. The OOM fixture and its managed-process/memory owners are unchanged across that rebase. Its old changed-check run stopped on the inherited duplicate dataImageClipboardFile export, already repaired on main by bb05e779e2a; no passing gate is claimed from that failed attempt.

Final head c933e2efd9e360d80df7b9759189843e9a341254, source tree 67a0d45a9b1e96a4a96d3218246ac8048e7a19df, was verified on fresh Blacksmith Testbox tbx_01m3kgwgy2gtnm49pkwjh47dz7. The focused Bun file passed 8/8, and node scripts/check-changed.mjs passed all selected guards, four test-root typecheck shards, dead-export scans and lint with zero warnings/errors. The complete install/proof command took 626.20 s.

Exact-head CI run 36396220676 passed, including the CI gate. The selected Node test job took 202 s including setup; the real OOM fixture execution and timings above are Testbox evidence. Exact-head ClawSweeper review has no findings or remaining before-merge items.

Both repair Testboxes are stopped. Temporary negative-control mutations were restored before the passing shard/sibling checks; all final proof used the committed fixture bytes.

@clawsweeper

clawsweeper Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@steipete
steipete marked this pull request as ready for review September 28, 2026 08:14
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 28, 2026
@clawsweeper

clawsweeper Bot commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 28, 2026, 4:20 AM ET / 08:20 UTC.

ClawSweeper review

What this changes

The branch keeps buffers in two disposable OOM-test child processes reachable until the Linux memory-scope test completes.

Merge readiness

✅ Ready for maintainer review

Current main still has the unrooted OOM test workload. The merged related repair covers a different retention fixture, so this focused PR remains useful.

Priority: P2
Reviewed head: c933e2efd9e360d80df7b9759189843e9a341254

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A narrowly scoped fixture repair has strong reported real-boundary repetition and a useful negative control.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The changed OOM fixture runs through the managed process launcher and a real Linux systemd memory scope. The PR reports after-fix results on a checksum-pinned Bun Testbox: 20 complete file runs, three original-shard replays, and a nonbinding-limit negative control. Those runs preceded the final rebase, which left this fixture unchanged; no stored-data contract changes.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The changed OOM fixture runs through the managed process launcher and a real Linux systemd memory scope. The PR reports after-fix results on a checksum-pinned Bun Testbox: 20 complete file runs, three original-shard replays, and a nonbinding-limit negative control. Those runs preceded the final rebase, which left this fixture unchanged; no stored-data contract changes.
Evidence reviewed 6 items Introduced change: The pinned PR delta roots the allocation array on globalThis; the allocation count, memory limit, timeout, and assertions remain unchanged.
Current main: The fetched main revision still uses a local allocation array in the same OOM fixture, so the PR's central change is not implemented there.
Production boundary: The managed-memory owner launches the workload under systemd with MemoryMax and OOMPolicy settings; the fixture exercises this boundary.
Findings None None.
Security None None.

How this fits together

OpenClaw CI runs this integration test through a managed process launcher that places child workloads in a Linux systemd memory scope. The test checks for an OOM exit and verifies that the scope is removed.

flowchart LR
  A[CI test run] --> B[OOM fixture]
  B --> C[Managed process launcher]
  C --> D[Linux memory scope]
  D --> E[Child buffer workloads]
  E --> F[Exit and cleanup checks]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests +1. Total +1 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 2 1 +1
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 2 1 +1

Review metrics

Metric Value Why it matters
Focused fixture cost 20 runs; 12.62 s mean wall time The reported cost measures the real kernel-backed test, including runner preparation.

Technical review

Best possible solution:

Keep the real cgroup OOM test deterministic with reachable buffers while preserving its exit-code and scope-removal assertions.

Do we have a high-confidence way to reproduce the issue?

Yes. The PR reports an original-shard Bun timeout and a paired garbage-collection probe, while current main retains the same unrooted fixture; this review did not execute the test.

Is this the best way to solve the issue?

Yes. Rooting the disposable children's buffers addresses the reported lifetime failure without weakening the existing OOM or cleanup checks.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 5362ba0ca317.

Labels

Label changes:

  • add P2: This is a bounded CI test reliability bug with no reported product behavior change.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The changed OOM fixture runs through the managed process launcher and a real Linux systemd memory scope. The PR reports after-fix results on a checksum-pinned Bun Testbox: 20 complete file runs, three original-shard replays, and a nonbinding-limit negative control. Those runs preceded the final rebase, which left this fixture unchanged; no stored-data contract changes.
  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The changed OOM fixture runs through the managed process launcher and a real Linux systemd memory scope. The PR reports after-fix results on a checksum-pinned Bun Testbox: 20 complete file runs, three original-shard replays, and a nonbinding-limit negative control. Those runs preceded the final rebase, which left this fixture unchanged; no stored-data contract changes.

Label justifications:

  • P2: This is a bounded CI test reliability bug with no reported product behavior change.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The changed OOM fixture runs through the managed process launcher and a real Linux systemd memory scope. The PR reports after-fix results on a checksum-pinned Bun Testbox: 20 complete file runs, three original-shard replays, and a nonbinding-limit negative control. Those runs preceded the final rebase, which left this fixture unchanged; no stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The changed OOM fixture runs through the managed process launcher and a real Linux systemd memory scope. The PR reports after-fix results on a checksum-pinned Bun Testbox: 20 complete file runs, three original-shard replays, and a nonbinding-limit negative control. Those runs preceded the final rebase, which left this fixture unchanged; no stored-data contract changes.

Evidence

What I checked:

Likely related people:

  • Vincent Koc: Raw commit b9cd492 adds test/scripts/managed-memory.integration.test.ts:13 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: b9cd492ac60f; files: test/scripts/managed-memory.integration.test.ts)
  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete
steipete merged commit 9606e33 into main Sep 28, 2026
138 checks passed
@steipete
steipete deleted the deslop/l134-plugin-retention-gc branch September 28, 2026 09:01
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 29, 2026
…claw#160276)

Keep the synthetic child buffer arrays reachable until the kernel ends the workload. The previous empty interval retained the processes but allowed Bun to collect their buffers before aggregate usage crossed the cgroup limit.

Preserve allocation count and size, the 256 MiB limit, deadlines, exit-137 assertion, scope cleanup and runtime routing. The paired Bun probe retains 0 versus 16 buffers; 20 complete file runs and three original-shard replays pass, and a nonbinding-limit control still fails.

Final-head Blacksmith focused proof, changed checks, independent review, ClawSweeper review and hosted CI pass. The separate plugin-retention repair was already landed in openclaw#160200 and is not duplicated here.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant