fix(process): Windows exec/read empty output when detached spawn leaks#110198
fix(process): Windows exec/read empty output when detached spawn leaks#110198stantheman0128 wants to merge 3 commits into
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed July 20, 2026, 3:16 PM ET / 19:16 UTC. Summary PR surface: Source +18, Tests +77. Total +95 across 2 files. Reproducibility: no. high-confidence reproduction is available yet: the report gives a Windows main-session/headless path, but the contributor states the prior failure was not reproduced and the provided successful Gateway run does not demonstrate the patch executed on that failing path. Review metrics: none identified. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Identify the actual Windows main-session or headless Gateway boundary that passes detached spawn into the failing Do we have a high-confidence way to reproduce the issue? No high-confidence reproduction is available yet: the report gives a Windows main-session/headless path, but the contributor states the prior failure was not reproduced and the provided successful Gateway run does not demonstrate the patch executed on that failing path. Is this the best way to solve the issue? No: forcing the shared helper is a plausible defense-in-depth measure, but it is not yet the best proven fix because the only identified production caller already sets Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against cadad3b7bd12. Label changesLabel justifications:
Evidence reviewedPR surface: Source +18, Tests +77. Total +95 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
Review history (2 earlier review cycles)
|
Follow-up (CI + review direction)Pushed CI
Caller investigation
Repro honesty (Windows 11, this machine)I could not reproduce empty Direct Node spawn A/B on this host both returned stdout: Helper-level Maintainer askGiven ClawSweeper’s P1 (wrong shape / missing end-to-end path), I am not hard-selling this patch. Options I see:
Which do you prefer? If (2), I can close or further narrow this PR once you confirm. Local evidence |
Follow-up: Gateway / OpenClaw main-session after-fix proofUpdated the PR body Evidence with a stronger Windows run (branch tip What was captured
Gateway log also showed HonestyEmpty before-fix output was still not reproducible here under interactive/local Gateway. Headless Scheduled Task / service repro was not set up. Direct Node attached vs detached spawn both returned stdout on this host.
|
5e45d16 to
ffad8b6
Compare
Follow-up: reproducible Windows empty-before A/BRebased onto current Gold A/B (this Win11 box, Node v24.15.0)
Tests
Added a Windows-only regression that asserts the BEFORE empty PowerShell case and AFTER restore through PR Evidence section updated.
|
ffad8b6 to
d1aa923
Compare
|
Rebased again onto current
Prior |
d1aa923 to
53229f0
Compare
|
Rebased onto current |
|
@clawsweeper re-review Previous re-review run completed successfully but left the review comment stuck on the |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
On Windows, detached:true can break stdout/stderr pipe capture for headless hosts so exec/read tools return empty output with no error. Centralize the guard in spawnWithFallback so scattered call-site checks cannot miss a path. Fixes openclaw#105528 Co-authored-by: Cursor <[email protected]>
Keep the win32 detached:false guard internal to spawnWithFallback so knip no longer flags an unused export, and drop direct helper tests that tripped check-test-types on readonly stdio tuples. Co-authored-by: Cursor <[email protected]>
Document the reproducible before/after for openclaw#105528: unsanitized detached:true loses powershell Write-Output stdout; spawnWithFallback forces detached:false and restores capture. Co-authored-by: Cursor <[email protected]>
53229f0 to
d064287
Compare
Closes #105528
What Problem This Solves
Fixes an issue where Windows users running OpenClaw under a headless host (Scheduled Task / service) can see
execandreadtools return empty output with no error whendetached: truereaches Nodechild_process.spawn.Why This Change Was Made
Call sites already try to disable detached spawn on Windows, but those guards are scattered. This adds a centralized belt-and-suspenders guard in
spawnWithFallbackso every caller is covered, matching the historical Windows empty-stdout fix (#17806 / #18035) and the reporter's proposed upstream patch.User Impact
Windows users should get real tool stdout/stderr from supervisor-backed exec paths even if a caller accidentally requests
detached: true. POSIX detached behavior is unchanged.AI Assistance
AI-assisted (Cursor/Grok). Human author: Stan Shih (stantheman0128).
Evidence
Labels on #105528 at publish time:
bug,docs(noclawsweeper:no-new-fix-pr/needs-*). Covering open PR search for105528only hits meta tracker #74163.Gold A/B (Windows 11, Node v24.15.0, tip
d1aa9239cb)Reproducible empty-before on this host with
powershell.exe -NoProfile -Command Write-Output ...whendetached: trueis passed straight to Nodespawn. The branchspawnWithFallbackforcesdetached: falseand restores stdout.Regression test (same A/B):
Note:
cmd.exe /c echoand plainnode -e process.stdout.writeboth returned stdout even withdetached: trueon this interactive host. The PowerShell path is the clear empty-before / non-empty-after signal.Unit / helper (retained)
Windows forcing
detached: falseeven when callers passdetached: true; POSIX keepingdetached: true; cmd echo viaspawnWithFallback.Earlier Gateway after-fix path (still valid)
Isolated Gateway from this PR tree previously returned non-empty
exec/read(hello-exec-105528,hello-read-105528-from-workspace) via Gateway-backed agent turn. That run did not show empty-before; the PowerShell A/B above is the missing before/after.Maintainer note
createChildAdapteralready passesdetached: falseon Windows today. This PR remains a defense-in-depth guard inspawnWithFallbackfor any future caller that requestsdetached: true(PowerShell-style capture loss is now proven on this box).Made with Cursor