Repository navigation
fix(tmp): replace the 1h /tmp reaper with configurable age and size l… - #1172
Merged
Merged
Conversation
…imits The image removed every file in /tmp not used for an hour, checked every 15 minutes, so long-running agents lost their scratchpad and task output (Claude Code keeps them in /tmp/claude-<uid>). Two limits replace it, both settable in [limits.disk] and profiles: - tmp_max_age (default 7d): systemd-tmpfiles-clean.timer, daily - tmp_max_size (default 4GiB): coi-tmp-cleanup.timer every 2 minutes removes the least recently used files until /tmp holds under 3/4 of it; files used in the last 15 minutes are kept "0" turns a limit off. coi writes both at each session start (shell and run, fresh and restarted containers), and SANDBOX_CONTEXT.md names them.
…the limit du walks the whole /tmp tree, so every 2 minutes was more than needed. Cleaning down to half of tmp_max_size instead of three quarters leaves room to grow, so the next cleanup is not due at once.
Check the real schedules in the built image (size every 15 minutes, age daily with no override), and let both timers remove files without a manual systemctl start: a drop-in makes each fire 1s after a restart and then every 5s.
An empty OnUnitActiveSec= clears every timer of the unit, so the drop-in cleared its own OnActiveSec=1s and left only OnUnitActiveSec=5s, which never fires on a timer whose service has not run yet. The reset now goes first. The off test compared the files in sort -V order, which puts fresh before old1.
They read a file from a workspace under pytest's /tmp. On GitHub's ubuntu-24.04 runners on AWS that read never showed in the container's io.stat, so the threshold never triggered (they pass on the Azure ones). The workspace is now under the home directory, on the runner's disk, and a failure also names the workspace's mount.
… tmp_max_size An agent can leave a file in /tmp for longer than 15 minutes and still need it; files go oldest first anyway, this is only the floor.
The code user cannot read the system journal, so the check for the service's log line saw nothing although the timer had removed the files.
…t update coi needs nothing from it, and its outage (403, "no longer signed") failed apt-get update and with it the network and incus-lts-file lanes.
…st fails The read tests discarded dd's output, so a failure on a runner where the read never reached io.stat gave no reason.
…ytest workspace The coi image is Ubuntu 26.04, whose dd is uutils'. On GitHub's runners on AWS its iflag=direct read fails at once with "IO error: Invalid input", so nothing is read and the threshold never triggers. The tests now run gnudd when the image has it. This was the cause, not /tmp, so the disk workspace fixture is gone again.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…imits
The image removed every file in /tmp not used for an hour, checked every 15 minutes, so long-running agents lost their scratchpad and task output (Claude Code keeps them in /tmp/claude-).
Two limits replace it, both settable in [limits.disk] and profiles:
"0" turns a limit off. coi writes both at each session start (shell and run, fresh and restarted containers), and SANDBOX_CONTEXT.md names them.