terminal: load the output compactor on demand - #335586
Draft
Dmitriy Vasyura (dmitrivMS) wants to merge 1 commit into
Draft
terminal: load the output compactor on demand#335586Dmitriy Vasyura (dmitrivMS) wants to merge 1 commit into
Dmitriy Vasyura (dmitrivMS) wants to merge 1 commit into
Conversation
Keep optional terminal output compaction out of the initial workbench and Agents bundles. Emit the import-free compactor for UI build targets and load it only when enabled, preserving raw output with explicit logging if loading or compaction fails. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot started reviewing on behalf of
Dmitriy Vasyura (dmitrivMS)
September 10, 2026 22:53
View session
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The lazy-loading path, build-target coverage, fallback behavior, and focused tests are consistent and complete.
Review tier: Balanced
Findings: None
What changed in this PR
Defers terminal output compaction until first use, reducing initial workbench bundle size while preserving fallback behavior and telemetry.
Changes:
- Dynamically loads the standalone compactor through
FileAccess. - Adds the compactor to desktop, web, and server-web builds.
- Tests configuration gating, compaction, and load failures.
| File | Description |
|---|---|
runInTerminalTool.test.ts |
Covers lazy loading and failure handling. |
runInTerminalTool.ts |
Implements on-demand compactor loading. |
consoleCompactor.ts |
Documents standalone-module constraints. |
build/next/index.ts |
Adds entry points to esbuild targets. |
gulpfile.vscode.web.ts |
Adds the legacy web entry point. |
gulpfile.reh.ts |
Adds the server-web entry point. |
buildfile.ts |
Defines and wires the standalone module. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Summary
Keep the optional terminal-output compactor out of the initial workbench bundle.
chat.tools.terminal.outputCompactiondefaults to false, but its implementation was statically imported at startup.FileAccessonly when compaction is enabled and used.Bundle impact
Compared real minified, NLS-enabled bundles at the same base revision:
The desktop reduction is approximately 0.39%. The standalone module is 93,101 bytes including the standard build helper banner; this defers code rather than deleting it.
Verified that the implementation is absent from the initial source maps for desktop, Agents desktop, web, Agents web, and server-web. The three UI build targets emit byte-identical standalone modules with one source-map input and no imports.
First-use tradeoff
Five fresh real Code OSS windows hosted the exact production-built standalone module and exercised the production
vscode-file://loader:These are local first-use measurements, not web network latency or a complete terminal-tool invocation. No end-to-end startup-time improvement is claimed.
Validation
compile-clientrerun before commit.The Electron unit runner uses
file://, so tests use a test-origin import adapter; the separate live-workbench checks cover the production resource URI.