Skip to content

fix(host): prune stale /dev/shm dirs and improve quota errors - #32

Merged
simoncrypta merged 2 commits into
08-09-fix_template_unique_cloneworkerdatabase_names_for_jest_setupfilesfrom
08-09-fix_host_prune_stale__dev_shm_dirs_and_improve_quota_errors
Aug 10, 2026
Merged

fix(host): prune stale /dev/shm dirs and improve quota errors#32
simoncrypta merged 2 commits into
08-09-fix_template_unique_cloneworkerdatabase_names_for_jest_setupfilesfrom
08-09-fix_host_prune_stale__dev_shm_dirs_and_improve_quota_errors

Conversation

@simoncrypta

Copy link
Copy Markdown
Collaborator

Summary

  • Before ephemeral cold-start, prune leftover /dev/shm/cedar-pg-*, pgserve-*, and PostgreSQL.* when the recipe port is not live (OOM-killed runs filling tmpfs).
  • On Disk quota / ENOSPC / Postgres 53100, append remount + cleanup hints (sudo mount -o remount,size=6G /dev/shm).
  • Warn when /dev/shm has less than ~512MB free before --ram start.

Depends on #31 (stacked).

Test plan

  • vp test tests/host.test.ts
  • vp check

@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes
    • Automatically removes stale temporary PostgreSQL data directories when the associated service is no longer running.
    • Prevents cleanup of data directories while the service is still active.
  • New Features
    • Added clearer startup errors for disk-quota, insufficient-space, and PostgreSQL storage failures.
    • Added available-space reporting and troubleshooting guidance for RAM-backed temporary environments.
    • Added warnings when shared memory falls below the recommended capacity.

Walkthrough

Changes

The host provider now detects shared-memory and disk-space failures, formats targeted startup guidance, prunes stale ephemeral PostgreSQL directories when the port is inactive, and reports low /dev/shm capacity. Tests cover diagnostics and port-dependent cleanup.

Ephemeral host space handling

Layer / File(s) Summary
Space diagnostics and error formatting
src/providers/host.ts, tests/host.test.ts
Added shared-memory thresholds, error detection, free-space reporting, formatted startup errors, and tests for quota, ENOSPC, and SQLSTATE 53100.
Ephemeral startup cleanup and wiring
src/providers/host.ts, tests/host.test.ts, CHANGELOG.md
Ephemeral startup checks port liveness, removes stale PostgreSQL directories only when the port is inactive, warns about low /dev/shm capacity, passes RAM-mode context to installation, and documents the cleanup behavior.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main changes: pruning stale /dev/shm directories and improving quota error guidance.
Description check ✅ Passed The description directly explains stale directory cleanup, quota guidance, shared-memory warnings, dependencies, and testing.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/providers/host.ts`:
- Around line 157-164: The stale-entry cleanup around the startup liveness check
and the loop over entries must become ownership-safe and atomic: serialize
ephemeral cold starts with an exclusive lock, recheck liveness while holding it,
and delete only entries whose ownership metadata identifies an exited instance
of this recipe. Do not remove unrelated live PostgreSQL entries based solely on
the recipe port; update the cleanup and add coverage for concurrent startup and
a live non-recipe PostgreSQL entry.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: c4168995-72f8-447e-9c55-a36fe0a68f6b

📥 Commits

Reviewing files that changed from the base of the PR and between 2aced98 and 2062ece.

📒 Files selected for processing (3)
  • CHANGELOG.md
  • src/providers/host.ts
  • tests/host.test.ts

Comment thread src/providers/host.ts
…_jest_setupfiles' into 08-09-fix_host_prune_stale__dev_shm_dirs_and_improve_quota_errors
@simoncrypta
simoncrypta merged commit 9328c77 into main Aug 10, 2026
2 checks passed
@simoncrypta
simoncrypta deleted the 08-09-fix_host_prune_stale__dev_shm_dirs_and_improve_quota_errors branch August 10, 2026 02:46
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