Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion CLI/cmux.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4197,7 +4197,19 @@ struct CMUXCLI {
/// Restored terminals start the app and then race its listener bind. Keep
/// the implicit restore connection alive long enough for that lifecycle,
/// while explicit socket paths retain their immediate failure semantics.
private static let restoreSocketStartupTimeoutSeconds: TimeInterval = 45
private static let defaultRestoreSocketStartupTimeoutSeconds: TimeInterval = 45
/// Tests that exercise the "still opening" failure set
/// `CMUX_RESTORE_SOCKET_STARTUP_TIMEOUT_SECONDS` so they do not wait out
/// the full startup budget. It can only shorten the default.
private static var restoreSocketStartupTimeoutSeconds: TimeInterval {
let key = "CMUX_RESTORE_SOCKET_STARTUP_TIMEOUT_SECONDS"
guard let raw = ProcessInfo.processInfo.environment[key]?.trimmingCharacters(in: .whitespacesAndNewlines),
let value = TimeInterval(raw),
value.isFinite else {
return defaultRestoreSocketStartupTimeoutSeconds
}
return min(max(value, 0.05), defaultRestoreSocketStartupTimeoutSeconds)
}
// Stable per-user slot for the pinned Cloud VM. This value is intentionally reused as
// both the backend create idempotency key and the local daemon slot so every open,
// reconnect, session restore, and mobile attach targets the same provider VM once
Expand Down
3 changes: 3 additions & 0 deletions cmuxTests/CMUXCLIErrorOutputRegressionTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2351,6 +2351,9 @@ import Testing
}
environment["CMUX_CLI_SENTRY_DISABLED"] = "1"
environment["CFFIXED_USER_HOME"] = home.path
// restore and fork wait for the app's socket before reporting that
// cmux is still opening; the default 45 s wait made this test 90 s.
environment["CMUX_RESTORE_SOCKET_STARTUP_TIMEOUT_SECONDS"] = "1"

let cases: [(arguments: [String], expectedError: String)] = [
(["settings", "invalid-target"], "Unknown settings subcommand 'invalid-target'"),
Expand Down
Loading