Processes a command leaves behind are never killed on Stop, chat close or quit
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 49/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
Research direction
Start with src/main/tools/shell.ts, especially killTree at line 378 and the foreground run flow around line 221; trace how background commands are stopped and how output draining is handled. Check the platform-specific process cleanup paths, including the AppContainer behavior. Done means the proposed tests pass: Stop after sleep 100 & leaves no process behind, and a foreground run also leaves no process behind.
Written by the indexing model from the issue text.
Description
Found in the 2026-10-07 code review (traced through the code; not run on POSIX).
Problem
killTree (src/main/tools/shell.ts:378) returns early when child.exitCode !== null. exitCode is set as soon as the shell exits, while programs it started (its process group on POSIX) can keep running and keep the pipes open. So the group is never signalled.
- Background commands:
closenever fires, so the entry stays "running", andstopBackground→killTreedoes nothing. - Foreground commands:
runresolves 500 ms afterexit(:221), and the leftover process isn't tracked at all.
AppContainer is not affected, because KILL_ON_JOB_CLOSE ends the whole job.
Scenario
The model runs npm run dev &, which models often do even with background: true. bash exits, and Stop, closing the chat or project, and quitting the app all leave the dev server running. The next npm run dev then fails with "port in use".
Fix
- On POSIX, always run
process.kill(-child.pid, 'SIGKILL')(ESRCH is already caught). Do it inkillTreeregardless ofexitCode, and also once a foreground run's output has drained (or keep the pgid and kill it instopAll). - On Windows without a sandbox, put the child in a job object (or record its descendants), because
taskkill /Tcan't find orphans. - Tests: Stop after
sleep 100 &leaves no process behind, and the same after a foreground run finishes.
- Dominant language
- TypeScript
- Stars
- 2
- Forks
- 2
- Avg merge
- 5h 28m
- Merged PRs (30d)
- 24
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from PierrunoYT/patch
-
Claude Code chats: tool calls made inside Claude Code subagents leave cards that end as "(stopped)"Openbug priority: low severity: low
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
PierrunoYT/patch#289 ·
Maintainers usually reply within 1 day
-
bug priority: medium severity: low
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
PierrunoYT/patch#285 ·
Maintainers usually reply within 1 day
-
priority: medium security severity: low
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
PierrunoYT/patch#283 ·
Maintainers usually reply within 1 day
-
enhancement priority: medium security severity: medium
Difficulty 5/5 Over a week Newbie friendliness 35/100
PierrunoYT/patch#294 ·
Maintainers usually reply within 1 day
-
priority: low security severity: low
Difficulty 4/5 1-2 days Newbie friendliness 38/100
PierrunoYT/patch#293 ·
Maintainers usually reply within 1 day
All issues in PierrunoYT/patch
Similar issues
-
Contrib indemnité de départ à la retraite : faire le pont avec le simulateur sur la page génériqueOpenP1
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
SocialGouv/code-du-travail-numerique#7561 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
kubernetes-sigs/headlamp#7950 ·
Maintainers usually reply within 3 days
-
README for cliPossibly taken @Janvi-kapoor claimed this today. OpenOSCI'26
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
GauravKarakoti/SecureFlow#1308 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 1 day
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
vitest-dev/vitest#11577 ·
Maintainers usually reply within 1 day