Skip to content

[WSLC] Add wslc get cli session api#40141

Open
chemwolf6922 wants to merge 1 commit intofeature/wsl-for-appsfrom
user/chemwolf6922/add-wslc-get-cli-session-api
Open

[WSLC] Add wslc get cli session api#40141
chemwolf6922 wants to merge 1 commit intofeature/wsl-for-appsfrom
user/chemwolf6922/add-wslc-get-cli-session-api

Conversation

@chemwolf6922
Copy link
Copy Markdown
Contributor

@chemwolf6922 chemwolf6922 commented Apr 9, 2026

Summary of the Pull Request

  • Add the WslcGetCliSession api.

PR Checklist

  • Closes: Link to issue #xxx
  • Communication: I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected
  • Tests: Added/updated if needed and all pass
  • Localization: All end user facing strings can be localized
  • Dev docs: Added/updated if needed
  • Documentation updated: If checked, please file a pull request on our docs repo and link it here: #xxx

Detailed Description of the Pull Request / Additional comments

Validation Steps Performed

Add test: WslcSdkTests::GetCliSession

@chemwolf6922 chemwolf6922 requested a review from a team as a code owner April 9, 2026 03:18
Copilot AI review requested due to automatic review settings April 9, 2026 03:18
@chemwolf6922 chemwolf6922 changed the title Add wslc get cli session api [WSLC] Add wslc get cli session api Apr 9, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new WSLC SDK entrypoint to obtain the default “CLI session” and centralizes the default CLI session naming logic so it can be shared by both the SDK and the wslc CLI.

Changes:

  • Added WslcGetCliSession to the WSLC SDK (header + export + implementation) to open the default CLI session by name.
  • Introduced wsl::windows::common::WSLCSessionDefaults (shared defaults for wslc-cli / wslc-cli-admin) and updated CLI/task/model/test code to use it.
  • Added a Windows test validating WslcGetCliSession behavior.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
test/windows/WslcSdkTests.cpp Adds GetCliSession SDK test and a release-only RAII wrapper for session refs.
test/windows/wslc/e2e/WSLCE2EHelpers.cpp Switches default session name lookup to the new common defaults helper.
src/windows/WslcSDK/wslcsdk.h Declares the new public WslcGetCliSession API.
src/windows/WslcSDK/wslcsdk.def Exports WslcGetCliSession from the SDK DLL.
src/windows/WslcSDK/wslcsdk.cpp Implements WslcGetCliSession by opening the default session by name.
src/windows/wslc/tasks/SessionTasks.cpp Uses the common defaults helper for default session name + default-name checks.
src/windows/wslc/services/SessionModel.h Removes default session naming helpers/constants from SessionOptions.
src/windows/wslc/services/SessionModel.cpp Uses common defaults for display name and storage path selection.
src/windows/common/WslSecurity.h Adds security::IsElevated() declaration.
src/windows/common/WslSecurity.cpp Implements security::IsElevated() using the current access token.
src/windows/common/WSLCSessionDefaults.h New common header encapsulating elevation-aware default session naming.
src/windows/common/CMakeLists.txt Registers the new common header in the common target headers list.

@yao-msft
Copy link
Copy Markdown

Just curious about the context of the change, what're the scenarios that an app will need to access a cli session?

@chemwolf6922
Copy link
Copy Markdown
Contributor Author

Just curious about the context of the change, what're the scenarios that an app will need to access a cli session?

Hi @yao-msft , Please refer to the build experience design doc. I'll try to send you internally. In short, this is for the dev loop where the developer builds their image in the cli session and pick it up directly when debugging.

Copilot AI review requested due to automatic review settings April 10, 2026 02:45
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.

Copilot AI review requested due to automatic review settings April 14, 2026 03:08
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 79 out of 80 changed files in this pull request and generated 1 comment.

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.

4 participants