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
Gate managed WinUI Debug startup on launcher adoption - #64
NativeScript CLI needs to identify the WinUI process that belongs to a development run before it can safely stop it. This PR adds a Debug startup handshake that lets the CLI verify that a new process belongs to its run.
The gap showed up in a Windows development run from a framework built on Octane Xplat. Ctrl-Break stopped the development servers but left the WinUI app running. Windows starts the packaged app outside the launcher's process tree, and the activation PID can belong to an app that was already open.
A Debug host launched with a one-time token checks in and waits for the launcher to confirm ownership before opening a window or running JavaScript. If the handoff fails or times out, the host exits before creating the app. The gate applies only to the reserved Debug launch option. The template still allows multiple instances.
For Ctrl-Break to close WinUI end to end, NativeScript CLI still needs to take ownership and stop the process. Octane Xplat needs to relay the stop request and result for that run. The calling development framework then needs to wait for confirmed exit before force-stopping its runner or launching a replacement.
Verification
Local fixture passed. The template entry point and gate passed 13 Debug checks and one Release check on macOS arm64 with .NET SDK 10.0.404 and WinUI stubs. The npm dry run included both source files.
Packaged Windows tests are pending. After reserving Windy through Goddard, SSH failed on all routes. The configured alias failed DNS resolution, LAN IPv4 timed out, and IPv6 returned No route to host. Cold activation, actual warm redirection and cancellation or launcher loss before adoption still need to run on the packaged app.
Wire protocol for CLI implementers
Listen before activation. Generate 16 cryptographically random bytes for each launch and encode them as exactly 32 lowercase hex characters. Open a single-instance, duplex byte-mode pipe at \\.\pipe\NativeScript.DevLaunch.v1.<token>. Restrict it to the intended interactive user, match the host's elevation, and reject remote clients. Keep the token out of logs and discard it after the attempt. The protocol trusts processes with same-user access to launcher state. Pipe user and elevation checks · Remote-client rejection
Activate with the token. Call IApplicationActivationManager::ActivateApplication for the exact registered AUMID in the signed-in interactive session. Append --ns-dev-launch-v1 <token> as the last two argv entries. The option must occur exactly once. Activation API
Acknowledge from initial startup. The host reads only the original Main argv, connects locally, and sends ready byte 0x01 before Application.Start. A host customized for single-instance routing must place the gate after the redirection decision, on the path that stays in the new process. A redirecting bootstrap returns without opening the pipe. The warm receiver never acknowledges the token.
Commit or close. The launcher writes commit byte 0x02 on that connection only after adopting the verified process. Those two bytes are the whole exchange. The host has one 15-second budget for connect, write and read. Malformed argv, failed I/O, disconnect, an invalid response or timeout causes the host to exit before opening WinUI. Cancel before commit by closing the lease. If the listener disappears before connection, the host exits at the deadline.
What NativeScript CLI must implement before using the gate
Protect the existing app during deploy. Use an isolated package family and layout, or reject a shared-registration conflict before changing the layout, registration, logs or package-wide markers. This includes pre-install uninstall and forced package shutdown. Cover initial deploy, LiveSync rebuild, restart and teardown. Verify v1 support in the exact generated Debug executable before activation because an older or customized host can ignore the option. NativeScript CLI Windows work
Prove which process started. Resolve the package full name and family, publisher, architecture, installed location, manifest app ID and executable from the intended registration. Record the activation time bound and retain the original process handle as soon as COM returns. Match the ready sender's GetNamedPipeClientProcessId to the COM PID, then validate the handle's app and package identity, canonical executable, user SID, session and creation time. A reused PID, redirection, mismatch or missing acknowledgement gives the run no right to stop the existing app. Pipe peer PID
Guarantee cleanup before commit. Establish launcher-death cleanup, preferably by assigning the proven process to a private kill-on-close job. Keep non-inheritable handles with query, wait, scoped terminate and job-assignment rights as needed. Qualify assignment on actual WinUI and tie any native helper's lifetime to the launcher. Withhold commit if containment fails. Windows Job Objects
Carry ownership through exit. Serialize cancellation with activation and commit. Skip activation if cancelled. If COM is in flight, close or invalidate the lease and settle activation before reporting cleanup. After adoption, request scoped graceful shutdown if available, bound the wait, and terminate through the retained handle or private job if needed. Confirm exit on the original handle before reporting retirement or restarting. Block restart while cleanup is unconfirmed. Use the same owner for run/watch and LiveSync. Route separate device-stop calls to the live owner or report no stop authority. Remove executable-name stop and liveness fallbacks from the managed path.
Detailed test coverage
The disposable fixture checked ordinary launch, five malformed argv cases, waiting for commit before app creation, simulated redirection without a pipe connection, cancellation after ready, invalid commit, a connected launcher that stays silent, and launcher process death before connection and after ready. The Release case started with the reserved option present.
The packaged fixture still needs to prove cold activation and replacement, warm redirection or COM returning an existing PID, and cancellation or launcher loss before adoption. Qualification with the CLI also needs to cover Windows pipe access and peer validation, WinUI job assignment and launcher loss after adoption, deployment isolation, and the full Ctrl-Break flow.
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: a7e5e066-921a-454e-9505-226bcaf79864
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
Trigger review
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
The original reproduction used @nativescript/windows@1.0.0-beta.24. I retested with the published 1.0.0-beta.29 on Windows x64 (build 10.0.26300.0), and the same WinUI process survived Ctrl-Break. Replying to the runtime version question
I kept Coreframe at b86067a05, NativeScript CLI at 9.1.2-dev.2026-09-24-36031892256, and Xplat at 0.0.0-nightly.g28d6eb6. In the coreframe dev desktop --no-managed --no-dev-jobs --port 42392 run, the WinUI app reached the Worker before Ctrl-Break. Coreframe exited with code 130 and the Vite and NativeScript HMR listeners closed, but WinUI PID 8400 was still alive.
This branch has not been deployed
No deployments
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
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.
NativeScript CLI needs to identify the WinUI process that belongs to a development run before it can safely stop it. This PR adds a Debug startup handshake that lets the CLI verify that a new process belongs to its run.
The gap showed up in a Windows development run from a framework built on Octane Xplat. Ctrl-Break stopped the development servers but left the WinUI app running. Windows starts the packaged app outside the launcher's process tree, and the activation PID can belong to an app that was already open.
A Debug host launched with a one-time token checks in and waits for the launcher to confirm ownership before opening a window or running JavaScript. If the handoff fails or times out, the host exits before creating the app. The gate applies only to the reserved Debug launch option. The template still allows multiple instances.
For Ctrl-Break to close WinUI end to end, NativeScript CLI still needs to take ownership and stop the process. Octane Xplat needs to relay the stop request and result for that run. The calling development framework then needs to wait for confirmed exit before force-stopping its runner or launching a replacement.
Verification
No route to host. Cold activation, actual warm redirection and cancellation or launcher loss before adoption still need to run on the packaged app.Wire protocol for CLI implementers
\\.\pipe\NativeScript.DevLaunch.v1.<token>. Restrict it to the intended interactive user, match the host's elevation, and reject remote clients. Keep the token out of logs and discard it after the attempt. The protocol trusts processes with same-user access to launcher state. Pipe user and elevation checks · Remote-client rejectionIApplicationActivationManager::ActivateApplicationfor the exact registered AUMID in the signed-in interactive session. Append--ns-dev-launch-v1 <token>as the last two argv entries. The option must occur exactly once. Activation APIMainargv, connects locally, and sends ready byte0x01beforeApplication.Start. A host customized for single-instance routing must place the gate after the redirection decision, on the path that stays in the new process. A redirecting bootstrap returns without opening the pipe. The warm receiver never acknowledges the token.0x02on that connection only after adopting the verified process. Those two bytes are the whole exchange. The host has one 15-second budget for connect, write and read. Malformed argv, failed I/O, disconnect, an invalid response or timeout causes the host to exit before opening WinUI. Cancel before commit by closing the lease. If the listener disappears before connection, the host exits at the deadline.What NativeScript CLI must implement before using the gate
GetNamedPipeClientProcessIdto the COM PID, then validate the handle's app and package identity, canonical executable, user SID, session and creation time. A reused PID, redirection, mismatch or missing acknowledgement gives the run no right to stop the existing app. Pipe peer PIDDetailed test coverage
The disposable fixture checked ordinary launch, five malformed argv cases, waiting for commit before app creation, simulated redirection without a pipe connection, cancellation after ready, invalid commit, a connected launcher that stays silent, and launcher process death before connection and after ready. The Release case started with the reserved option present.
The packaged fixture still needs to prove cold activation and replacement, warm redirection or COM returning an existing PID, and cancellation or launcher loss before adoption. Qualification with the CLI also needs to cover Windows pipe access and peer validation, WinUI job assignment and launcher loss after adoption, deployment isolation, and the full Ctrl-Break flow.