Conversation
Memory-hungry tools like pnpm OOM-kill at 512MB RAM. Create a swap file during rootfs build and enable it in the init script so VMs can handle temporary memory spikes without increasing base RAM.
📝 WalkthroughWalkthroughDuring rootfs setup, a 256MB swap file is created inside the extracted root filesystem with permissions Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/cli/setup.ts`:
- Line 283: Replace the silent swap activation command that redirects errors
away ("swapon /swapfile 2>/dev/null") with a command that preserves error output
so failures are visible during init; update the initialization line (the entry
containing "swapon /swapfile 2>/dev/null") to either remove the stderr
redirection or redirect stderr to the init log (e.g., allow errors to propagate
or append "2>&1 | tee -a /var/log/boot-swap.log") and ensure the init process
will surface or log any failure so operators can diagnose swap activation
issues.
| "hostname hearth", | ||
| "echo '127.0.0.1 localhost hearth' > /etc/hosts", | ||
| "ip link set lo up 2>/dev/null", | ||
| "swapon /swapfile 2>/dev/null", |
There was a problem hiding this comment.
Avoid silent swap activation failures in init.
swapon /swapfile 2>/dev/null hides why swap didn’t come up. If this fails, the VM can still OOM with no clue in boot logs.
Suggested change
- "swapon /swapfile 2>/dev/null",
+ "swapon /swapfile >/dev/null 2>&1 || echo 'WARN: failed to enable /swapfile' >&2",📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| "swapon /swapfile 2>/dev/null", | |
| "swapon /swapfile >/dev/null 2>&1 || echo 'WARN: failed to enable /swapfile' >&2", |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/cli/setup.ts` at line 283, Replace the silent swap activation command
that redirects errors away ("swapon /swapfile 2>/dev/null") with a command that
preserves error output so failures are visible during init; update the
initialization line (the entry containing "swapon /swapfile 2>/dev/null") to
either remove the stderr redirection or redirect stderr to the init log (e.g.,
allow errors to propagate or append "2>&1 | tee -a /var/log/boot-swap.log") and
ensure the init process will surface or log any failure so operators can
diagnose swap activation issues.
Summary
hearth setupswaponin the init script before the agent startsFixes OOM kills when running memory-hungry tools like
pnpm installin a 512MB VM. The swap file is sparse-friendly and compresses well in snapshots.To test:
hearth setup(rebuilds rootfs), then trypnpm installinside a sandbox.Summary by CodeRabbit