Commit Graph

51 Commits

Author SHA1 Message Date
Alex Knight
e1a7c5b860 fix: handle EPIPE errors on child process stdin writes (#75602)
Fix three child-process stdin write paths that let async EPIPE errors
escape to uncaughtException and crash the gateway.

extensions/imessage/src/client.ts (the actual #75438 crash path):
- Add child.stdin.on('error') listener in start() to catch async EPIPE
  and reject all pending requests via failAll().
- Add write callback to request() stdin.write() that rejects the
  specific pending request on error, instead of leaving it hanging
  until timeout.

src/agents/mcp-stdio-transport.ts:
- Fix write callback race in send(): previously resolved the promise
  immediately when write() returned true, then the write callback with
  EPIPE would fire after the promise was already fulfilled. Now always
  settles the promise from the write callback so the outcome is known
  before resolving.

src/process/exec.ts:
- Add stdin.on('error') before writing input so EPIPE from a
  prematurely-exited child is swallowed — the process exit handler
  reports the real status.

One reporter observed a gateway crash after 10.5 hours of stable
uptime — a single EPIPE on an iMessage RPC child process stdin write
killed the gateway with code 1.

Fixes: #75438
2026-05-01 21:45:12 +10:00
Vincent Koc
e6d2c9b080 fix(process): decode Windows command output with console codepage awareness (#72393)
* fix(process): decode Windows command output with console codepage awareness

* fix(clownfish): address review for ghcrawl-199248-agentic-merge (1)
2026-04-26 23:10:59 -07:00
Peter Steinberger
c3074bd513 refactor: dedupe path lowercase helpers 2026-04-07 15:53:50 +01:00
Peter Steinberger
edab013e51 fix: support corepack cmd shim on windows 2026-04-06 03:48:47 +01:00
Peter Steinberger
f4fa53de3f fix(ci): repair zalouser sdk path and exec timeout kill 2026-04-04 04:51:33 +01:00
Peter Steinberger
f03d7c5a4c refactor: centralize Windows exec invocation 2026-04-02 18:27:53 +01:00
lawrence3699
2fd7f7ca52 fix(exec): hide windows console windows 2026-04-03 02:19:32 +09:00
Vincent Koc
37099dae3e fix(ci): restore matrix monitor import guards and windows npm exit codes 2026-03-31 22:04:35 +09:00
Vincent Koc
11590eb6ce fix(ci): restore dotenv trust boundary and windows npm exit handling 2026-03-31 21:51:17 +09:00
Vincent Koc
25a3d37970 fix(ci): restore matrix guardrails and windows exec shim 2026-03-31 21:27:43 +09:00
George Zhang
e133924047 [codex] harden clawhub plugin publishing and install (#56870)
* fix: harden clawhub plugin publishing and install

* fix(process): preserve windows shim exit success
2026-03-29 11:59:19 -07:00
Ayaan Zaidi
cfba0ab68f fix(process): wait for windows close state settlement 2026-03-28 16:55:15 +05:30
Ayaan Zaidi
c3c1f9df54 fix(process): wait for windows exit code settlement 2026-03-28 16:37:29 +05:30
Ayaan Zaidi
e0ba57e9c7 fix: preserve windows child exit codes 2026-03-28 14:55:20 +05:30
Tak Hoffman
262e5c57c8 fix(ci): stabilize module-bound exact regressions (#56085)
* Adjust compaction identifier test for summary args

* Harden exec completion after child exit

* Handle SDK compaction and skill shape drift

* Stabilize Synology Chat module-bound tests

* Restore skill source compatibility shims

* Restore self-hosted provider discovery mocks
2026-03-27 19:44:15 -05:00
Peter Steinberger
4e531d382b fix(ci): restore cli runtime mocks and timeout exits 2026-03-22 23:43:58 +00:00
Peter Steinberger
344b2286aa refactor: share windows command shim resolution 2026-03-10 22:18:04 +00:00
Vincent Koc
b48291e01e Exec: mark child command env with OPENCLAW_CLI (#41411) 2026-03-09 19:14:08 -04:00
0xlin2023
d000316d19 fix: Windows: openclaw plugins install fails with spawn EINVAL
Fixes #7631
2026-03-06 22:19:16 +05:30
Peter Steinberger
234e07fcc0 refactor(process): extract command env resolution helper 2026-03-02 14:02:47 +00:00
icesword0760
6e008e93be Process: fix Windows .cmd spawn EINVAL (openclaw#29759) thanks @icesword0760
Verified:
- pnpm vitest run src/process/exec.test.ts src/process/exec.windows.test.ts

Co-authored-by: icesword0760 <123886211+icesword0760@users.noreply.github.com>
Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
2026-03-02 07:49:54 -06:00
Peter Steinberger
a1a8ec6870 fix(windows): land #31147 plugin install spawn EINVAL (@codertony)
Landed from contributor PR #31147 by @codertony.

Co-authored-by: codertony <codertony@users.noreply.github.com>
2026-03-02 02:23:53 +00:00
joshavant
e8637c79b3 fix(secrets): harden sops migration sops rule matching 2026-02-26 14:47:22 +00:00
Sebastian
726ad45c75 Revert "fix: add windowsHide: true to spawn in runCommandWithTimeout"
This reverts commit 32c66aff49.
2026-02-16 20:27:32 -05:00
Guy
32c66aff49 fix: add windowsHide: true to spawn in runCommandWithTimeout
Fixes flashing conhost.exe windows on Windows when exec module spawns
child processes. The windowsHide: true option prevents orphaned conhost.exe
processes and eliminates disruptive terminal window flashing.

Closes #18613
2026-02-16 23:49:47 +01:00
Onur
cd44a0d01e fix: codex and similar processes keep dying on pty, solved by refactoring process spawning (#14257)
* exec: clean up PTY resources on timeout and exit

* cli: harden resume cleanup and watchdog stalled runs

* cli: productionize PTY and resume reliability paths

* docs: add PTY process supervision architecture plan

* docs: rewrite PTY supervision plan as pre-rewrite baseline

* docs: switch PTY supervision plan to one-go execution

* docs: add one-line root cause to PTY supervision plan

* docs: add OS contracts and test matrix to PTY supervision plan

* docs: define process-supervisor package placement and scope

* docs: tie supervisor plan to existing CI lanes

* docs: place PTY supervisor plan under src/process

* refactor(process): route exec and cli runs through supervisor

* docs(process): refresh PTY supervision plan

* wip

* fix(process): harden supervisor timeout and PTY termination

* fix(process): harden supervisor adapters env and wait handling

* ci: avoid failing formal conformance on comment permissions

* test(ui): fix cron request mock argument typing

* fix(ui): remove leftover conflict marker

* fix: supervise PTY processes (#14257) (openclaw#14257) (thanks @onutc)
2026-02-16 02:32:05 +01:00
Peter Steinberger
a7eb0dd9a5 fix(security): harden Windows child process spawning 2026-02-15 03:24:55 +01:00
Shadow
be18f5f0f0 Process: fix Windows exec env overrides 2026-02-13 12:06:47 -06:00
Burak Sormageç
23b1b51568 fix(windows): normalize env entries for spawn 2026-02-13 17:48:04 +01:00
Burak Sormageç
e97aa45428 fix(windows): handle undefined environment variables in runCommandWithTimeout 2026-02-13 17:48:04 +01:00
Burak Sormageç
d7fb01afad fix(windows): resolve command execution and binary detection issues 2026-02-13 17:48:04 +01:00
Jhin
dc8a63cb8b fix: skip extension append if command already has one
Addresses review feedback - now checks path.extname() before
appending .cmd to avoid producing invalid paths like npm.cmd.cmd
2026-01-31 20:39:33 -06:00
Jhin
5c8880ed3f fix(process): resolve npm/pnpm spawn ENOENT on Windows
On Windows, non-.exe commands like npm, pnpm, yarn, npx require
their .cmd extension when using spawn(). This adds a resolveCommand()
helper that automatically appends .cmd on Windows for these commands.

Fixes #5773
2026-01-31 20:39:33 -06:00
cpojer
f06dd8df06 chore: Enable "experimentalSortImports" in Oxfmt and reformat all imorts. 2026-02-01 10:03:47 +09:00
cpojer
5ceff756e1 chore: Enable "curly" rule to avoid single-statement if confusion/errors. 2026-01-31 16:19:20 +09:00
Peter Steinberger
c6cdbb630c fix: harden exec spawn fallback 2026-01-25 06:37:39 +00:00
Peter Steinberger
6ea4cb0012 fix: suppress npm fund prompts 2026-01-21 03:47:50 +00:00
Peter Steinberger
c379191f80 chore: migrate to oxlint and oxfmt
Co-authored-by: Christoph Nakazawa <christoph.pojer@gmail.com>
2026-01-14 15:02:19 +00:00
Peter Steinberger
3061d8e057 fix: preserve Windows cmd start URL quoting (#794) (thanks @roshanasingh4) 2026-01-13 04:26:43 +00:00
danielz1z
4570e1db7d fix(update): merge custom env with process.env in spawn
When the update runner passes custom env vars (like CLAWDBOT_UPDATE_IN_PROGRESS),
the current code uses `env ?? process.env` which replaces the entire environment
instead of merging — losing PATH, HOME, etc.

This causes the doctor step to fail with 'node: No such file or directory'.

Fix: merge custom env with process.env instead of replacing it.
2026-01-11 10:39:07 +00:00
Peter Steinberger
24c3ab6fe0 fix: unblock claude-cli live runs 2026-01-11 00:55:22 +00:00
Peter Steinberger
bb54e60179 fix(logging): decouple file logs from console verbose 2026-01-03 12:32:14 +00:00
Peter Steinberger
fbf5efb570 feat(process): support env overrides in exec 2026-01-01 22:55:21 +01:00
Peter Steinberger
fcf0c28132 chore: make pi-only rpc with fixed sessions 2025-12-05 17:50:02 +00:00
Peter Steinberger
b3e50cbb33 Switch to clawdis RPC mode and complete rebrand 2025-12-05 17:22:53 +00:00
Peter Steinberger
e5f677803f chore: format to 2-space and bump changelog 2025-11-26 00:53:53 +01:00
Peter Steinberger
bcbf0de240 Add cwd option for command replies 2025-11-25 16:19:24 +01:00
Peter Steinberger
2aac606979 chore: fix type regressions and helpers 2025-11-25 04:40:57 +01:00
Peter Steinberger
39cd9bde1f chore: route exec logging through logger 2025-11-25 04:11:02 +01:00
Peter Steinberger
afdaa7ef98 Refactor CLI and Twilio modules; add helper tests and comments 2025-11-25 03:11:39 +01:00