Repository navigation
Description
This was generated by AI during triage.
From the host cleanup after the 2026-11-09 retro. #736 and #737 closed this gap for the setup PTY fixture and the release fixture. Scenario, which most integration tests use, still has it.
What was found
On 2026-11-09, two of the hosts that run this repository's Ticket runs had four processes left by test fixtures. Each had parent pid 1 and a working directory inside a leftover fixture directory.
| Process | Running since |
|---|---|
fake git, holding in an ls-remote |
18 October |
thirdshift harness under test |
23 October |
fake codex, running its agent script |
27 October |
fake git, holding in an ls-remote |
27 October |
- Three of the four started after Prevent setup PTY test children from surviving a dead test harness #736 and Bound release-test child lifetime when CI polling never completes #737 were fixed on 22 October.
- The last two polled the whole time. The agent script started a
sleepevery 100 ms, and thegithold one every 20 ms. - The scripts of those two were still on disk. They are the
gitwrapper ofpickup_raceand the agent script ofa_command_started_during_the_stop_grace_period_is_killed_too.
Reproduction
Verified during triage on main at 1888168, on Ubuntu 24.04. Each test binary ran alone, in its own process group, with a private TMPDIR. Once the fake's marker file appeared, the process group got SIGKILL, which is how an interrupted suite run dies.
| Test, and when its harness was killed | Alive 150 s later |
|---|---|
pickup_run: two_machines_racing_for_two_ready_issues_each_take_one, once tmp/winner-started existed |
the fake claude and its bash -e claude-script.sh, parent pid 1, starting a new sleep 0.02 each round |
process_tree: a_command_started_during_the_stop_grace_period_is_killed_too, once agent-started existed |
the fake codex and its bash -e claude-script.sh, parent pid 1, starting a new sleep 0.1 each round |
Why they survive:
Scenariostarts thirdshift in the harness's process group, and thirdshift starts each child in a process group of its own. Killing the harness's group ends the harness and thirdshift. The fakes are reparented to pid 1.- A killed harness does not unwind, so the fixture directory stays and no release file is written. Test scripts hold about 90 polling loops in 36 files. 10 stop when the fixture directory goes, one has a deadline, 22 have no exit condition, and the rest wait for a file.
- Harnesses are killed often. Sessions interrupted 53 of 294
scripts/affected-testsinvocations between 29 October and 9 November (Decide how much of the Rust suite a local run selects on 4-core hosts #1522).
Agent Brief
Category: bug
Summary: A process started for a Scenario test ends when its test harness dies, as setup PTY and release fixture children already do.
Current behavior:
- When a harness is killed while a
Scenariorun is in flight, the fake Harness, the fakegitandghwrappers and the detached commands that thirdshift started stay alive with parent pid 1. - When only the harness process dies, thirdshift under test stays too, as the 23 October process shows.
- A hold that waits for a file never sees it. A loop with no exit condition never ends.
- The setup PTY fixture and the release fixture already end their children when the harness dies. They use the shared child-lifetime helper: a parent-death signal for the immediate child, and a guardian that adopts and ends descendants in other process groups.
Desired behavior:
- After a
Scenariotest's harness dies, for any reason, every process the fixture started is gone within a few seconds. That covers thirdshift under test, descendants in process groups of their own, and detached commands that ignore INT and TERM. - Normal completion and an assertion panic clean up as they do today.
- The testing guide states the
Scenariocontract beside the setup PTY and release ones.
Key interfaces:
- How
Scenariostarts thirdshift:run,run_with_env,run_with_input,run_until,run_from_until, theHeldRunthey return, and the command they build. - The shared child-lifetime helper:
kill_with_parent, andFixtureChildwith its guardian. Reuse or extend it forScenario. - Lifecycle tests like the setup and release ones: a subprocess harness is killed, then no recorded pid may be left.
Acceptance criteria:
- A lifecycle test starts a
Scenariorun whose fake agent holds, kills its harness with SIGKILL, and finds no fixture process alive after the bound. Without the fix it fails and names the survivor. - The same test passes for a fake
gitthat holds, and for a detached command that traps INT and TERM. - It passes when only the harness process is killed, and when its whole process group is killed.
- Normal completion and an assertion panic leave no fixture process.
- The two reproductions above leave no process.
- The pull request reports the full suite's wall time before and after the change.
- The testing guide describes the
Scenariocontract.
Out of scope:
- Adding deadlines to the hold loops in test scripts.
- Removing the fixture directory of a harness that died.
- Fixtures that do not go through
Scenario, such as the Console tests' own. Say in the pull request if one has the same gap. - A production Run whose thirdshift is killed outright (Recover an open issue left in-progress by a Run that was killed outright #710).
Activity
Merge pull request #1931 from JacobStephens2/issue-1912