Skip to content

test: initialize supervisor before timeout cleanup checks - #292

Open
kevin-orellana wants to merge 3 commits into
mainfrom
feature/cleanup-test-startup-main
Open

kevin-orellana wants to merge 3 commits into
mainfrom
feature/cleanup-test-startup-main

Conversation

@kevin-orellana

@kevin-orellana kevin-orellana commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

Human readable section

Problem. A cleanup test starts its one-second readiness timeout before its Python supervisor initializes. A slow start can stop the fixture before it writes its process identity files. The test then fails before it can check cleanup. This matched the macOS failure in #262.

Solution. Give the fixture ten seconds to initialize while testing the full execution helper's readiness-timeout path. The fixture never sends the workload-ready signal, so the helper must time out. The test checks that initialization completed, the callback never ran, and shutdown stopped the separate workload and collected its exit status. It also checks that the helper collected the supervisor's exit status.

Trade-off. This timeout test takes about ten seconds. A startup failure still fails the test. Normal harness timeouts and product launcher behavior do not change.

Description

Keep the existing readiness loop in a private WorkloadChild method. The regression reaches that loop through spawn_meanwhile_with_timeouts, which owns timeout cleanup. Preserve the checks for the expected timeout, fixture initialization, callback refusal, and separate-workload cleanup.

The correction in 2349ba8 restores helper-level coverage identified by automated review. A mutation that force-kills the supervisor during the helper's readiness error now fails the regression.

Related Issues

Discovered in #262's macOS test failure.

Type of Change

Bug fix

Testing

Current revision: 2349ba8c1b84768f8681686d45df9137a82d8324

The branch includes main at 67e378ae16f2a8457a6b856228343086f404e743, including #288's compiler and Python metadata repairs. This correction changes only test-integ/src/process/tests.rs relative to the refreshed head 3b1ada0.

Verified locally on Linux ARM64 with a separate harness build directory:

  • All 11 process:: tests passed, with zero failures or ignored tests. The other 93 library tests were filtered out.
  • The force-kill/reap-only mutation in the helper's readiness-error branch failed with workload_alive=true. This verifies the cleanup coverage identified by review.
  • A two-second delay before supervisor initialization passed with the ten-second budget. The same delay failed with the old one-second budget.
  • All temporary mutations were restored before the commit. Formatting, whitespace checks, and independent review passed. The existing helper implementation was preserved.

Fresh required CI and CodeQL passed at this revision. The hosted checkout tree matched the pushed head.

  • Linux ARM64: all 104 harness library tests passed, including the corrected readiness-timeout test. Deterministic integration recorded 131 passes and nine declared platform skips across all 140 expected cases.
  • macOS: all 103 harness library tests passed, including the corrected readiness-timeout test. Deterministic integration recorded 128 passes and twelve declared platform skips across all 140 expected cases.
  • Neither platform recorded a failure or setup error. No harness library tests were ignored or filtered.
  • Packaging and CI Gate passed. Workspace Rust, site manifest, the separate Verdict job, and native filesystem jobs were skipped by path filters for this final test correction.

The automated reviewer repeated the mutation and delayed-startup controls and accepted the repair. The coverage discussion is resolved. The description now reflects the full helper path, ten-second cost, and current revision.

Earlier full run at 3b1ada0

Full hosted CI passed before this final test correction. Linux ARM64 and macOS workspace tests passed, along with lint, packaging, native macOS tests, site manifest, Verdict, and CI Gate.

The standalone harness passed all 104 Linux and 103 macOS library tests, with none ignored or filtered. Deterministic integration recorded all 140 expected cases: Linux had 131 passes and nine platform skips; macOS had 128 passes and twelve platform skips. Neither platform recorded a failure or setup error.

That full run covers the earlier revision. No new local full-workspace or native macOS run is claimed for the final correction. The package has a standalone manifest; workspace-only commands do not run its tests.

Existing platform gaps remain reported by the hosted jobs. Linux cannot exercise the alias read-only assertion or a real credential-daemon fixture. Existing ignored Rust tests and the ignored harness documentation test remain outside the passing counts.

  • I ran the affected process tests and the mutation and delayed-startup controls described above.
  • I ran formatting and whitespace checks for the final source.
  • The required CI Gate passed at the current head.

Checklist

  • I have read the CONTRIBUTING document
  • I have reviewed and understand every line of code in this PR, including any generated by AI tools, and I can explain why it works
  • My change is focused and reasonably small; I have split unrelated work into separate PRs
  • I have added any necessary tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • My changes generate no new warnings

The change affects private test-harness code. It changes no documented product interface or build command.


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

## Problem

The cleanup regression starts its readiness deadline before the Python
supervisor initializes. A slow startup can leave workload.pid absent,
so the test fails before it checks descendant cleanup.

## Solution

Publish a fixture startup marker after installing the shutdown handler
and writing both process identity files. Wait for that marker before
exercising the shared private readiness wait. Preserve the timeout panic,
graceful descendant shutdown, and supervisor-reaping assertions.

## Tests

Native macOS: 103 standalone harness library tests pass. Linux ARM64:
104 pass. All-feature and no-default builds, strict all-target Clippy,
formatting, and whitespace checks pass on both platforms.

when_readiness_times_out_then_shutdown_reaps_the_separate_workload fails
with a two-second startup delay before the fix and passes after it.
The same test rejects immediate termination and a removed readiness wait.

Independent adversarial review found no actionable defect in the repair.
The broader scripts/test-all.sh check fails on unchanged Linux test
compilation tracked in #289. Full deterministic integration validation
requires isolated hosted fixtures; shared local fixtures were preserved.
@github-actions github-actions Bot added Area - Agent Containment chore Maintenance tasks, dependency updates, CI changes, refactoring with no user-facing impact labels Nov 3, 2026
@kevin-orellana
kevin-orellana marked this pull request as ready for review November 4, 2026 01:33
@kevin-orellana
kevin-orellana enabled auto-merge (squash) November 4, 2026 01:33
Comment thread test-integ/src/process/tests.rs Resolved
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown

Assessment: Comment

The startup gate fixes the macOS race. The new test, however, no longer exercises the helper whose readiness-timeout cleanup it is named for. A local mutation shows the cleanup regression it used to catch now passes (see the inline comment).

Checks that held
  • Extracting wait_for_ready keeps the old loop's behavior: ready marker found returns None, early exit returns Some(status), and a deadline overrun gives the same DET_ERROR panic. The helper still behaves the same.
  • supervisor.ready is written after the SIGTERM handler is installed and after both workload.pid and workload.group are written, so the SIGTERM the test sends always reaches an initialized supervisor.
  • If Python fails to start, or the supervisor exits during the 100 ms wait, the test still fails rather than passing falsely.
  • /bin/sh run without --config/-c is equivalent for this fixture, because the script ignores positional arguments and execs Python, so the child PID is the supervisor.
  • No frozen surface or product code is touched. The change stays within the test-integ/README.md rule that src/process.rs owns child cleanup and src/process/tests.rs tests it with local subprocesses.
  • Locally on Linux x64, all 11 process:: tests pass at 3b1ada0.

The PR description gives a clear account of the race and of the controls behind the fix.

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown

Assessment: Approve (re-review at 2349ba8)

The test runs the full helper again, with a 10 s readiness budget. My earlier coverage finding is resolved, and the startup race is gone.

Checks that held
  • The helper still checks graceful descendant cleanup: force-killing the child on a readiness timeout now fails this test (workload_alive=true).
  • Slow startup is tolerated: a 2 s delay before the supervisor starts still passes. A start slower than 10 s fails with the new "did not initialize" message instead of a workload.pid read error.
  • If the supervisor exits early, the test fails, the same as on main.
  • Extracting wait_for_ready keeps the old loop's behavior.
  • No product code or frozen surface is touched.
  • Locally on Linux x64, all 11 process:: tests pass, taking about 10 s because of the new timeout.

Before merge: The PR description still describes the previous approach: a separate startup gate, then a direct 100 ms wait_for_ready call, "the cleanup regression use[s] the same loop", and an "Open automated feedback" section. Testing is also reported at 3b1ada0. Please update the Solution, Trade-off (one helper test now always takes about 10 s), and Testing sections to match this head. With that test no longer calling it directly, the wait_for_ready extraction is optional; keeping it is fine.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area - Agent Containment chore Maintenance tasks, dependency updates, CI changes, refactoring with no user-facing impact

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants