From b7e30733fee1ce29fcbf31570e53d9c293c55148 Mon Sep 17 00:00:00 2001 From: Faur Ioan-Aurel Date: Fri, 31 Oct 2025 21:50:20 +0200 Subject: [PATCH 1/3] impl: use the latest build number available The URI handler expects a product code a build number. If the build number is no longer available we defaulted to latest version available and popped up a confirmation window to make sure the user wants to go forward with the new version Netflix pointed out that the confirmation dialog disrupts the workflow. With this PR we only log that we fall back to latest version available in order to streamline the handler. --- CHANGELOG.md | 4 ++++ .../kotlin/com/coder/toolbox/util/CoderProtocolHandler.kt | 5 +---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b94dad..a22ce7d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +### Changed + +- URI handling no longer waits for confirmation to use latest build if the provided build number is too old + ## 0.7.1 - 2025-10-13 ### Fixed diff --git a/src/main/kotlin/com/coder/toolbox/util/CoderProtocolHandler.kt b/src/main/kotlin/com/coder/toolbox/util/CoderProtocolHandler.kt index 39f398d..de9ec8c 100644 --- a/src/main/kotlin/com/coder/toolbox/util/CoderProtocolHandler.kt +++ b/src/main/kotlin/com/coder/toolbox/util/CoderProtocolHandler.kt @@ -369,10 +369,7 @@ open class CoderProtocolHandler( val buildNumberIsNotAvailable = availableVersions.firstOrNull { it.contains(buildNumber) } == null if (buildNumberIsNotAvailable) { val selectedIde = availableVersions.maxOf { it } - context.logAndShowInfo( - "$productCode-$buildNumber not available", - "$productCode-$buildNumber is not available, we've selected the latest $selectedIde" - ) + context.logger.info("$productCode-$buildNumber is not available, we've selected the latest $selectedIde") return selectedIde } return "$productCode-$buildNumber" From 6a1908baf3cdb05548de567850d8aaf41e9f70b9 Mon Sep 17 00:00:00 2001 From: Faur Ioan-Aurel Date: Sat, 1 Nov 2025 00:09:37 +0200 Subject: [PATCH 2/3] fix: show connect page in the URI handler If Toolbox is already opened and URI is executed the setup page from below is never called. I tried a couple of things, including yielding the coroutine - but it seems to be of no help. What works delaying the coroutine for 66 - to 100 milliseconds, these numbers were determined by trial and error. The only explanation that I have is that inspecting the TBX bytecode it seems the UI event is emitted via MutableSharedFlow(replay = 0) which has a buffer of 4 events and a drop oldest strategy. For some reason it seems that the UI collector is not yet active, causing the event to be lost unless we wait > 66 ms. I think this delay ensures the collector is ready before processEvent() is called. --- .../com/coder/toolbox/util/CoderProtocolHandler.kt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/main/kotlin/com/coder/toolbox/util/CoderProtocolHandler.kt b/src/main/kotlin/com/coder/toolbox/util/CoderProtocolHandler.kt index de9ec8c..3dec81b 100644 --- a/src/main/kotlin/com/coder/toolbox/util/CoderProtocolHandler.kt +++ b/src/main/kotlin/com/coder/toolbox/util/CoderProtocolHandler.kt @@ -26,6 +26,7 @@ import kotlinx.coroutines.time.withTimeout import java.net.URI import java.util.UUID import kotlin.time.Duration +import kotlin.time.Duration.Companion.milliseconds import kotlin.time.Duration.Companion.minutes import kotlin.time.Duration.Companion.seconds import kotlin.time.toJavaDuration @@ -111,6 +112,18 @@ open class CoderProtocolHandler( CoderCliSetupContext.token = token } CoderCliSetupWizardState.goToStep(WizardStep.CONNECT) + + // If Toolbox is already opened and URI is executed the setup page + // from below is never called. I tried a couple of things, including + // yielding the coroutine - but it seems to be of no help. What works + // delaying the coroutine for 66 - to 100 milliseconds, these numbers + // were determined by trial and error. + // The only explanation that I have is that inspecting the TBX bytecode it seems the + // UI event is emitted via MutableSharedFlow(replay = 0) which has a buffer of 4 events + // and a drop oldest strategy. For some reason it seems that the UI collector + // is not yet active, causing the event to be lost unless we wait > 66 ms. + // I think this delay ensures the collector is ready before processEvent() is called. + delay(100.milliseconds) context.ui.showUiPage( CoderCliSetupWizardPage( context, settingsPage, visibilityState, true, From c9668014cbd2a218c13d14be1ca7e73410835a3c Mon Sep 17 00:00:00 2001 From: Faur Ioan-Aurel Date: Sat, 1 Nov 2025 00:23:37 +0200 Subject: [PATCH 3/3] chore: update Changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a22ce7d..bb3dbee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ - URI handling no longer waits for confirmation to use latest build if the provided build number is too old +### Fixed + +- IDE is now launched when URI is handled by an already running Toolbox instance. + ## 0.7.1 - 2025-10-13 ### Fixed