Skip to content

The supervisor's Windows tree kill has no time limit: spawn ignores its timeoutMs #1979

Todo

Description

@V3RON

NodeProcessSupervisor.signal (src/ports/process-supervisor.ts:100-103) starts its PowerShell kill with processRunner.spawn(..., { timeoutMs: TREE_KILL_TIMEOUT_MS }). NodeProcessRunner.spawn reads no timeoutMs; only run does (src/ports/node-process-runner.ts:94).

So the 10 s limit at line 193 does nothing. A PowerShell that hangs is never ended, and the endedBy half of the fallback at line 113 never runs, so the wrapper is not ended alone either. src/ports/AGENTS.md says every wait an adapter makes is bounded.

Read in the code on origin/main at dead1fb, not run. Found while triaging #1965.

Written by an agent.

Activity

  1. added
    bug:new
    on Nov 30, 2026
  2. self-assigned this
    on Nov 30, 2026
  3. V3RON commented on Nov 30, 2026

    @V3RON
    ContributorAuthor

    Reproduction

    Seen on: fakes (a fake child on a fake clock, under the real NodeProcessRunner). Not run on Windows.

    src/ports/process-supervisor.test.ts on bug/1979-repro: "a (SIGTERM | SIGKILL) whose PowerShell hangs ends that PowerShell at 10 s and then signals the wrapper alone".

    $ pnpm exec vitest run --project unit src/ports/process-supervisor.test.ts
    AssertionError: expected [] to deeply equal [ 'PowerShell ended', …(1) ]   src/ports/process-supervisor.test.ts:209:20
    Tests  2 failed | 34 passed | 1 skipped (37)
    

    Root cause

    Defect, as filed. src/ports/process-supervisor.ts:100 calls spawn, which takes no limit by contract (src/ports/AGENTS.md); only run arms a timer (src/ports/node-process-runner.ts:94). The existing "never finishes" test missed it: ScriptedProcessRunner answers endedBy: "timeout" for a call nothing times. The compiler missed it because ProcessRunOptions accepts timeoutMs for spawn. The spawn-error and non-timeout-kill halves of the fallback do run.

    Simplest fix

    In signal, call run(command, args, { stdio: "ignore", timeoutMs: TREE_KILL_TIMEOUT_MS }) with the same fallback, and drop the outer try: run rejects where spawn threw.

    fix tried, then restored: pnpm typecheck clean; process-supervisor, process-runner, child-window,
    key-set-fetcher and adb-server tests: 124 passed | 1 skipped
    an earlier run of all of src/ports failed key-set-fetcher once (#1981)
    pnpm test:changed: 7495 passed, 1 timed out (lease-model.test.ts, 20 s); alone, with the fix, it passed. Host load 79.
    

    Alternatives rejected

    Risk

    Fast track

    • Defect: yes
    • Fix tried: yes
    • Nothing public added or broken: no — a tree kill slower than 10 s completes today and would be cut
    • No ADR or rule changed: yes
    • One fix: no — the limit's length changes what is left running

    Side findings

    Written by an agent.

  4. removed their assignment
    on Nov 30, 2026
  5. added
    bug:ready
    and removed
    bug:new
    on Dec 1, 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:ready

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions