-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Description
Summary
resolveWebviewView() in src/core/webview/ClineProvider.ts calls this.getState().then(...) three times to read terminal and TTS settings. Each call runs the full getState() path (including CloudService/ContextProxy reads), creating redundant work during view activation.
Grep: resolveWebviewView + this.getState().then
Impact: Eliminates ~2 redundant async getState() executions during view activation, reducing duplicate reads and ensuring a single consistent settings snapshot. Three separate calls can theoretically return different values if settings change mid-resolution, making this both a performance and a correctness concern.
Affected location
Search pattern: this.getState().then in resolveWebviewView
- Terminal settings fetch (~line 756)
- TTS enabled fetch (~line 778)
- TTS speed fetch (~line 782)
Suggested fix
Consolidate into a single await this.getState() with destructuring. resolveWebviewView is already async, so this is consistent with the rest of the method.
Note: Preserve existing error-handling behavior when consolidating.
const {
terminalShellIntegrationTimeout = Terminal.defaultShellIntegrationTimeout,
terminalShellIntegrationDisabled = false,
terminalCommandDelay = 0,
terminalZshClearEolMark = true,
terminalZshOhMy = false,
terminalZshP10k = false,
terminalPowershellCounter = false,
terminalZdotdir = false,
ttsEnabled,
ttsSpeed,
} = await this.getState()
Terminal.setShellIntegrationTimeout(terminalShellIntegrationTimeout)
Terminal.setShellIntegrationDisabled(terminalShellIntegrationDisabled)
Terminal.setCommandDelay(terminalCommandDelay)
Terminal.setTerminalZshClearEolMark(terminalZshClearEolMark)
Terminal.setTerminalZshOhMy(terminalZshOhMy)
Terminal.setTerminalZshP10k(terminalZshP10k)
Terminal.setPowershellCounter(terminalPowershellCounter)
Terminal.setTerminalZdotdir(terminalZdotdir)
setTtsEnabled(ttsEnabled ?? false)
setTtsSpeed(ttsSpeed ?? 1)Acceptance criteria
getState()is called once instead of three times during view resolution- Terminal and TTS settings are still applied correctly
- No behavioral change (including error handling)
Problem: resolveWebviewView() triggers three redundant getState() calls during view resolution.
Context: Any user opening the Roo Code panel; duplicates cloud/context reads and can apply inconsistent settings if state changes mid-resolution.
Reproduction steps:
- Open the Roo Code panel (or reload VS Code)
- Add temporary logging/breakpoints around
getState()to observe three invocations inresolveWebviewView
Expected result: One getState() execution; single snapshot applied.
Actual result: Three independent getState() executions.
App Version: v3.47.3
API Provider / Model Used: N/A (not provider-dependent)
Roadmap alignment: Enhanced User Experience (faster activation)