Skip to content

Windows: broker child processes leak and stale broker.json poisons setup tests on persistent machines #487

Description

@nategarelik

Two related Windows process-hygiene gaps found while running the suite repeatedly on a persistent (non-CI) Windows 11 box. Both are pre-existing (independent of any local change) and reproducible.

1. Stale broker.json poisons setup-family tests

%TEMP%\codex-companion\<repo-hash>\broker.json persists across runs and can point at a dead broker PID / stale named pipe. The setup-family tests key shared state on the real repo path (the test fixture's buildEnv() inherits process.env unmodified rather than using an ephemeral fixture dir), so a stale pointer makes every subsequent run report false "not ready" results. Symptom: ~6 spurious failures that vanish permanently after deleting that one directory. On ephemeral CI this is masked because the temp dir is always fresh.

Suggested fix: have the setup tests use an isolated $TEMP/HOME per run, or validate/ignore a broker.json whose PID is dead before treating it as authoritative.

2. Broker child processes leak on Windows

Repeated test runs accumulate orphaned app-server-broker.mjs node children (observed ~200 after a day of runs), each holding its temp workspace open. Same family as the known taskkill /T /F flake ("operation attempted is not supported" on a nested child). Correctness impact is low (each is isolated to a random temp workspace), but it blocks git worktree remove on any worktree a broker still holds open, and exhausts the process table over time.

Environment: Windows 11, codex-cli 0.144.1, plugin at current main. Happy to provide fuller repro details.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions