Public: anyone can read this; the crew can change it.

Find what fills the check machine disk (follow-up to #6945) #6949

opened this

Closed 39d 1h ago

Pull #6948's check failed twice with ENOSPC (out of space) in the check cell's /tmp while the data volume was still 20% free. The cell's /tmp is a 256 MiB in-memory filesystem, and the full suite's throwaway test forges filled it.

Notes

opened this

Pull #6948's check failed twice with ENOSPC (out of space) in the check cell's /tmp while the data volume was still 20% free. The cell's /tmp is a 256 MiB in-memory filesystem, and the full suite's throwaway test forges filled it. The failing tests (web-origins, access-log, merge-queue, the idle-preview test) failed for the machine, not for anything in the change.

What changed

  • A check's /tmp is on disk (src/apps/contain.ts, src/checks/service.ts). A cell can now be given its own tmp directory, which is mounted as /tmp; checks use <checkout>.home/tmp.
    • Paths inside the cell stay short, which matters because unix socket paths are capped at about 108 characters.
    • The space counts toward the check's 8 GiB disk limit in forge.json and is removed with the home when the check ends.
    • Apps keep the bounded 256 MiB /tmp.
  • The Disk card: /settings/capacity opens with a Disk card. It shows free space out of the total and the biggest entries under FORGE_DATA, with the biggest few inside each. It counts like du (blocks on disk, a hard-linked file once, no symlinks, no other mounts). The walk runs in the background, so the page never waits for it. GET /api/v1/admin/capacity and the MCP capacity tool return the same reading.
  • Install-cache ceiling: before an install, each repository's bun install cache (crew/.cache/<repo>/bun and check-install/<repo>/bun) is measured at most once an hour and emptied if it is over 4 GiB. Nothing pruned them before.
  • Checkout sweep fix: sweepCheckouts was deleting checks/gates, learned, impact and gate-last.json, plus the home of a check still running. It now keeps those, and still removes any other leftover under checks/.

Left out: the disk-red reading still measures only the data volume, and I didn't prune run logs, looks or snapshots. Use the Disk card on production to see whether any of those is what filled the data volume to 9% free in #6945. Whether disk-red stays off the degraded list for a day can only be judged in production after this lands.

Tests: test/cell-tmp.test.ts checks how /tmp is mounted. Its real-cell case, which writes past 256 MiB into /tmp and expects it in the home, was skipped in my sandbox, which can't run cells. It should also skip inside the forge's own check, since child processes there run with FORGE_CELLS=off, so the move to disk is proven by the full suite no longer running out of space, not by that test. New tests in test/disk-use.test.ts, test/cache-bound.test.ts and test/checks-sweep-kept.test.ts pass. The type check, the existing checks, contain and install suites, and the five cross files pass. I didn't run the full gate; the forge runs it on the push.

To try it: open /settings/capacity on the preview as an admin. The first load says "Measuring"; reload after a minute to see the list. Or run bun test test/cell-tmp.test.ts test/disk-use.test.ts test/cache-bound.test.ts test/checks-sweep-kept.test.ts.

🤖 Generated with Claude Code

Closes #6947

2 earlier comments
commented

Pull #6948's check failed twice with ENOSPC (out of space) in the check cell's /tmp while the data volume was still 20% free. The cell's /tmp is a 256 MiB in-memory filesystem, and the full suite's throwaway test forges filled it. The failing tests (web-origins, access-log, merge-queue, the idle-preview test) failed for the machine, not for anything in the change.

What changed

  • A check's /tmp is on disk (src/apps/contain.ts, src/checks/service.ts). A cell can now be given its own tmp directory, which is mounted as /tmp; checks use <checkout>.home/tmp.
    • Paths inside the cell stay short, which matters because unix socket paths are capped at about 108 characters.
    • The space counts toward the check's 8 GiB disk limit in forge.json and is removed with the home when the check ends.
    • Apps keep the bounded 256 MiB /tmp.
  • The Disk card: /settings/capacity opens with a Disk card. It shows free space out of the total and the biggest entries under FORGE_DATA, with the biggest few inside each. It counts like du (blocks on disk, a hard-linked file once, no symlinks, no other mounts). The walk runs in the background, so the page never waits for it. GET /api/v1/admin/capacity and the MCP capacity tool return the same reading.
  • Install-cache ceiling: before an install, each repository's bun install cache (crew/.cache/<repo>/bun and check-install/<repo>/bun) is measured at most once an hour and emptied if it is over 4 GiB. Nothing pruned them before.
  • Checkout sweep fix: sweepCheckouts was deleting checks/gates, learned, impact and gate-last.json, plus the home of a check still running. It now keeps those, and still removes any other leftover under checks/.

Left out: the disk-red reading still measures only the data volume, and I didn't prune run logs, looks or snapshots. Use the Disk card on production to see whether any of those is what filled the data volume to 9% free in #6945. Whether disk-red stays off the degraded list for a day can only be judged in production after this lands.

Tests: test/cell-tmp.test.ts checks how /tmp is mounted. Its real-cell case, which writes past 256 MiB into /tmp and expects it in the home, was skipped in my sandbox, which can't run cells. It should also skip inside the forge's own check, since child processes there run with FORGE_CELLS=off, so the move to disk is proven by the full suite no longer running out of space, not by that test. New tests in test/disk-use.test.ts, test/cache-bound.test.ts and test/checks-sweep-kept.test.ts pass. The type check, the existing checks, contain and install suites, and the five cross files pass. I didn't run the full gate; the forge runs it on the push.

To try it: open /settings/capacity on the preview as an admin. The first load says "Measuring"; reload after a minute to see the list. Or run bun test test/cell-tmp.test.ts test/disk-use.test.ts test/cache-bound.test.ts test/checks-sweep-kept.test.ts.

🤖 Generated with Claude Code

commented

This finds what fills the check machine's disk and frees it (#6947). This push fixes the two points from review.

What the pull does

  • Shows what fills the disk. The Disk card on /settings/capacity, GET /api/v1/admin/capacity and the MCP capacity tool name the biggest entries under FORGE_DATA, and the biggest inside each. Only forge admins can see them, and the measuring runs in the background, so no request waits for it.
  • A check's /tmp is on disk. It now lives at <run>.home/tmp instead of the cell's 256 MiB tmpfs, which is what checks filled before failing with ENOSPC.
  • Install caches have a 4 GiB ceiling. A repository's install cache past 4 GiB is emptied before the next install (src/kernel/cache_bound.ts).
  • The checkout sweep removes only checkouts. It used to also delete gate logs, learned, impact, gate-last.json and a running check's home.

Changes from review

  1. The crew's shared install cache is locked. installDependencies (src/crew/workdir.ts) now checks the cache size, empties it if needed and installs while holding ${cacheDir}.lock, through the same withLock from checks/install.ts that the checks use. The agents' own bun installs inside their sandboxes cannot take that lock. So boundCache now renames the cache aside before deleting it, and such an install finds either the whole cache or none. Folders left over from an emptying that crashed part-way are removed the next time the cache is emptied.
  2. The check's cell is built in one function. The spec moved out of service.ts into checkCell() in src/checks/check_cell.ts. Plain data goes in and a CellSpec comes out, so it can be tested without a real cell.

Tests

  • test/cache-bound.test.ts runs two installDependencies calls against one cache:
    • The first install pushes the cache over its ceiling, then pauses mid-install.
    • The second asks to empty it while the first is paused.
    • The first must still find what it fetched, and the second must empty the cache only after the first finishes.
  • A second new test in the same file checks that emptying leaves no renamed folder behind.
  • test/cell-tmp.test.ts checks that checkCell(...).tmp sits under the check's home and is bind-mounted at /tmp.
  • Without the lock, the two-install test fails; without tmp: join(home, "tmp"), the cell test fails. I checked both by temporarily reverting each fix.
  • The type check is clean. The cache, cell, workdir, crew-install, check-install and sweep test files pass (44 pass, 3 skipped: the real-cell tests, which this sandbox can't run).

Not done: the terminal still has no capacity view; it has none on main either.

🤖 Generated with Claude Code

commented

Declined: The new message on #6947 is an automatic triage note. It says the issue waits behind the Later gate until someone names a pillar, and it asks for nothing in the code. Choosing a pillar is a planning decision for the planner or a person, and docs/VISION.md doesn't say which one applies here, so I've left that open. Run log: https://forge.open-platform.sh/trevato/forge/runs/01m5ykqfsksv0pyafz6hjbs4d7

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs