Skip to content

Fix Mangler TS compilation errors in ClaudeAgent and XaaAuthProvider - #328117

Open
Casey Flynn (caseyflynn-google) wants to merge 1 commit into
microsoft:mainfrom
caseyflynn-google:fix/mangler-breakages
Open

Fix Mangler TS compilation errors in ClaudeAgent and XaaAuthProvider#328117
Casey Flynn (caseyflynn-google) wants to merge 1 commit into
microsoft:mainfrom
caseyflynn-google:fix/mangler-breakages

Conversation

@caseyflynn-google

@caseyflynn-google Casey Flynn (caseyflynn-google) commented Jul 29, 2026

Copy link
Copy Markdown

Fixes #328113

This PR unblocks the vscode-reh-web-*-min build targets, which are currently crashing in main during both the AST Mangler phase and the tail-end esbuild optimizer check.

Fixes:

  • String Indexing (Test Mangler Aliasing): Bypassed test failures caused by the AST Mangler strictly renaming private test properties (_sessions, _keybindingService, etc.) in terminalInstance.test.ts, voiceSessionController.test.ts, and codexPrewarmEviction.test.ts.
  • Testing Encapsulation: Refactored string-hack inside claudeAgent.test.ts to correctly utilize the public getSessionForTesting(sessionUri) helper method.
  • Dynamic Imports: Added /** @skipMangle */ to ConfirmTerminalCommandTool and ScriptedMockAgent because they are imported via dynamic string paths, escaping the Mangler's internal export-compression dictionary.
  • Mixin Inheritance: Converted the private variables on the inline Generic Mixin XaaAuthenticationProvider to public. The AST mangler physically cannot calculate inheritance limits on dynamic anonymous Mixins, causing its properties to falsely collide with mangled parent variables during compilation.
  • Protected Inheritance Mangling: Shifted updateChecked and getTooltip in sessionChangesEditor.ts to protected to properly constrain the AST inheritance mangler and bypass collision errors.
  • Esbuild Unicode Crashes: Translated raw terminal chevron characters [›❯▸▶] to their standard Unicode escape-sequences [\u203A\u276F\u25B8\u25B6] in outputMonitor.ts. Did the same for unescaped Em-Dashes () and Ellipses () rendering as \u2014 and \u2026 in chatGoalSummaryService.ts. Unescaped non-ASCII characters inside strings and RegEx blocks violently crash the minifier.
  • Wiring: Added missing mocked dependency injections for NewChatVoiceTargetService in voiceBridge.test.ts.

Copilot AI review requested due to automatic review settings July 29, 2026 22:04
@vs-code-engineering

Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

Anthony Kim (@anthonykim1)

Matched files:

  • src/vs/workbench/contrib/terminal/test/browser/terminalInstance.test.ts
  • src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/monitoring/outputMonitor.ts
  • src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalConfirmationTool.ts

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Unblocks minified Remote Extension Host builds by addressing TypeScript mangler and esbuild optimizer failures.

Changes:

  • Preserves dynamically imported class names during mangling.
  • Works around mixin and private-field mangling conflicts.
  • Escapes non-ASCII terminal prompt characters.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
runInTerminalConfirmationTool.ts Excludes a dynamically referenced class from export mangling.
outputMonitor.ts Replaces raw Unicode chevrons with escapes.
terminalInstance.test.ts Adjusts private service access for mangled compilation.
extHostXaaAuthProvider.ts Prevents mixin member mangling collisions.
mockAgent.ts Preserves the dynamically imported mock agent name.
claudeAgent.test.ts Adjusts private session access for mangled compilation.
Comments suppressed due to low confidence (1)

src/vs/workbench/contrib/terminal/test/browser/terminalInstance.test.ts:303

  • This duplicates the untyped private-service access above and is also flagged by local/code-no-any-casts. Use the same typed unknown assertion with IKeybindingService so changes to softDispatch remain type-checked.
			const keybindingService = (instance as any)['_keybindingService'];

const { ctx, canUseTool, sessionUri } = await materialize();

const session = ctx.agent['_sessions'].get(AgentSession.id(sessionUri))?.defaultChat;
const session = (ctx.agent as any)['_sessions'].get(AgentSession.id(sessionUri))?.defaultChat;

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

test('custom key event handler should handle commands in DEFAULT_COMMANDS_TO_SKIP_SHELL in VS Code and not xterm when sendKeybindingsToShell is disabled', async () => {
const instance = await createTerminalInstance();
const keybindingService = instance['_keybindingService'];
const keybindingService = (instance as any)['_keybindingService'];

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

@caseyflynn-google
Casey Flynn (caseyflynn-google) marked this pull request as ready for review July 30, 2026 18:07
@caseyflynn-google

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree company="Google"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build: vscode-reh-web-linux-x64-min throws Mangler and esbuild pipeline errors

3 participants