Skip to content

fix(task): avoid zsh process substitution hangs - #11904

Merged
jdx merged 1 commit into
jdx:mainfrom
Marukome0743:pr11904
Aug 13, 2026
Merged

jdx merged 1 commit into
jdx:mainfrom
Marukome0743:pr11904

Conversation

@Marukome0743

@Marukome0743 Marukome0743 commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • isolate non-interactive macOS task commands in a new session when mise is attached to a terminal
  • preserve process-group-based descendant cleanup and existing interactive/raw task behavior
  • add a macOS tmux regression test for zsh process substitution and run it in CI

Root cause

PR #9655 placed parallel task commands in independent process groups so failure and interrupt cleanup could terminate their full process trees. On macOS, a non-interactive zsh command in that process group can still interact with tmux's controlling terminal during process substitution and become job-control stopped. Linux does not exhibit the same behavior, and the macOS reproduction also completes with --jobs 1 or when mise's process-group management is disabled.

For non-interactive commands launched under a macOS terminal, this change uses setsid() instead. The child remains the leader of a process group whose ID matches its PID, so the existing killpg(child_pid) cleanup continues to reach descendants without leaving zsh attached to tmux's controlling terminal.

Verification

  • mise exec -- cargo test --all-features cmd::tests::test_child_process_isolation
  • mise run test:e2e e2e/tasks/test_task_zsh_process_substitution_tmux_macos
  • mise run test:e2e e2e/tasks/test_task_parallel_fail_fast
  • mise exec -- cargo check --all-features
  • mise exec -- cargo clippy --workspace --all-features --all-targets -- -D warnings
  • mise exec -- cargo fmt --all -- --check
  • mise exec -- shellcheck e2e/tasks/test_task_zsh_process_substitution_tmux_macos
  • mise exec -- shfmt -d e2e/tasks/test_task_zsh_process_substitution_tmux_macos

Addresses #9790

AI-assisted — Tool: Codex; model: OpenAI/GPT-5; version: unavailable.

Summary by CodeRabbit

  • Bug Fixes

    • Improved process handling on Unix systems, including macOS, for more reliable task execution and isolation.
    • Fixed edge cases involving zsh process substitution when running tasks inside tmux.
    • Improved behavior for both synchronous and asynchronous task execution.
  • Tests

    • Added macOS end-to-end coverage for parallel tasks, process substitution, and tmux-based execution.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 2b633165-48f3-47bb-ae5f-b0d1810f11b1

📥 Commits

Reviewing files that changed from the base of the PR and between 34f27d8 and 242111f.

📒 Files selected for processing (1)
  • e2e/tasks/test_task_zsh_process_substitution_tmux_macos
🚧 Files skipped from review as they are similar to previous changes (1)
  • e2e/tasks/test_task_zsh_process_substitution_tmux_macos

📝 Walkthrough

Walkthrough

The change centralizes Unix child-process isolation for synchronous and asynchronous execution. It adds unit tests for isolation selection and a macOS tmux end-to-end test for zsh process substitution.

Changes

Process isolation and regression coverage

Layer / File(s) Summary
Unified child isolation setup
src/cmd.rs
prepare_execute_child selects inherited groups, process groups, or macOS sessions. Synchronous and asynchronous execution use the helper. Unix tests cover the selection behavior.
macOS tmux regression test
.github/workflows/test.yml, e2e/tasks/test_task_zsh_process_substitution_tmux_macos
The macOS job installs fd and tmux, then runs a zsh process-substitution test with parallel tasks, status checks, output validation, and cleanup.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Workflow as macOS workflow
  participant Tmux as tmux
  participant Mise as mise task runner
  participant Zsh as zsh process substitution
  Workflow->>Tmux: Start detached test session
  Tmux->>Mise: Run aggregate task with parallel jobs
  Mise->>Zsh: Execute process-substitution task
  Mise-->>Tmux: Write status and task output
  Tmux-->>Workflow: Provide completion status and logs
Loading

Poem

A rabbit watched the child groups align,
While tmux kept zsh processes in line.
Tasks ran side by side,
Status files opened wide,
And macOS tests made the output shine.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: preventing zsh process substitution hangs in task execution.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

This PR currently has failing checks. If this continues for 7 days, it will be closed automatically.

This is warning day 1 of 7.

Please update the PR when you have a chance. Feel free to reopen or create a new PR if it is closed and you'd like to continue working on it.

This comment was generated by an automated workflow.

@Marukome0743
Marukome0743 force-pushed the pr11904 branch 3 times, most recently from 34f27d8 to fdae1c0 Compare August 12, 2026 04:36
@Marukome0743
Marukome0743 marked this pull request as ready for review August 12, 2026 10:45
@greptile-apps

greptile-apps Bot commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR changes macOS non-interactive task execution to use a separate session when mise is attached to a terminal, preserving existing process-group cleanup and interactive behavior.

  • Centralizes Unix child-isolation selection for synchronous and asynchronous commands.
  • Adds a macOS tmux regression test for zsh process substitution.
  • Installs tmux and runs the regression test in macOS CI.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
src/cmd.rs Introduces shared child-isolation logic that selects inherited terminal behavior, a process group, or a new macOS session.
e2e/tasks/test_task_zsh_process_substitution_tmux_macos Adds isolated macOS regression coverage for parallel zsh process substitution under tmux; the previously reported redundant temporary-file deletion is no longer present.
.github/workflows/test.yml Installs tmux in the macOS test job and executes the new regression test.

Reviews (4): Last reviewed commit: "fix(task): avoid zsh process substitutio..." | Re-trigger Greptile

@Marukome0743
Marukome0743 marked this pull request as draft August 12, 2026 11:59
@Marukome0743
Marukome0743 marked this pull request as ready for review August 13, 2026 00:09
@Marukome0743
Marukome0743 marked this pull request as draft August 13, 2026 00:14
@Marukome0743
Marukome0743 marked this pull request as ready for review August 13, 2026 02:41
@jdx
jdx merged commit 6cba393 into jdx:main Aug 13, 2026
31 checks passed
@Marukome0743
Marukome0743 deleted the pr11904 branch August 13, 2026 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants