fix(server): propagate --enable-proposed-api in serve-web - #310207
Conversation
The `code serve-web` CLI accepts `--enable-proposed-api EXTENSION_ID` but never propagated the allowlist to the workbench environment service or the server-side extension scanner. As a result, extensions declaring `enabledApiProposals` in their package.json had their proposals wiped at runtime by ExtensionsProposedApi and failed to activate. This wires the flag through two paths so it matches desktop behavior: 1. Server scanner: extend IProductService.extensionsEnabledWithApiProposalVersion in setupServerServices so the node extension scanner keeps the manifest's enabledApiProposals when --enable-proposed-api is passed. 2. Workbench env service: add a new `enabledExtensionProposedApi` field to IWorkbenchConstructionOptions, populate it from the CLI args in webClientServer, and surface it via BrowserWorkbenchEnvironmentService .extensionEnabledProposedApi so the runtime allowlist in ExtensionsProposedApi matches the requested IDs. Fixes microsoft#228781
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: Benjamin Pasero (@bpasero)Matched files:
|
|
Did you test this? I would have expected that this needs changes to the code cli. |
The Rust CLI parses --enable-proposed-api as a global EditorOptions flag but was not forwarding it to the node server subprocess spawned by serve-web. As a result, the flag never reached the server's argv parser and the server-side plumbing in serverServices.ts and webClientServer.ts had no input to act on. Capture the flag in ConnectionManager from CommandContext and pass it through StartArgs, then append --enable-proposed-api=<id> for each requested extension ID when spawning the server process.
|
You're right — thank you for catching this. My earlier repro was with a manually-launched server where I passed the flag to the server's own argv, so I missed that the Rust CLI (`cli/src/commands/serve_web.rs`) doesn't forward `--enable-proposed-api` to the server subprocess. The server-side changes alone were incomplete. Pushed 92c37f0 which completes the fix:
With this, `code --enable-proposed-api=publisher.ext serve-web ...` now actually propagates the allowlist to the server subprocess, which then flows through the server-side changes in this PR. |
|
Martin Aeschlimann (@aeschli) to confirm what I pushed in 92c37f0 — yes, the Rust CLI side needed changes too, and that commit adds them. I traced the flag from
Repro steps I ran: with an extension declaring Happy to split the Rust commit into its own PR if you'd prefer to review it separately. |
|
Thanks a lot Yogeshwaran C (@yogeshwaran-c) |
There was a problem hiding this comment.
Pull request overview
This PR fixes code serve-web --enable-proposed-api so that the proposed-API allowlist is honored in both the server-side extension scanning path and the browser workbench runtime environment, matching desktop behavior and resolving #228781.
Changes:
- Adds
enabledExtensionProposedApitoIWorkbenchConstructionOptionsand plumbs it fromwebClientServer.tsinto the browser environment service. - Updates
setupServerServicesto extendproductService.extensionsEnabledWithApiProposalVersionwhen--enable-proposed-apiis present, so the node extension scanner preservesenabledApiProposals. - Updates the Rust
serve-webcommand to forward the global--enable-proposed-apientries to the server subprocess.
Show a summary per file
| File | Description |
|---|---|
| src/vs/workbench/services/environment/browser/environmentService.ts | Exposes proposed-API allowlist from construction options (but currently mishandles empty-array semantics). |
| src/vs/workbench/browser/web.api.ts | Extends workbench construction options with an allowlist for proposed APIs. |
| src/vs/server/node/webClientServer.ts | Populates the new workbench option from parsed server args. |
| src/vs/server/node/serverServices.ts | Extends product service config so server extension scanning retains proposals for allowlisted extensions. |
| cli/src/commands/serve_web.rs | Forwards --enable-proposed-api from the CLI into the spawned server process. |
Copilot's findings
- Files reviewed: 5/5 changed files
- Comments generated: 1
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
f002426
What this PR does
Fixes #228781
The
code serve-webCLI accepts--enable-proposed-api EXTENSION_IDbut never propagated the allowlist to the workbench environment service or the server-side extension scanner. Extensions declaringenabledApiProposalsin theirpackage.jsontherefore had their proposals wiped at runtime byExtensionsProposedApiand failed to activate with:Approach
This wires the flag through two paths so it matches desktop behavior:
Server scanner (
src/vs/server/node/serverServices.ts): extendIProductService.extensionsEnabledWithApiProposalVersioninsetupServerServicesso the node extension scanner (AbstractExtensionsScannerService) keeps the manifest'senabledApiProposalswhen--enable-proposed-apiis passed.Workbench environment service: add a new
enabledExtensionProposedApifield toIWorkbenchConstructionOptions, populate it from the CLI args inwebClientServer.ts, and surface it viaBrowserWorkbenchEnvironmentService.extensionEnabledProposedApiso the runtime allowlist inExtensionsProposedApimatches the requested extension IDs.The existing
productConfiguration.extensionsEnabledWithApiProposalVersionpropagation inwebClientServer.tsis preserved — that field is still needed by the browser-sidewebExtensionsScannerServicefor web extensions.Repro / verification
"enabledApiProposals": ["chatParticipantPrivate"]in itspackage.json.code --enable-proposed-api="publisher.myextension" serve-web --port 11001 --without-connection-token --accept-server-license-termsWithout this PR the activation fails as in the issue. With this PR it succeeds, matching the behavior of
codedesktop with the same flag.