You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
remote.portsAttributes: exact-port label clears HTTPS protocol inherited from a range #344750
A label-only exact-port rule in remote.portsAttributes clears HTTPS inherited from a matching range. The Ports view and forwarded URI consequently fall back to HTTP.
Forward localhost:3500 through a tunnel provider without explicitly overriding the protocol.
Open the port's context menu → Change Port Protocol.
Expected: HTTPS remains selected with the Application label. Actual: HTTP is selected; the resolved protocol is undefined.
Workaround: Add "protocol": "https" to the exact-port rule or remove that rule. Reversing the configuration entries does not help.
Screenshot and environment
Captured from native Code - OSS built from unmodified main, version 1.145.0, commit 915c6faed9c93b3c05bd9aa37ba0b1358103bdf1, on macOS 26.2 arm64 (Node 24.22.1, Electron 43.8.3). This source version is newer than the 1.143.1 stable release mentioned by the bot.
Extensions disabled: Core service tests reproduce the failure without extensions. For the screenshot, installed extensions were disabled; one local fixture supplied a tunnel provider and enabled the real Ports view. It uses the real configuration/merge/tunnel paths and does not force the protocol.
Diagnosis and scope
PortsAttributes.getAttributes unconditionally assigns attributes.protocol = found.protocol for an exact-port rule. The range runs first, then the label-only rule erases its protocol. A range starting at 3500 instead survives because of tied sort ordering.
The source-built client and core regression assertions confirm the failure. Native verification covers protocol selection with a controlled local provider; no TLS exchange or SSH/Dev Containers/cloud connection was tested. The client-only build did not compile every built-in extension.
This is separate from #344184 and predates its fix #344185.
Thanks for creating this issue! It looks like you may be using an old version of VS Code; the latest stable release is 1.143.1. Please try upgrading to the latest version and checking whether this issue remains.
In PortsAttributes.getAttributes (src/vs/workbench/services/remote/common/tunnelModel.ts), when merging attributes for an exact-port match (found.key === port), protocol is assigned unconditionally:
attributes.protocol=found.protocol;
Because sortAttributes orders ranges by start port and exact rules by port, a range such as 3000-4000 with protocol: 'https' runs first and sets attributes.protocol = 'https'. When the exact-port rule 3500: { label: 'Application' } is evaluated next, its undefined protocol clears the previously inherited protocol back to undefined.
Plan
Update attributes.protocol assignment in the exact-port branch of PortsAttributes.getAttributes to preserve inherited values when omitted:
Sharing media and context from merged PR #344764 for verification:
A label-only exact-port rule currently erases HTTPS inherited from an overlapping range, making the forwarded URI and Ports view fall back to HTTP. Preserve the accumulated protocol when the exact rule omits it; explicit HTTP/HTTPS overrides retain precedence. This also prevents an empty exact rule from incorrectly activating remote.otherPortsAttributes.
Five regression tests cover HTTP/HTTPS inheritance, ranges starting below or at the exact port, explicit overrides, and empty/undefined-rule fallback interactions.
Validation
33 passing across tunnelModel, browserRemoteResourceHandler, remoteExplorer and urlFinder browser suites. Two new regression tests fail against the original code.
Targeted ESLint and git diff --check pass.
Native source-built Code - OSS 1.145.0 on macOS arm64: the real Ports view changes from HTTP to HTTPS with the same configuration; the local tunnel provider receives protocol: "https" after the fix.
Before — unmodified source:
After — fixed source:
Checks ran on base 915c6faed9c9, before rebasing onto 959f45119fbe; affected files and dependencies were unchanged and checks were not rerun. Native verification used a controlled local provider, without a TLS exchange or SSH/Dev Containers/cloud connection. Full distribution build, full suite and broad typecheck were not run.
Activity
vs-code-engineering commentedon Oct 28, 2026
Thanks for creating this issue! It looks like you may be using an old version of VS Code; the latest stable release is 1.143.1. Please try upgrading to the latest version and checking whether this issue remains.
Happy Coding!
ayushkrsingh946 commentedon Oct 28, 2026
Hi Anh Dang (@kinqsradio) Alex Ross (@alexr00)! I'd like to work on this issue. Could you please assign this to me?
Analysis
In
PortsAttributes.getAttributes(src/vs/workbench/services/remote/common/tunnelModel.ts), when merging attributes for an exact-port match (found.key === port),protocolis assigned unconditionally:Because
sortAttributesorders ranges by start port and exact rules by port, a range such as3000-4000withprotocol: 'https'runs first and setsattributes.protocol = 'https'. When the exact-port rule3500: { label: 'Application' }is evaluated next, its undefined protocol clears the previously inherited protocol back toundefined.Plan
attributes.protocolassignment in the exact-port branch ofPortsAttributes.getAttributesto preserve inherited values when omitted:tunnelModel.test.tsverifying:kinqsradio commentedon Oct 28, 2026
I already opened #344764 for this issue. #344775 appears to duplicate the same fix.
ayushkrsingh946 commentedon Oct 28, 2026
vs-code-engineering commentedon Oct 29, 2026
Sharing media and context from merged PR #344764 for verification:
A label-only exact-port rule currently erases HTTPS inherited from an overlapping range, making the forwarded URI and Ports view fall back to HTTP. Preserve the accumulated protocol when the exact rule omits it; explicit HTTP/HTTPS overrides retain precedence. This also prevents an empty exact rule from incorrectly activating
remote.otherPortsAttributes.Five regression tests cover HTTP/HTTPS inheritance, ranges starting below or at the exact port, explicit overrides, and empty/undefined-rule fallback interactions.
Validation
git diff --checkpass.protocol: "https"after the fix.Before — unmodified source:
After — fixed source:
Checks ran on base
915c6faed9c9, before rebasing onto959f45119fbe; affected files and dependencies were unchanged and checks were not rerun. Native verification used a controlled local provider, without a TLS exchange or SSH/Dev Containers/cloud connection. Full distribution build, full suite and broad typecheck were not run.Source PR: #344764