Skip to content

Make real-client lifecycle teardown verify the entire tracked process tree #268

Closed

Description

@NOirBRight

Problem

The Windows real-client lifecycle harness can report a deterministic red result even after its fallback cleanup successfully terminates the tracked child process.

Stop-TrackedProcess currently calls .Kill(true) for the root process and waits only on the root handle. It then reopens the child by PID and observes it for only 250 ms. If the child is still alive at that instant, the harness permanently records lifecycle_tracked_child_remained, performs a direct child fallback kill, and can finish with contradictory evidence such as:

  • passed = false
  • child_exited = true
  • exit_before_natural_timeout = false
  • cleanup_within_budget = true

On the current Windows host, an exact focused replay failed 5/5 while total cleanup still completed in roughly 443–616 ms. This is a test-infrastructure lifecycle race, not evidence that the shipped Gateway failed to stop.

Related: #108 established the lifecycle contract; #263 covers a different Rust helper/cache cleanup problem.

Required behavior

  1. Stop the verified Windows process tree as the primary operation (Invoke-TrackedTreeKill /T /F or an equivalent verified tree-stop primitive).
  2. Retain and verify the exact child identity captured before shutdown; do not treat PID reuse as proof about the original child.
  3. Verify both root and child termination inside one explicit teardown deadline.
  4. A direct-child fallback must be represented as typed degraded cleanup evidence; it must not silently convert an unverified primary tree stop into green evidence.
  5. Preserve a deterministic negative control that remains red when the tracked child genuinely survives.
  6. Do not fix this by merely increasing the 250 ms observation window or clearing the failure after fallback.

Acceptance

  • LifecycleReplay: 30/30 consecutive passes.
  • EnvironmentIsolation: 30/30 consecutive passes.
  • Loaded/concurrent rounds remain green.
  • For the positive path, root and verified child both exit before their natural timeout and within the existing 6000 ms cleanup budget; no lifecycle failure is recorded and both PIDs are gone.
  • The negative control remains red and explains which verified process survived.
  • Result fields cannot contradict one another: any fallback/degraded path is explicitly typed and summarized consistently.

Verification

Verification class: strict (process lifecycle, concurrency, and nondeterministic runtime evidence).

Run the focused lifecycle harness repetitions above, then the complete Python core suite at the exact candidate SHA. CI must pass on the repository Windows runner.

Activity

  1. added
    ready-for-agentFully specified, ready for an AFK agent
    P1Priority 1: current iteration goal
    bugSomething isn't working
    on Jul 30, 2026
  2. NOirBRight commented on Aug 1, 2026

    @NOirBRight
    OwnerAuthor

    This was generated by AI during triage.

    Agent Brief

    Category: bug
    Summary: Make the real-client lifecycle harness verify the exact tracked root and child process tree within one teardown deadline.

    Current behavior:
    The root can be killed successfully while a short child probe records a permanent failure; fallback cleanup then exits the child and leaves contradictory evidence.

    Desired behavior:
    Primary tree stop and exact-identity verification produce one consistent typed result. Fallback cleanup remains visible as degraded and a true survivor remains red.

    Key interfaces:

    • Tracked process identity and tree-stop abstraction.
    • Lifecycle summary fields for root, child, deadline, fallback, and cleanup.
    • Deterministic positive and survivor controls.

    Acceptance criteria:

    • Positive lifecycle and isolation repetitions pass with both exact processes gone.
    • Fallback/degraded and true-survivor outcomes cannot appear green.
    • PID reuse cannot satisfy exact-child verification.
    • Existing teardown deadline is preserved.

    Out of scope:

    • Increasing the observation window, clearing failures after fallback, or weakening process identity.
  3. NOirBRight commented on Aug 2, 2026

    @NOirBRight
    OwnerAuthor

    Implemented and squash-merged via PR #330 at ffe479e. Exact-head re-review passed on 3ba4f6e; Hosted CI / gate attempt 2 (run 30768114295) passed. LifecycleReplay and EnvironmentIsolationReplay 30/30, survivor negative control remains typed degraded/red.

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

    P1Priority 1: current iteration goalbugSomething isn't workingcampaign:0.1.8-beta60.1.8 Beta6 usable Chat campaignready-for-agentFully specified, ready for an AFK agent

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions