Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

fix(teleport): save to Keyvault stores the teleported session (#4422)

ddupont3c5e5c1e677c
diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/TeleportModel.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/TeleportModel.swift
index cb74e007fb..db554d37f9 100644
--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/TeleportModel.swift
+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/TeleportModel.swift
@@ -365,9 +365,7 @@ public final class TeleportModel {
do {
let report = try await teleport.run(
plan: plan, space: space,
- consent: TeleportConsent(approved: consent.approved,
- acknowledgeSensitive: consent.acknowledgeSensitive,
- acknowledgeRelayPlaintext: consent.acknowledgeRelayPlaintext),
+ consent: sdkConsent(consent),
listener: nil)
send(.finished(report: AppTeleportRunReport(
appId: report.appId, installed: report.installed, sent: report.sent,
@@ -400,3 +398,13 @@ extension AppTeleportMove {
}
}
}
+
+/// The SDK consent for the review's confirmed consent. Every field must be
+/// carried over: `saveToKeyvault` defaults to false on the SDK type, so
+/// leaving it out silently drops the "Save to Keyvault" checkbox.
+func sdkConsent(_ consent: AppTeleportConsent) -> TeleportConsent {
+ TeleportConsent(approved: consent.approved,
+ acknowledgeSensitive: consent.acknowledgeSensitive,
+ saveToKeyvault: consent.saveToKeyvault,
+ acknowledgeRelayPlaintext: consent.acknowledgeRelayPlaintext)
+}
diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/TeleportConsentTests.swift b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/TeleportConsentTests.swift
new file mode 100644
index 0000000000..5fb05d69e1
--- /dev/null
+++ b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/TeleportConsentTests.swift
@@ -0,0 +1,25 @@
+// SPDX-License-Identifier: FSL-1.1-MIT
+// Copyright (c) 2026 Cua AI, Inc.
+
+import CuaSDK
+import CuaSpacesFFI
+@testable import CuaSpacesMacKit
+import Testing
+
+/// Regression: the review's "Save to Keyvault" checkbox reached the core
+/// consent but was dropped when building the SDK consent, so a teleport
+/// with it checked never stored anything in the Keyvault.
+@Suite("Teleport consent")
+struct TeleportConsentTests {
+ @Test func saveToKeyvaultReachesTheSdkConsent() {
+ let c = sdkConsent(AppTeleportConsent(
+ approved: true, acknowledgeSensitive: true,
+ saveToKeyvault: true, acknowledgeRelayPlaintext: true))
+ #expect(c == TeleportConsent(approved: true, acknowledgeSensitive: true,
+ saveToKeyvault: true, acknowledgeRelayPlaintext: true))
+ let off = sdkConsent(AppTeleportConsent(
+ approved: true, acknowledgeSensitive: true,
+ saveToKeyvault: false, acknowledgeRelayPlaintext: false))
+ #expect(!off.saveToKeyvault)
+ }
+}