Skip to content

fix(process): disable detached spawn on Windows to fix empty exec output#18067

Merged
steipete merged 1 commit intoopenclaw:mainfrom
arosstale:fix/18035-windows-exec-empty-output
Feb 16, 2026
Merged

fix(process): disable detached spawn on Windows to fix empty exec output#18067
steipete merged 1 commit intoopenclaw:mainfrom
arosstale:fix/18035-windows-exec-empty-output

Conversation

@arosstale
Copy link
Contributor

@arosstale arosstale commented Feb 16, 2026

Summary

Fix exec tool returning (no output) on Windows, a regression from the supervisor refactor in cd44a0d.

Fixes #18035
Fixes #17806

Root Cause

The new createChildAdapter always spawns with detached: true. On Windows Scheduled Tasks (headless, no console), detached: true creates a new process group that can prevent stdout/stderr pipes from connecting. The old runCommandWithTimeout in exec.ts never used detached: true.

The no-detach fallback only triggers on EBADF spawn errors. The pipe disconnection issue does not throw — it silently produces empty output.

Fix

On Windows (process.platform === "win32"), default to detached: false. On POSIX, keep detached: true with the no-detach fallback.

Tests

  • Updated child.test.ts with platform-aware assertions.

Sign-Off

  • Models: Claude (Anthropic)
  • Keyword: lobster-biscuit

Greptile Summary

Fixed Windows exec output regression by disabling detached: true spawn mode. On Windows Scheduled Tasks (headless environments), detached mode creates a new process group that silently prevents stdout/stderr pipes from connecting. The fix conditionally uses detached: false on Windows while maintaining detached: true on POSIX systems with a fallback mechanism.

Confidence Score: 5/5

  • Safe to merge - targeted Windows-specific fix with proper platform checks and test coverage
  • The fix is minimal, well-documented, and directly addresses the root cause. Tests are updated with platform-aware assertions. No breaking changes or security concerns.
  • No files require special attention

Last reviewed commit: 1163407

…put (openclaw#18035)

The supervisor's child adapter always spawned with `detached: true`,
which creates a new process group. On Windows Scheduled Tasks (headless,
no console), this prevents stdout/stderr pipes from properly connecting,
causing all exec tool output to silently disappear.

The old exec path (pre-supervisor refactor) never used `detached: true`.
The regression was introduced in cd44a0d (refactor process spawning).

Changes:
- child.ts: set `detached: false` on Windows, keep `detached: true` on
  POSIX (where it's needed to survive parent exit). Skip the no-detach
  fallback on Windows since it's already the default.
- child.test.ts: platform-aware assertions for detached behavior.

Fixes openclaw#18035
Fixes openclaw#17806
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a critical regression where the exec tool returned empty output on Windows when running under Scheduled Tasks (headless environments). The issue was introduced in the supervisor refactor (cd44a0d) which always spawned child processes with detached: true. On Windows, this creates a new process group that can prevent stdout/stderr pipes from connecting properly in headless scenarios.

Changes:

  • Modified createChildAdapter to use detached: false on Windows and detached: true on POSIX systems
  • Removed the no-detach fallback on Windows since detached defaults to false
  • Updated tests to verify platform-specific spawn behavior

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/process/supervisor/adapters/child.ts Platform-aware detached spawn setting: false on Windows for pipe compatibility, true on POSIX with fallback
src/process/supervisor/adapters/child.test.ts Platform-specific test assertions to verify correct detached behavior and fallback configuration

@steipete steipete merged commit a1a1f56 into openclaw:main Feb 16, 2026
31 of 32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

3 participants