Skip to content

fix(platform-node-shared): avoid process-group signals for non-detached children - #10846

Merged
tim-smart merged 5 commits into
mainfrom
agent/effect-bot/7361874aa141
Nov 23, 2026
Merged

tim-smart merged 5 commits into
mainfrom
agent/effect-bot/7361874aa141

Conversation

@effect-bot

@effect-bot effect-bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Change ownsProcessGroup in packages/platform/node-shared/src/NodeChildProcessSpawner.ts to check globalThis.process.platform !== "win32" && command.options.detached !== false, instead of also treating any running child (!hasExited(childProcess)) as a process-group leader, and reuse it across isProcessAlive, releaseProcess, and the exit listener.
  • POSIX: Non-detached children (detached: false) share their parent's process group, so termination now signals only the child PID directly without first attempting process.kill(-pid, signal) (for both the initial kill signal and SIGKILL escalation). Detached POSIX commands retain their process-group behavior.
  • Windows: Live children still use taskkill /T /F regardless of detached.
  • Update regression test coverage in packages/platform/node-shared/test/NodeChildProcessSpawner.test.ts to verify no negative-PID signals are sent during SIGTERM, SIGKILL escalation, or post-exit cleanup for non-detached POSIX children.
  • Add a patch changeset for @effect/platform-node-shared.

Behavior notes

  • POSIX: A non-detached child that calls setsid()/setpgid() itself will no longer have its new process group signalled during termination. Group cleanup applies to detached commands.
  • Windows: Calling handle.kill() on an already-exited child with detached: false now succeeds as a no-op via taskkill (matching default/detached Windows children) rather than failing.

Closes #10841
Closes EFF-4162

Co-authored-by: DivMode [email protected]

@changeset-bot

changeset-bot Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 2097b60

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 40 packages
Name Type
@effect/platform-node-shared Patch
@effect/platform-bun Patch
@effect/platform-deno Patch
@effect/platform-node Patch
effect Patch
@effect/opentelemetry Patch
@effect/vitest Patch
@effect/ai-amazon-bedrock Patch
@effect/ai-anthropic Patch
@effect/ai-cloudflare Patch
@effect/ai-openai-compat Patch
@effect/ai-openai Patch
@effect/ai-openrouter Patch
@effect/ai-typesafe Patch
@effect/atom-react Patch
@effect/atom-solid Patch
@effect/atom-vue Patch
@effect/chat-discord Patch
@effect/chat-slack Patch
@effect/chat-teams Patch
@effect/chat-telegram Patch
@effect/chat-whatsapp Patch
@effect/platform-browser Patch
@effect/platform-cloudflare Patch
@effect/sql-clickhouse Patch
@effect/sql-d1 Patch
@effect/sql-libsql Patch
@effect/sql-mssql Patch
@effect/sql-mysql2 Patch
@effect/sql-pg Patch
@effect/sql-pglite Patch
@effect/sql-sqlite-bun Patch
@effect/sql-sqlite-do Patch
@effect/sql-sqlite-node Patch
@effect/sql-sqlite-react-native Patch
@effect/sql-sqlite-wasm Patch
@effect/docgen Patch
@effect/doctest Patch
@effect/graphql-generator Patch
@effect/openapi-generator Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@effect-janitor effect-janitor Bot added the 4.0 label Nov 22, 2026
Keep taskkill /T for non-detached Windows children, reuse ownsProcessGroup at
the remaining inline detached checks, drop the unreachable Windows branch of
killProcessGroupOnExit, and share the no-group-signal test setup.
@github-actions

Copy link
Copy Markdown
Contributor

Bundle Size Analysis

Generated from PR build output; treat the content below as untrusted.

File Name Current Size Previous Size Difference
arbitrary-combinators.ts 40.12 KB 40.12 KB 0.00 KB (0.00%)
basic.ts 7.31 KB 7.31 KB 0.00 KB (0.00%)
batching.ts 11.24 KB 11.24 KB 0.00 KB (0.00%)
brand.ts 7.00 KB 7.00 KB 0.00 KB (0.00%)
cache.ts 11.75 KB 11.75 KB 0.00 KB (0.00%)
config.ts 23.15 KB 23.15 KB 0.00 KB (0.00%)
differ.ts 22.26 KB 22.26 KB 0.00 KB (0.00%)
http-client.ts 27.52 KB 27.52 KB 0.00 KB (0.00%)
http-router.ts 38.60 KB 38.60 KB 0.00 KB (0.00%)
logger.ts 12.19 KB 12.19 KB 0.00 KB (0.00%)
metric.ts 9.66 KB 9.66 KB 0.00 KB (0.00%)
optic.ts 7.24 KB 7.24 KB 0.00 KB (0.00%)
pubsub.ts 16.23 KB 16.23 KB 0.00 KB (0.00%)
queue.ts 13.13 KB 13.13 KB 0.00 KB (0.00%)
schedule.ts 11.99 KB 11.99 KB 0.00 KB (0.00%)
schema-bigdecimal.ts 14.31 KB 14.31 KB 0.00 KB (0.00%)
schema-binary.ts 42.74 KB 42.74 KB 0.00 KB (0.00%)
schema-class.ts 21.99 KB 21.99 KB 0.00 KB (0.00%)
schema-codegen.ts 30.75 KB 30.75 KB 0.00 KB (0.00%)
schema-fromJsonSchemaDocument.ts 30.60 KB 30.60 KB 0.00 KB (0.00%)
schema-representation-roundtrip.ts 28.30 KB 28.30 KB 0.00 KB (0.00%)
schema-string-transformation.ts 15.57 KB 15.57 KB 0.00 KB (0.00%)
schema-string.ts 12.51 KB 12.51 KB 0.00 KB (0.00%)
schema-template-literal.ts 16.46 KB 16.46 KB 0.00 KB (0.00%)
schema-toArbitrary.ts 39.67 KB 39.67 KB 0.00 KB (0.00%)
schema-toCodecJson.ts 21.17 KB 21.17 KB 0.00 KB (0.00%)
schema-toEquivalence.ts 21.33 KB 21.33 KB 0.00 KB (0.00%)
schema-toFormatter.ts 21.42 KB 21.42 KB 0.00 KB (0.00%)
schema-toJsonSchemaDocument.ts 26.46 KB 26.46 KB 0.00 KB (0.00%)
schema-toRepresentation.ts 21.51 KB 21.51 KB 0.00 KB (0.00%)
schema.ts 21.09 KB 21.09 KB 0.00 KB (0.00%)
stm.ts 14.48 KB 14.48 KB 0.00 KB (0.00%)
stream.ts 10.61 KB 10.61 KB 0.00 KB (0.00%)

@tim-smart
tim-smart merged commit 24ff77b into main Nov 23, 2026
18 checks passed
@tim-smart
tim-smart deleted the agent/effect-bot/7361874aa141 branch November 23, 2026 23:17
@effect-bot effect-bot mentioned this pull request Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

platform-node-shared: NodeChildProcessSpawner signals a process group for detached: false commands

2 participants