Skip to content

Scenario test children survive a killed test harness and keep polling #1912

Closed

Description

@JacobStephens2

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

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:

  • Scenario starts 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-tests invocations 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 Scenario run is in flight, the fake Harness, the fake git and gh wrappers 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 Scenario test'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 Scenario contract beside the setup PTY and release ones.

Key interfaces:

  • How Scenario starts thirdshift: run, run_with_env, run_with_input, run_until, run_from_until, the HeldRun they return, and the command they build.
  • The shared child-lifetime helper: kill_with_parent, and FixtureChild with its guardian. Reuse or extend it for Scenario.
  • 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 Scenario run 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 git that 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 Scenario contract.

Out of scope:

Activity

  1. added
    bug
    ready-for-agent
    in-progress
    and removed
    ready-for-agent
    on Nov 9, 2026
  2. added a commit that references this issue on Nov 10, 2026
  3. 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