Skip to content

Codex CLI resume timeouts can leave descendant processes running on Windows #111900

Description

@ooiuuii

Bug type

Behavior bug (incorrect process state after a timeout)

Beta release blocker

No

Summary

On Windows, a timed-out Codex CLI session resume signals only the direct codex exec resume process, allowing shell or tool descendants to remain running after OpenClaw reports the timeout.

Steps to reproduce

  1. Run the Codex node-host session resume path on Windows with a short timeoutMs.
  2. Have the spawned Codex CLI process create a longer-lived descendant process.
  3. Let the resume timeout expire.
  4. Observe that the timeout handler calls ChildProcess.kill() only on the direct child PID; it never requests Windows process-tree termination.

Expected behavior

The timeout should terminate the Codex CLI process and its descendants, with a bounded fallback if the Windows termination helper fails or stalls.

Actual behavior

The timeout sends SIGTERM and later SIGKILL only to the direct ChildProcess. Node's Windows implementation does not propagate those calls to descendant processes.

OpenClaw version

main at 5197428add4787e8773bb26fe695c2e2d19d7b2a

Operating system

Windows 11

Install method

Source checkout

Model

Codex CLI session runtime; model-independent

Provider / routing chain

OpenClaw Codex plugin -> local Codex CLI

Additional provider/model setup details

No provider-specific setup is required. The defect is in local child-process timeout cleanup.

Logs

Before fix: timeout -> child.kill("SIGTERM") -> child.kill("SIGKILL")
No Windows process-tree termination request is made.

Screenshots, recordings, and evidence

A focused regression harness covers Windows SIGTERM/SIGKILL, trusted System32 resolution, spawn errors, nonzero exits, stalled taskkill, successful completion, and non-Windows direct signaling. All 8 cases pass with the proposed fix.

Impact and severity

  • Affected: Windows users of Codex CLI session resume.
  • Severity: Moderate; timed-out work can continue in orphaned descendants.
  • Frequency: Every affected timeout where the Codex CLI has spawned descendants.
  • Consequence: lingering processes, resource use, and work continuing after OpenClaw reports timeout.

Additional information

The fix uses OpenClaw's trusted Windows System32 resolver, force-terminates the complete process tree, and bounds the taskkill helper with a watchdog before falling back to the direct child.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.clawsweeper:bulk-filedClawSweeper detected a high recent issue-filing volume from this author.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:otherThis issue has meaningful maintainer-visible impact outside the owned taxonomy.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions