Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: manually upgrade system extension#158

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ethanndickson merged 3 commits intomainfromethan/manually-upgrade-network-extension
May 16, 2025

Conversation

ethanndickson
Copy link
Member

@ethanndicksonethanndickson commentedMay 13, 2025
edited
Loading

This PR addresses#121. The underlying bug is still present in macOS, this is just a workaround, so I'm leaving the issue open.

macOS callsactionForReplacingExtension whenever the version string(s) of the system extension living inside the Coder Desktop app bundle change.

i.e. When a new version of the app is installed:

  1. App sendsactivationRequest (it does this on every launch, to see if the NE is installed)
  2. Eventually,actionForReplacingExtension is called, which can either return.cancel or.replace.
  3. Eventually,didFinishWithResult is called with whether the replacement was successful.

(actionForReplacingExtension isalways called when developing the app locally, even if the version string(s) don't differ)

However, in the linked issue, we note that this replacement process is bug-prone. This bug can be worked around by deleting the system extension (in settings), and reactivating it (such as by relaunching the app).

Therefore, in this PR, whendidFinishWithResult is called following a replacement request, we instead will:

  1. Send adeactivationRequest, and wait for it to be successful.
  2. Send anotheractivationRequest, and wait for that to be successful.

Of note is that wecannot return.cancel fromactionForReplacingExtension and then later send adeactivationRequest.deactivationRequestalways searches for a system extension with version string(s) that match the system extension living inside the currently installed app bundle. Therefore, we have to let the replacement take place before attempting to delete it.

Also of note is that a successfuldeactivationRequest of the system extension deletes the corresponding VPN configuration. This configuration is normally created by logging in, but if the user is already logged in, we'll update the UI to include aReconfigure VPN button.

image

I've tested this PR in a fresh macOS 15.4 VM, upgrading from the latest release. I also forced the bug in the linked issue to occur by toggling on the VPN in System Settings before opening the new version of the app for the first time, and going through all the additional prompts did indeed prevent the issue from happening.

@ethanndicksonGraphite App
Copy link
MemberAuthor

This stack of pull requests is managed byGraphite. Learn more aboutstacking.

@ethanndicksonethanndicksonforce-pushed theethan/manually-upgrade-network-extension branch 2 times, most recently from888fd0e to428495eCompareMay 13, 2025 05:26
Copy link

@CopilotCopilotAI 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

This PR fixes the manual upgrade process for the network extension and improves the handling of system extension requests. Key changes include:

  • Updating the UI to display a reconfiguration message for unconfigured network extensions.
  • Refactoring the system extension delegate and protocol definitions for more robust asynchronous handling.
  • Adjusting error messaging and property initialization to support the manual upgrade flow.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
FileDescription
Views/VPN/VPNState.swiftAdds a new UI branch for unconfigured network extension errors.
Views/VPN/VPNMenu.swiftIntroduces a “Reconfigure VPN” button when the VPN state indicates a network extension issue.
VPN/VPNSystemExtension.swiftRefactors protocol definitions and updates system extension state handling logic.
VPN/VPNService.swiftChanges system extension delegate from an optional to a forced unwrapped value with initialization in init.
VPN/NetworkExtension.swiftImproves error logging and messaging when the network extension fails to save preferences.
Comments suppressed due to low confidence (1)

Coder-Desktop/Coder-Desktop/VPN/VPNSystemExtension.swift:166

  • Confirm that switching from using 'bundleShortVersion' to 'bundleVersion' is intended and that the version comparison logic works accurately in both development and release builds.
logger.info("Replacing \(request.identifier) v\(existing.bundleVersion) with v\(`extension`.bundleVersion)")

@@ -22,6 +22,35 @@ enum SystemExtensionState: Equatable, Sendable {
}
}

let extensionBundle: Bundle = {
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

This was previously a computed variable (the body was reran each time it was used), now it's just a lazy static constant. The body here is unchanged.

@@ -38,7 +42,7 @@ struct VPNState<VPN: VPNService>: View {
.padding(.horizontal, Theme.Size.trayInset)
.padding(.vertical, Theme.Size.trayPadding)
.frame(maxWidth: .infinity)
default:
case (.connected, true):
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Same behaviour, just more explicit.

@ethanndicksonethanndickson changed the titlefix: manually upgrade network extensionfix: manually upgrade system extensionMay 13, 2025
@ethanndicksonethanndicksonforce-pushed theethan/manually-upgrade-network-extension branch from428495e to828d7c0CompareMay 13, 2025 06:12
@ethanndicksonethanndickson marked this pull request as ready for reviewMay 13, 2025 06:19
@ethanndicksonGraphite App
Copy link
MemberAuthor

ethanndickson commentedMay 16, 2025
edited
Loading

Merge activity

  • May 15, 11:52 PM EDT: A user started a stack merge that includes this pull request viaGraphite.
  • May 15, 11:52 PM EDT:@ethanndickson merged this pull request withGraphite.

@ethanndicksonethanndickson merged commit05e41b7 intomainMay 16, 2025
4 checks passed
@ethanndicksonethanndickson deleted the ethan/manually-upgrade-network-extension branchMay 16, 2025 03:52
@ethanndicksonethanndickson self-assigned thisMay 23, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

Copilot code reviewCopilotCopilot left review comments

@deansheatherdeansheatherdeansheather approved these changes

@spikecurtisspikecurtisAwaiting requested review from spikecurtis

Assignees

@ethanndicksonethanndickson

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@ethanndickson@deansheather

[8]ページ先頭

©2009-2025 Movatter.jp