refactor(vscode): remove dead code from Agent Manager - #12594
Conversation
Remove code paths that are unreachable in production: - External-worktrees message flow: the webview never sends requestExternalWorktrees, importExternalWorktree, or importAllExternalWorktrees, and never handles the externalWorktrees response. Drop the provider handlers, WorktreeImporter.external()/ path()/all(), WorktreeManager.listExternalWorktrees(), and the matching message types on both sides of the protocol. - agentManager.sessionMeta: posted by the extension after worktree creation but never handled in the webview. - Host.serverPort(): interface member with no callers. - Unused imports (Disposable, ExtensionMessage, Popover), an unused derivedFallbackBranches parameter, and two methods with no callers or tests (SessionTerminalManager.hasTerminal/hasActiveTerminal, SetupScriptService.getScript). Net -316 lines. Typecheck, lint, knip, and unit tests pass.
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Verified via grep that all removed symbols ( Files Reviewed (15 files)
Reviewed by claude-sonnet-5 · Input: 34 · Output: 7.2K · Cached: 848.8K Review guidance: REVIEW.md from base branch |
Remove code paths that are unreachable in production: - External-worktrees message flow: the webview never sends requestExternalWorktrees, importExternalWorktree, or importAllExternalWorktrees, and never handles the externalWorktrees response. Drop the provider handlers, WorktreeImporter.external()/ path()/all(), WorktreeManager.listExternalWorktrees(), and the matching message types on both sides of the protocol. - agentManager.sessionMeta: posted by the extension after worktree creation but never handled in the webview. - Host.serverPort(): interface member with no callers. - Unused imports (Disposable, ExtensionMessage, Popover), an unused derivedFallbackBranches parameter, and two methods with no callers or tests (SessionTerminalManager.hasTerminal/hasActiveTerminal, SetupScriptService.getScript). Net -316 lines. Typecheck, lint, knip, and unit tests pass.
Static analysis (tsc unused-locals sweep + protocol message flow tracing) surfaced several Agent Manager code paths that are unreachable in production. This PR deletes them, net -316 lines.
Dead message flows (never travel the wire):
agentManager.externalWorktrees: the extension posted it, but the webview has no handler. The webview also never sendsrequestExternalWorktrees,importExternalWorktree, orimportAllExternalWorktrees, so the whole flow is dead: provider handlers,WorktreeImporter.external()/path()/all(),WorktreeManager.listExternalWorktrees(),ExternalWorktreeItem/ExternalWorktreeInfo, and the matching message type definitions on both sides of the protocol. Branch/PR import (importFromBranch/importFromPR) is untouched.agentManager.sessionMeta: posted after worktree creation but never handled in the webview. TheworktreeSetupready message already carries everything the webview consumes.Dead interface surface:
Host.serverPort(): no callers (the panel gets the port throughbuildWebviewHtmldirectly).SessionTerminalManager.hasTerminal()/hasActiveTerminal()andSetupScriptService.getScript(): no callers and no behavior tests.Disposable,ExtensionMessage,Popover) and an unusedderivedFallbackBranchesparameter.Arch tests that asserted on the removed structure were updated to match.