Skip to content

tests leak temp directories: /tmp held ~175 000 tole-* and cora-* entries (17 GB) after a day of agent work #781

Closed

Description

@ajianaz

Found while the build disk hit 0 MB free during the #752 module moves (2026-11-14). /tmp held 174 356 entries and 17 GB, almost all tole-* (166 795) and cora-* (7 324) directories created by the test suites and never removed.

Top patterns (one per test run, names normalised): tole-sens-e2e-N-N (23 166), tole-trust-N-N (8 932), tole-skapprove-e2e-N-N (5 545), tole-discuss-race-N-N (2 460), tole-apply-N-N (2 101), tole-tui-e2e-N-N and its .home twin (about 1 600 each), tole-profile-e2e-N-N, tole-compaction-N-N, tole-cfg-e2e-N-N, tole-owner-N-N-N, tole-sbxc-e2e-N-N, tole-cmd-policy-N-N, tole-curator-e2e-N-N, tole-compactor-N-N.

Why it matters

  • Several agents and developers run the whole suite many times a day; each run leaves fresh directories. On a small disk this fills the volume (an agent's git commit failed with no space) and slows ls /tmp and cleanup.
  • Test dirs can hold fixtures with fake secrets, homes and session logs; they should not outlive the test.
  • fix(test): make the flaky e2e tests hermetic and condition-driven #711 made names unique (a clock stamp instead of a reusable pid) but did not remove them.

Fix

  • A tiny shared test helper (an RAII TempDir guard that removes the directory on drop, including on panic where possible) in a test-support module of each crate (or the tempfile dev-dependency if the dependency budget allows; check with the owner's dependency rules), and replace the hand-rolled std::env::temp_dir().join(format!(...)) plus create_dir_all patterns across the integration tests and unit tests.
  • Directories that a spawned child still uses after the test returns (daemons, detached jobs) must be cleaned by the test explicitly.
  • A guard test or a CI step that runs the suite and fails if the count of tole-* entries in $TMPDIR grew (set a per-run TMPDIR under the runner temp dir and assert it is empty at the end).
  • Several small PRs (one crate or one family of tests each); no behaviour change.

Related: #702, #711.

Activity

  1. added
    bug
    on Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions