Repository navigation
Conversation
PSRunner kept its persistent PowerShell bridge alive until the server exited, so every open but unused session held 35-140 MB. The bridge now stops after 10 minutes with no command (EXIT, then kill after 500 ms) and the next run() starts it again silently. The timer is armed when the bridge is ready and after a command leaves nothing current or queued, cleared on queue/send and in stop(), and unref'd. The idle length is a constructor argument so tests can use it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…or the benchmark The benchmark's leftovers check needs to see the idle bridge stop within seconds, not 10 minutes. Unset, zero or not a number: 10 minutes, as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
What
On Windows, an idle clawdcursor server stops its PowerShell UIA bridge after 10 minutes with no command, and the next call starts it again (about 1 s for PowerShell plus the UIA assemblies).
Why
Every MCP server keeps one bridge for the whole session, from the warm-up at start until the host closes the session. Measured on one Windows PC with 11 open Claude sessions: 22 servers, 22 bridges, 777 MB working set held by the bridges alone (35–137 MB each), while the servers were idle (16 ms CPU in 30 s across all of them). An open but unused session now drops to the node process alone after 10 minutes.
How
PSRunner(src/platform/ps-runner.ts):stop(). It isunref()'d.EXIT, kills after 500 ms, and detaches the process. The existingthis.proc !== procguard ignores its exit.run()starts a fresh bridge, without the "Restarting crashed bridge" log.Tests
src/__tests__/ps-runner-timeout.test.ts, three new cases with fake timers:run()spawns a new bridge and resolves. This fails on main.stop()leaves no timer behind.typecheck, typecheck:tests, lint (0 errors, the 3 warnings as on main),
npm run test:ci: 4300 passed, 80 skipped, 0 failed.No release: for the 2.4 train.
🤖 Generated with Claude Code