Skip to content

flaky: LocalTaskProvider readiness-reap test times out on CI #486

Closed

Description

@allisonmahmood

packages/execution/src/LocalTaskProvider.test.ts › "reaps a task that misses readiness instead of retaining a running fleet slot" timed out at 10.9s against its 10s budget on the test (24) job, with no code cause. The PR only touched runtime-package tests; the other 1606 tests passed, and test (22) passed on the same commit.

Failing run: https://github.com/allisonmahmood/patchy-cloud/actions/runs/37049319852/job/110978455106 (PR #484)

The test spawns a real local task with execution.pool.wait at 1, waits for start to fail, then reaps it. Process spawn plus reap on a busy runner can exceed the fixed 10s timeout. The same family of slow execution tests also timed out locally under parallel pnpm verify load (Fleet.test.ts, Inspection.test.ts).

Activity

  1. added
    flaky
    on Oct 2, 2026
  2. allisonmahmood commented on Oct 2, 2026

    @allisonmahmood
    OwnerAuthor

    This was generated by AI during triage.

    Agent Brief

    Category: bug
    Summary: The local task owner treats a process disappearing mid-/proc-read as a failure, so a task that misses readiness can hang start until its ~10s deadline.

    Current behavior:
    When a local task misses readiness, its detached owner SIGKILLs the task's process group, then scans /proc (groupMembers) to certify no descendants remain before writing the stopped record. The local task store's process readers (processIdentity, groupMembers) treat only ENOENT as "process gone". If any process on the machine is reaped between open and read of its /proc/<pid>/stat, the read fails with ESRCH. That error escapes, so the owner exits without writing stopped. LocalTaskProvider.start then polls the stale running record until its own deadline (readiness wait + cleanup + kill grace, about 10s) and fails with transport.

    Only the killed-before-readiness path scans /proc, because normal stops carry final stats and skip it. That is why "reaps a task that misses readiness…" is the only test in its file that flakes. Busy runners make the race likelier.

    The same class exists at the owner's two "check alive, then SIGKILL" sites: recovering a previous owner's child group, and reaping leftover descendants. A process exiting between the check and the kill throws ESRCH. The readiness-miss kill already tolerates it.

    Desired behavior:
    A process disappearing during any /proc read or kill in the local task owner or store means "already gone", never a failure. ENOENT and ESRCH both mean gone, matching the execution process launcher's /proc reader and the CLI dev state's missingProcess.

    Key interfaces:

    • Local task store: processIdentity() returns null, and groupMembers() skips the entry, when a /proc read fails with ENOENT or ESRCH.
    • Local task owner: every process.kill on a pid previously seen alive tolerates ESRCH.

    Reproduction (verified):

    • Reading a reaped process's stat through an already-open handle fails with ESRCH. Opening it after the reap fails with ENOENT.
    • With ~400 sleep 0.1–0.5 processes churning, groupMembers threw ESRCH in 10 of 249 scans.
    • Under the same churn the test timed out 4 times in 40 runs, at 10.5–11.3s (CI saw 10.9s; the passing rerun took 856ms, and its three siblings ran at normal speed in the failing run). With ESRCH treated as gone it passed 40/40.
    • Raising the test budget to 30s does not help: with an injected ESRCH the test still fails at about 10.4s, with transport instead of provider.

    Acceptance criteria:

    • A focused test shows a process reaped between open and read reads as gone, not as an error.
    • The readiness-reap test passes repeatedly under heavy process churn, with its 10s budget unchanged.
    • pnpm verify passes.

    Out of scope:

    • Raising the test timeout. The healthy path takes under 1s.
    • Making start notice a dead owner and relaunch it, or having the owner certify stopped on an unknown failure. It deliberately never certifies an exit it did not observe.
    • The Fleet.test.ts and Inspection.test.ts timeouts under local load. Inspection doesn't use the detached owner; file them separately if they recur.
    • The ECS provider.
  3. added
    bug
    ready-for-agent
    area:server
    on Oct 2, 2026
  4. added a commit that references this issue on Oct 3, 2026
    55d6130
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

    area:serverbugflakyready-for-agent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions