Skip to content

Daemon test suite: a test-owned temp tree vanishes mid-test on the ubuntu leg #781

Description

@alexeyzimarev

The daemon unit suite has a cross-test race on ubuntu-latest: a TempDir that one test owns disappears while that test is still using it. Four hits in three days, each on a different, unrelated PR or merge, and every re-run passed.

Date Run Test Symptom
2026-09-03 33783996964 (PR #761) BorrowedReviewContextTests.Aggregate_capacity_accepts_exact_limit_and_declares_one_extra_byte_as_omitted DirectoryNotFoundException from WorktreeManager.WriteOwnerOnlyFileAsync writing manifest.json into its own .preparing-<guid> dir, created moments earlier in the same call
2026-09-04 33861186946 (PR #763) BorrowedReviewContextTests.Omitted_oversized_config_does_not_consume_capacity_needed_by_later_configs git cat-file -t <sha> failed: not a git repository — the source repo's .git vanished mid-snapshot
2026-09-04 33888139389 (PR #770) BorrowedReviewContextTests.Aggregate_capacity_… again, plus AgentOrchestratorBorrowLaunchTests.Borrowed_Cursor_review_flow_runs_in_owned_dirty_snapshot_and_refreshes_between_rounds GitRepo.Create → git config user.name died with fatal: Unable to read current working directory, so the fresh TempDir was gone before git init ran; the orchestrator test threw a NullReferenceException at AgentOrchestratorBorrowLaunchTests.cs:93 in the same run
2026-09-05 33967780043 (merge of #766) BorrowedReviewContextTests.Omitted_oversized_config_… same class, main branch

The victims are all in the borrowed-review area, but the vanishing point moves: before git init, mid-snapshot, mid-manifest-write. That shape says something concurrent removes a tree it does not own, not that these tests are wrong.

Already ruled out: the build's own failure cleanup (failure-only, and a retry uses a fresh guid); TempDir name collision (mkdtemp); the orphan-sweep tests (all use private roots); any temp-root sweep in the daemon tests or Capacitor.Tests.Helpers (none found); spawned-daemon configs with a broad worktree_root / allowed_repo_paths (none). CI runs one assembly at a time with --maximum-parallel-tests 4, so the deleter is inside the daemon suite's own run.

Suggested approach: run the daemon suite with --maximum-parallel-tests 1 --report-trx to get an execution order, then look for a test that deletes or recreates a directory derived from something shared (the process cwd, a TMPDIR-relative path, a GitRepo root) rather than its own TempDir. The AgentOrchestratorBorrowLaunchTests hit suggests looking at what the orchestrator's borrow launch removes on teardown.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions