feat: configurable terminal pool size with cleanup on task release#12156
Draft
roomote-v0[bot] wants to merge 1 commit intomainfrom
Draft
feat: configurable terminal pool size with cleanup on task release#12156roomote-v0[bot] wants to merge 1 commit intomainfrom
roomote-v0[bot] wants to merge 1 commit intomainfrom
Conversation
- Add maxTerminalPoolSize setting (1-20, default 5) to global settings schema - Enforce pool size limit in TerminalRegistry.createTerminal() by disposing oldest idle terminals when at capacity - Update releaseTerminalsForTask() to dispose idle terminals when a task ends - Wire setting through ClineProvider, webviewMessageHandler, and ExtensionStateContext - Add slider UI in Terminal Settings (Basic section) - Add English i18n translation for the new setting - Add tests for pool size enforcement and task release cleanup Addresses #12153
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.
Related GitHub Issue
Closes: #12153
Description
This PR attempts to address Issue #12153 by implementing two key terminal management improvements:
Configurable terminal pool size -- A new
maxTerminalPoolSizesetting (range 1-20, default 5) that caps how many terminals Roo Code keeps open simultaneously. When the limit is reached, the oldest idle terminal is disposed before creating a new one.Terminal cleanup on task release -- When a task ends,
releaseTerminalsForTask()now disposes idle terminals that are not busy and have no pending output, rather than just clearing theirtaskId. Busy terminals are left intact.These mechanisms apply regardless of whether the VSCode integrated terminal or the inline (execa) terminal is used, as requested by the issue commenter.
Files changed:
packages/types/src/global-settings.ts-- AddedmaxTerminalPoolSizeto the settings schema with validation (int, 1-20)packages/types/src/vscode-extension-host.ts-- Added to the settings key union typesrc/integrations/terminal/TerminalRegistry.ts-- Pool size getter/setter,enforcePoolSizeLimit(),disposeTerminal(), updatedreleaseTerminalsForTask()src/core/webview/ClineProvider.ts-- Wire the setting through state initialization and getStatesrc/core/webview/webviewMessageHandler.ts-- Handle setting updates from the UIwebview-ui/src/components/settings/TerminalSettings.tsx-- Slider UI for pool size (1-20)webview-ui/src/components/settings/SettingsView.tsx-- Pass new propwebview-ui/src/context/ExtensionStateContext.tsx-- State and setter for the new settingwebview-ui/src/i18n/locales/en/settings.json-- English translation for the settingTest Procedure
TerminalRegistry.spec.tscovering:cd src && npx vitest run integrations/terminal/__tests__/TerminalRegistry.spec.ts)Pre-Submission Checklist
Documentation Updates
The new setting is exposed in the Terminal Settings UI with a description. No external documentation changes needed.
Feedback and guidance are welcome.
Interactively review PR in Roo Code Cloud