Repository navigation
Conversation
More → Task Manager lists every running session and task, heaviest first, with the memory, CPU and process count of its whole process tree: the CLI plus its MCP servers, dev servers and builds. A row opens into its processes, and each child can be killed on its own while the session goes on. Stop ends a session the usual way, then terminates whatever of its tree outlived the hangup (SIGTERM, then SIGKILL), so a child that ignores SIGHUP is not left behind as an invisible orphan. Pids are always resolved in main from the session or task itself, and a kill only reaches a process that is still in that tree.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a Task Manager to the sidebar's More menu, after the separator and right before Global settings. It lists every running session and task, heaviest first, with how much memory and CPU its whole process tree uses, and lets you end a single process inside a session or stop the session for good.
Why
With several sessions open, the machine can slow down and it is hard to tell which session is responsible. A session costs more than its CLI: MCP servers, dev servers, watchers and builds all run under it. Activity Monitor shows these as unrelated
node,pythonorzshprocesses, with no link back to the session that started them.There is also a quieter leak. Stop hangs up the PTY. A child that ignores SIGHUP, or that runs in the background, outlives the session. It is reparented to launchd and keeps its memory, and nothing in the app shows it any more.
What it does
node cli.jsinstead ofnode.Implementation notes
process-monitor.js:ps -A -o pid=,ppid=,rss=,pcpu=,stat=,comm=withLC_ALL=C; on Windows,Get-CimInstance Win32_Process(working set, no CPU).killInTreerefuses a PID that is not under the owner's root right now.killTreesends SIGKILL deepest first.stopTreehandles the stop → SIGTERM → SIGKILL escalation.main.js: four IPC handlers,get-process-usage,stop-owner,kill-owned-processandforce-stop-owner. The renderer only sends an owner reference (session id, or task project path and label). Root PIDs are always resolved in main fromactiveSessionsor the task manager, never taken from the renderer.task-manager.js:listProcesses()returns the running, non-compound tasks that own a process.preload.js:getProcessUsage,stopOwner,killOwnedProcess,forceStopOwner.public/process-viewer.js(new) and#process-viewerinindex.html.public/icons.jsadds amemoryicon (Lucide's memory-stick shape).public/app.jsadds the menu entry. The other full-page viewers (grid, plans, memory, stats, settings) now also hide the Task Manager when they open.public/style.css: apm-section in the existing dark palette, with a narrow layout below 860 px.Testing
test/process-monitor.test.js(13 tests) covers:psoutput (decimal comma, names with spaces, zombies left out) and the Windows outputmeasuresortingkillInTreeguardkillTreestopTreeescalation, including a clean stop that signals nothing and a reused PID that is never hittest/task-manager.test.js:listProcesseslists only running tasks that own a process.npm test: 566 tests, all pass exceptfileDiff reads tracked and untracked changes…andprojectGitInfo and projectGitDiff…. Those two fail the same way on currentmainon my machine because of a globalcolor.ui = alwaysgit setting. Withcolor.ui=auto, 566/566 pass.electron .with an isolatedSWITCHBOARD_DATA_DIR), with two terminals: one running anodeprocess holding about 300 MB, the other anodeprocess that ignores SIGHUP and SIGTERM.nodeended it and the terminal kept running.nodechild was gone too (checked withps). Before this change, that child survived as an orphan.Notes
stopTreein a follow-up.