Skip to content

feat: add session support to requests from utility process - #51279

Merged
jkleinsc merged 1 commit into
mainfrom
robo/utility_process_cache_support
Apr 30, 2026
Merged

jkleinsc merged 1 commit into
mainfrom
robo/utility_process_cache_support

Conversation

@deepak1556

@deepak1556 deepak1556 commented Apr 23, 2026 •

Copy link
Copy Markdown
Member

Description of Change

Refs microsoft/vscode#307216
Fixes #44727

Add session and partition options to utilityProcess.fork() to allow utility processes to use a session-specific network context instead of the system network context. This enables HTTP caching, cookie isolation, and webRequest interception for utility process network requests.

When respondToAuthRequestsFromMainProcess is true and a session is provided, HTTP 401/407 auth challenges now emit a login event on the UtilityProcess instance rather than on app. Without a session, auth challenges continue to emit on app for backward compatibility.

This in design should be treated similar to how we manage sessions and http related stuff for renderer process, where webContents is the backing store in the main process.

Release Notes

Notes: Added session support to net module requests from utility process

@deepak1556 deepak1556 added semver/minor backwards-compatible functionality target/41-x-y PR should also be added to the "41-x-y" branch. target/42-x-y PR should also be added to the "42-x-y" branch. labels Apr 23, 2026
@electron-cation electron-cation Bot added the new-pr 🌱 PR opened recently label Apr 23, 2026
@deepak1556
deepak1556 force-pushed the robo/utility_process_cache_support branch from 404e7d0 to dd35b1e Compare April 23, 2026 12:45
@deepak1556
deepak1556 marked this pull request as ready for review April 23, 2026 13:21
@deepak1556 deepak1556 changed the title feat: add http cache support to requests from utility process feat: add session support to requests from utility process Apr 23, 2026

@ckerr ckerr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

API LGTM

Windows CI failure looks unrelated to the PR:

Run actions/download-artifact@3e5f45b
Downloading single artifact
Error: Unable to download artifact(s): Artifact not found for name: siso-windows-amd64
Please ensure that your artifact is not expired and the artifact was uploaded using a compatible version of toolkit/upload-artifact.
For more information, visit the GitHub Artifacts FAQ: https://github.com/actions/toolkit/blob/main/packages/artifact/docs/faq.md

Add `session` and `partition` options to `utilityProcess.fork()` to
allow utility processes to use a session-specific network context
instead of the system network context. This enables HTTP caching,
cookie isolation, and webRequest interception for utility process
network requests.

When `respondToAuthRequestsFromMainProcess` is true and a session is
provided, HTTP 401/407 auth challenges now emit a `login` event on
the UtilityProcess instance rather than on `app`. Without a session,
auth challenges continue to emit on `app` for backward compatibility.
@ckerr
ckerr force-pushed the robo/utility_process_cache_support branch from dd35b1e to 0b0300b Compare April 27, 2026 00:38
@electron-cation electron-cation Bot removed the new-pr 🌱 PR opened recently label Apr 30, 2026

@jkleinsc jkleinsc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

API LGTM

@jkleinsc
jkleinsc merged commit 8f0f08e into main Apr 30, 2026
73 checks passed
@jkleinsc
jkleinsc deleted the robo/utility_process_cache_support branch April 30, 2026 19:03
@release-clerk

release-clerk Bot commented Apr 30, 2026

Copy link
Copy Markdown

Release Notes Persisted

Added session support to net module requests from utility process

@trop

trop Bot commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

I was unable to backport this PR to "42-x-y" cleanly;
you will need to perform this backport manually.

@trop trop Bot removed the target/42-x-y PR should also be added to the "42-x-y" branch. label Apr 30, 2026
@trop

trop Bot commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

I was unable to backport this PR to "41-x-y" cleanly;
you will need to perform this backport manually.

@trop

trop Bot commented May 19, 2026

Copy link
Copy Markdown
Contributor

@deepak1556 has manually backported this PR to "42-x-y", please check out #51698

Comment on lines +574 to +578
std::string partition;
if (opts.Get("session", &session) && session) {
} else if (opts.Get("partition", &partition)) {
session = Session::FromPartition(args->isolate(), partition);
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Was scrolling through the code while reviewing the backport request for #51698. An empty if is somewhat unusual syntax (but not necessarily incorrect). Just want to make sure this is intentional. :)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Sort of :) , aligning with existing parsing

// Obtain the session.
std::string partition;
api::Session* session = nullptr;
if (options.Get("session", &session) && session) {
} else if (options.Get("partition", &partition)) {
session = Session::FromPartition(isolate, partition);
} else {
// Use the default session if not specified.
session = Session::FromPartition(isolate, "");
}
. If the intention from the branching is not clear feel free to rewrite, otherwise this particular style is not disallowed by the styleguide https://google.github.io/styleguide/cppguide.html#Formatting_Looping_Branching

@trop trop Bot added merged/42-x-y PR was merged to the "42-x-y" branch. and removed in-flight/42-x-y labels May 20, 2026
@trop

trop Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

@VerteDinde has manually backported this PR to "41-x-y", please check out #53000

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

Labels

api-review/approved ✅ merged/42-x-y PR was merged to the "42-x-y" branch. semver/minor backwards-compatible functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

How to use fetch() from utility process with self-signed certs / custom proxy settings?

4 participants