Skip to content

Unit tests leave 24 Factory skills directories in the temp directory on every run #1913

Closed

Description

@JacobStephens2

This was generated by AI during triage.

From the host cleanup after the 2026-11-09 retro. The research note for #569 named this source from reading the code and did not reproduce it. This reproduces it and counts it.

What was found

  • On 2026-11-09, the four hosts that run this repository's Ticket runs held 8,100 thirdshift-skills-* directories at the top of /tmp: between 946 and 3,074 per host, about 0.6 MB each, about 4.7 GB together.
  • They arrive in bursts. On one host, 74 of the minutes that have any have 23 or 24 new ones.
  • On that host, every day that has them is a day a session ran the test suite. The four days with no suite run have none.

Reproduction

Verified during triage on main at 1888168, on Ubuntu 24.04.

  • The unit-test binary, run once with an empty private TMPDIR, the way cargo test --bin thirdshift runs it: 1,663 tests in one process. Afterwards TMPDIR holds 24 thirdshift-skills-* directories.
  • Each unit test run in its own process with its own TMPDIR, the way nextest runs them: 15 tests leave 25 directories.
  • 71 of the 94 integration test binaries, each run once the same way: none leaves one. The other 23, security_review to user_config in alphabetical order, were not run.
Tests Directories each leaves
session::execution_tests::keeps_review_reports_beside_each_harness_session_log and session::execution_tests::shell_git_fixtures_ignore_global_and_system_config 6, one per Harness
ten more in session::execution_tests, and session::private::tests::scoring_maps_sandbox_startup_failure_after_a_successful_probe 1
skills::tests::links_factory_skills_in_existing_and_missing_directories_for_every_adapter and skills::tests::links_in_ordinary_directories_without_directory_read_permission 1
The ten more in session::execution_tests
  • a_failed_session_still_keeps_whichever_review_report_it_left
  • a_resumes_review_reports_are_kept_beside_its_own_session_log
  • a_symlink_review_report_is_not_kept_and_the_run_carries_on
  • completed_stdout_is_reported_after_a_broken_prompt
  • interruption_suppresses_recovered_interpretation_and_retained_reads
  • missing_review_reports_get_a_progress_line_and_the_run_carries_on
  • partial_stdout_is_reported_after_log_failure_with_a_blocked_prompt
  • startup_failure_never_reaches_an_installed_harness
  • startup_failure_preserves_its_cause_without_completion_reporting
  • unavailable_report_setup_warns_and_the_run_carries_on

Why:

  • written_out() keeps the extraction in a process-wide static. Only a Command's finishing paths call remove_written(), and a static is not dropped when a process exits.
  • The session tests re-run the test binary as a subprocess for each fixture. Each subprocess runs a Session in-process, writes the skills out and exits. A system-call trace of keeps_review_reports_beside_each_harness_session_log shows six processes each creating one directory, and none removing one. These subprocesses account for 23 of the 24.
  • The two skills::tests call link_into in the test process itself. That leaves one directory per test process: one under cargo test, two under nextest.

Agent Brief

Category: bug
Summary: A unit-test run leaves no Factory skills extraction behind in TMPDIR.

Current behavior:

  • One run of the unit tests leaves 24 thirdshift-skills-* directories in TMPDIR under cargo test, and 25 under nextest. Each is about 0.6 MB.
  • 23 come from the subprocesses of the test binary that the session tests start. Each runs a Session in-process and exits with its extraction still there.
  • The rest come from tests that write the skills out in the test process itself.
  • A Command removes its extraction when it finishes. That is unaffected.

Desired behavior:

  • After the unit tests finish, the TMPDIR they ran with holds no thirdshift-skills-* entry, under cargo test and under nextest.
  • A test that needs the extraction finds it for as long as it runs. Tests in one process run in parallel and share one extraction, so it stays until the last of them is done.
  • A Command keeps one extraction and removes it when it finishes, as now.

Key interfaces:

  • written_out(), remove_written() and the static they share.
  • The session tests' subprocess entry points: the tests that re-run the test binary with a fixture variable set.
  • A regression test that runs one of those entry points with a private TMPDIR and fails when an extraction is left.

Acceptance criteria:

  • The unit-test binary, run once with an empty private TMPDIR, leaves no thirdshift-skills-* entry there. Today it leaves 24.
  • Each of the 15 tests above, run alone in its own process with its own TMPDIR, leaves none.
  • A test in the suite fails when a session test's subprocess leaves its extraction behind.
  • The unit tests pass in one process and under nextest.
  • A Scenario test asserts that an ordinary Run leaves no thirdshift-skills-* entry in its TMPDIR.
  • The pull request reports what the 23 integration test binaries not run here leave in a private TMPDIR.

Out of scope:

  • A Command killed with SIGKILL, which leaves its extraction, and any sweep of old extractions at startup.
  • The fakes-<hash> directory the unit tests build their fakes in. It is one per build and is reused.
  • Processes and fixture directories that a killed test harness leaves (Scenario test children survive a killed test harness and keep polling #1912).
  • Where a Command writes the skills out.

Activity

  1. added
    bug
    ready-for-agent
    in-progress
    and removed
    ready-for-agent
    on Nov 9, 2026
  2. removed
    in-progress
    on Nov 10, 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