Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.
Rust agentai-agentapplecomputer-usecomputer-use-agentcontainerizationcuadesktop-automationhacktoberfestlumemacosmanusoperatorswiftvirtualizationvirtualization-frameworkwindowswindows-sandbox
fix(spaces): Linux Share in remote desktops asks for the password, says what to do when it cannot, and cua_share says why it failed (CUA-1725, CUA-1855) (#5273)
Francesco Bonacci522e032fb3ac
diff --git a/apps/cua-spaces-desktop/packaging/ai.cua.spaces.policy b/apps/cua-spaces-desktop/packaging/ai.cua.spaces.policyindex 39fc34b0b3..4fffa34969 100644--- a/apps/cua-spaces-desktop/packaging/ai.cua.spaces.policy+++ b/apps/cua-spaces-desktop/packaging/ai.cua.spaces.policy@@ -15,6 +15,13 @@The messages are shown as written: polkit fills a message's placeholdersonly from details, which it takes from root alone; nothing that asks is root.+ allow_any is auth_self too: polkit files a session with no seat (xrdp,+ VNC and other remote desktops, the usual way to reach a Linux cloud VM)+ under "any", so with "no" there the check was refused at once, with no+ prompt, and sharing always failed (CUA-1725). The prompt still needs the+ user's own password at an agent in the session that asks. allow_inactive+ stays "no".+A comment here must not hold two hyphens in a row (XML).--><policyconfig>@@ -24,7 +31,7 @@<description>Confirm access to the Cua Keyvault</description><message>Confirm it is you to use the Cua Keyvault</message><defaults>- <allow_any>no</allow_any>+ <allow_any>auth_self</allow_any><allow_inactive>no</allow_inactive><allow_active>auth_self</allow_active></defaults>@@ -33,7 +40,7 @@<description>Approve a device for your Cua account</description><message>Confirm it is you to approve a device for your Cua account</message><defaults>- <allow_any>no</allow_any>+ <allow_any>auth_self</allow_any><allow_inactive>no</allow_inactive><allow_active>auth_self</allow_active></defaults>diff --git a/apps/cua-spaces-desktop/src/bridge/telemetry.ts b/apps/cua-spaces-desktop/src/bridge/telemetry.tsindex e19d24eb33..29077031a2 100644--- a/apps/cua-spaces-desktop/src/bridge/telemetry.ts+++ b/apps/cua-spaces-desktop/src/bridge/telemetry.ts@@ -65,7 +65,10 @@ export function telemetrySignal(native: Native, raw: unknown): AppTelemetrySigna}case "share": {const [action, role, outcome] = [word("action"), word("role"), word("outcome")];- return action && role && outcome ? new S.Share({ action, role, outcome }) : null;+ // Why and where a share failed (CUA-1855); a page from before them sends neither.+ const errorKind = s.errorKind === undefined ? "none" : word("errorKind");+ const failedStage = s.failedStage === undefined ? "none" : word("failedStage");+ return action && role && outcome && errorKind && failedStage ? new S.Share({ action, role, outcome, errorKind, failedStage }) : null;}case "app-update": {const [action, channel, trigger] = [word("action"), word("channel"), word("trigger")];diff --git a/apps/cua-spaces-desktop/src/native/generated/cua_spaces_ffi.ts b/apps/cua-spaces-desktop/src/native/generated/cua_spaces_ffi.tsindex 8258b92d63..ddb7cbe90d 100644--- a/apps/cua-spaces-desktop/src/native/generated/cua_spaces_ffi.ts+++ b/apps/cua-spaces-desktop/src/native/generated/cua_spaces_ffi.ts@@ -11934,7 +11934,7 @@ inner: {surface: string; storage: string; addToFinder: boolean; mountMethod: strtype Share__interface = {tag: AppTelemetrySignal_Tags.Share;inner:-Readonly<{action: string; role: string; outcome: string}>+Readonly<{action: string; role: string; outcome: string; errorKind: string; failedStage: string}>};/*** A Space was shared, unshared or its role changed (`cua_share`).@@ -11947,15 +11947,15 @@ Readonly<{action: string; role: string; outcome: string}>readonly [uniffiTypeNameSymbol] = "AppTelemetrySignal";readonly tag = AppTelemetrySignal_Tags.Share;readonly inner:-Readonly<{action: string; role: string; outcome: string}>;+Readonly<{action: string; role: string; outcome: string; errorKind: string; failedStage: string}>;constructor(-inner: {action: string; role: string; outcome: string }) {+inner: {action: string; role: string; outcome: string; errorKind: string; failedStage: string }) {super("AppTelemetrySignal", "Share");this.inner = Object.freeze(inner);}static new(-inner: {action: string; role: string; outcome: string }): Share_ {+inner: {action: string; role: string; outcome: string; errorKind: string; failedStage: string }): Share_ {return new Share_(inner);}@@ -12147,7 +12147,7 @@ const FfiConverterTypeAppTelemetrySignal = (() => {case 7: return new AppTelemetrySignal.SpaceCreate({location: FfiConverterString.read(from), guestOs: FfiConverterString.read(from), kind: FfiConverterString.read(from), outcome: FfiConverterString.read(from), failedPhase: FfiConverterString.read(from), stalled: FfiConverterBool.read(from), elapsedMs: FfiConverterUInt64.read(from), gpu: FfiConverterBool.read(from), errorVariant: FfiConverterString.read(from) });case 8: return new AppTelemetrySignal.SpaceCreateStarted({location: FfiConverterString.read(from), guestOs: FfiConverterString.read(from), kind: FfiConverterString.read(from), gpu: FfiConverterBool.read(from) });case 9: return new AppTelemetrySignal.VolumeSetup({surface: FfiConverterString.read(from), storage: FfiConverterString.read(from), addToFinder: FfiConverterBool.read(from), mountMethod: FfiConverterString.read(from), outcome: FfiConverterString.read(from) });- case 10: return new AppTelemetrySignal.Share({action: FfiConverterString.read(from), role: FfiConverterString.read(from), outcome: FfiConverterString.read(from) });+ case 10: return new AppTelemetrySignal.Share({action: FfiConverterString.read(from), role: FfiConverterString.read(from), outcome: FfiConverterString.read(from), errorKind: FfiConverterString.read(from), failedStage: FfiConverterString.read(from) });case 11: return new AppTelemetrySignal.AppUpdate({action: FfiConverterString.read(from), channel: FfiConverterString.read(from), trigger: FfiConverterString.read(from) });case 12: return new AppTelemetrySignal.DeviceEnroll({method: FfiConverterString.read(from), outcome: FfiConverterString.read(from) });case 13: return new AppTelemetrySignal.Experiment({action: FfiConverterString.read(from), experiment: FfiConverterString.read(from) });@@ -12235,6 +12235,8 @@ const FfiConverterTypeAppTelemetrySignal = (() => {FfiConverterString.write(inner.action, into);FfiConverterString.write(inner.role, into);FfiConverterString.write(inner.outcome, into);+ FfiConverterString.write(inner.errorKind, into);+ FfiConverterString.write(inner.failedStage, into);return;}case AppTelemetrySignal_Tags.AppUpdate: {@@ -12350,6 +12352,8 @@ const FfiConverterTypeAppTelemetrySignal = (() => {size += FfiConverterString.allocationSize(inner.action);size += FfiConverterString.allocationSize(inner.role);size += FfiConverterString.allocationSize(inner.outcome);+ size += FfiConverterString.allocationSize(inner.errorKind);+ size += FfiConverterString.allocationSize(inner.failedStage);return size;}case AppTelemetrySignal_Tags.AppUpdate: {diff --git a/apps/cua-spaces-desktop/test/polkit-policy.test.ts b/apps/cua-spaces-desktop/test/polkit-policy.test.tsindex 3fd9f5a351..98307937ff 100644--- a/apps/cua-spaces-desktop/test/polkit-policy.test.ts+++ b/apps/cua-spaces-desktop/test/polkit-policy.test.ts@@ -59,7 +59,9 @@ describe("the polkit policy", () => {const actions = parsePolicy(readFileSync(policyFile, "utf8"));expect([...actions.keys()]).toEqual(["ai.cua.spaces.keyvault", "ai.cua.spaces.devices"]);for (const a of actions.values()) {- expect(a).toMatchObject({ allow_any: "no", allow_inactive: "no", allow_active: "auth_self" });+ // A remote desktop (xrdp, VNC) is a session polkit files under "any":+ // it asks there too, with the user's own password (CUA-1725).+ expect(a).toMatchObject({ allow_any: "auth_self", allow_inactive: "no", allow_active: "auth_self" });// polkit fills placeholders only from details, which a non-root caller may not pass.expect(a.message).not.toMatch(/\$\(/);expect(a.message).not.toBe("");diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUIBridge+Pages.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUIBridge+Pages.swiftindex 04abaea024..16b8d34f01 100644--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUIBridge+Pages.swift+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUIBridge+Pages.swift@@ -486,8 +486,11 @@ extension WebUIBridge {let method = word("mountMethod"), let outcome = word("outcome") else { return nil }return .volumeSetup(surface: surface, storage: storage, addToFinder: finder, mountMethod: method, outcome: outcome)case "share":- guard let action = word("action"), let role = word("role"), let outcome = word("outcome") else { return nil }- return .share(action: action, role: role, outcome: outcome)+ // Why and where a share failed (CUA-1855); a page from before them sends neither.+ guard let action = word("action"), let role = word("role"), let outcome = word("outcome"),+ let errorKind = s["errorKind"] == nil ? "none" : word("errorKind"),+ let failedStage = s["failedStage"] == nil ? "none" : word("failedStage") else { return nil }+ return .share(action: action, role: role, outcome: outcome, errorKind: errorKind, failedStage: failedStage)case "app-update":guard let action = word("action"), let channel = word("channel"), let trigger = word("trigger") else { return nil }return .appUpdate(action: action, channel: channel, trigger: trigger)diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ParityTests.swift b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ParityTests.swiftindex 8ab86f4482..aeeb697b22 100644--- a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ParityTests.swift+++ b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ParityTests.swift@@ -2191,7 +2191,9 @@ struct ParityTests {case let .volumeSetup(surface, storage, addToFinder, mountMethod, outcome):return ["type": "volume-setup", "surface": surface, "storage": storage, "addToFinder": addToFinder,"mountMethod": mountMethod, "outcome": outcome]- case let .share(action, role, outcome): return ["type": "share", "action": action, "role": role, "outcome": outcome]+ case let .share(action, role, outcome, errorKind, failedStage):+ return ["type": "share", "action": action, "role": role, "outcome": outcome,+ "errorKind": errorKind, "failedStage": failedStage]case let .appUpdate(action, channel, trigger):return ["type": "app-update", "action": action, "channel": channel, "trigger": trigger]case let .deviceEnroll(method, outcome): return ["type": "device-enroll", "method": method, "outcome": outcome]diff --git a/apps/cua-spaces-web/e2e/parity.spec.ts b/apps/cua-spaces-web/e2e/parity.spec.tsindex 9398720c0d..a8948359e0 100644--- a/apps/cua-spaces-web/e2e/parity.spec.ts+++ b/apps/cua-spaces-web/e2e/parity.spec.ts@@ -370,11 +370,11 @@ async function checkTelemetry(page: Page, cps: Of<"telemetry">[]): Promise<numbeawait track(page, [{ type: "step", step: "signed_in", ok: true, identity: "[email protected]" },{ type: "feature", feature: "/Users/maya/secret" },- { type: "share", action: "share", role: "viewer", outcome: "ok", email: "[email protected]" },+ { type: "share", action: "share", role: "viewer", outcome: "ok", errorKind: "none", failedStage: "none", email: "[email protected]" },]);expect((await tracked(page)).slice(n), "only schema fields and fixed words are sent").toEqual([{ type: "step", step: "signed_in", ok: true },- { type: "share", action: "share", role: "viewer", outcome: "ok" },+ { type: "share", action: "share", role: "viewer", outcome: "ok", errorKind: "none", failedStage: "none" },]);return cps.filter((c) => c.signals.length > 0).length;}diff --git a/apps/cua-spaces-web/src/bridge/__tests__/sharing.test.ts b/apps/cua-spaces-web/src/bridge/__tests__/sharing.test.tsindex 02c5cee3d5..c978454656 100644--- a/apps/cua-spaces-web/src/bridge/__tests__/sharing.test.ts+++ b/apps/cua-spaces-web/src/bridge/__tests__/sharing.test.ts@@ -110,8 +110,8 @@ describe.skipIf(!wasmBuilt)("share usage events", () => {await s.send({ type: "submit" });await s.send({ type: "remove", who: "[email protected]" });expect(sent).toEqual([- { type: "share", action: "share", role: "viewer", outcome: "ok" },- { type: "share", action: "unshare", role: "none", outcome: "ok" },+ { type: "share", action: "share", role: "viewer", outcome: "ok", errorKind: "none", failedStage: "none" },+ { type: "share", action: "unshare", role: "none", outcome: "ok", errorKind: "none", failedStage: "none" },]);expect(JSON.stringify(sent)).not.toMatch(/@/);});@@ -119,11 +119,29 @@ describe.skipIf(!wasmBuilt)("share usage events", () => {it("records a share that failed", async () => {const sent: TelemetrySignal[] = [];const demo = createDemoAdapter({ latencyMs: 0, stepMs: 2 });- const failing = { ...demo, call: (op: string, args: unknown) => (op === "sharing.share" ? Promise.reject(new Error("relay down")) : demo.call(op as never, args as never)) };+ const failing = { ...demo, call: (op: string, args: unknown) => (op === "sharing.share" ? Promise.reject(new Error("relay: error sending request for url (https://relay.cua.ai/v1/machines)")) : demo.call(op as never, args as never)) };const s = new ShareStore(failing as typeof demo, await testCore(), (signals) => sent.push(...signals));s.open(space, true);await s.send({ type: "set-who", who: "[email protected]" });await s.send({ type: "submit" });- expect(sent).toEqual([{ type: "share", action: "share", role: "viewer", outcome: "error" }]);+ expect(sent).toEqual([{ type: "share", action: "share", role: "viewer", outcome: "error", errorKind: "relay_unreachable", failedStage: "relay" }]);+ });++ it("records a dismissed confirmation as cancelled, and says why a share failed (CUA-1855)", async () => {+ const sent: TelemetrySignal[] = [];+ const demo = createDemoAdapter({ latencyMs: 0, stepMs: 2 });+ let why = "not shared: user presence was not confirmed: biometric authorization was cancelled";+ const failing = { ...demo, call: (op: string, args: unknown) => (op === "sharing.share" ? Promise.reject(new Error(why)) : demo.call(op as never, args as never)) };+ const s = new ShareStore(failing as typeof demo, await testCore(), (signals) => sent.push(...signals));+ s.open(space, true);+ await s.send({ type: "set-who", who: "[email protected]" });+ await s.send({ type: "submit" });+ why = "not shared: user presence was not confirmed: user confirmation is unavailable: on Linux this needs Cua Spaces installed from the .deb";+ await s.send({ type: "submit" });+ expect(sent).toEqual([+ { type: "share", action: "share", role: "viewer", outcome: "cancelled", errorKind: "presence_cancelled", failedStage: "presence" },+ { type: "share", action: "share", role: "viewer", outcome: "error", errorKind: "presence_unavailable", failedStage: "presence" },+ ]);+ expect(JSON.stringify(sent)).not.toMatch(/@|deb/);});});diff --git a/apps/cua-spaces-web/src/bridge/ops/telemetry.ts b/apps/cua-spaces-web/src/bridge/ops/telemetry.tsindex 073a9ad3fa..973387944b 100644--- a/apps/cua-spaces-web/src/bridge/ops/telemetry.ts+++ b/apps/cua-spaces-web/src/bridge/ops/telemetry.ts@@ -51,7 +51,7 @@ export type TelemetrySignal =}| { type: "space-create-started"; location: string; guestOs: string; kind: string; gpu: boolean }| { type: "volume-setup"; surface: string; storage: string; addToFinder: boolean; mountMethod: string; outcome: string }- | { type: "share"; action: string; role: string; outcome: string }+ | { type: "share"; action: string; role: string; outcome: string; errorKind: string; failedStage: string }| { type: "app-update"; action: string; channel: string; trigger: string }| { type: "device-enroll"; method: string; outcome: string }| { type: "experiment"; action: string; experiment: string }@@ -133,7 +133,7 @@ const SHAPES: Record<TelemetrySignal["type"], Record<string, Field>> = {},"space-create-started": { location: "word", guestOs: "word", kind: "word", gpu: "flag" },"volume-setup": { surface: "word", storage: "word", addToFinder: "flag", mountMethod: "word", outcome: "word" },- share: { action: "word", role: "word", outcome: "word" },+ share: { action: "word", role: "word", outcome: "word", errorKind: "word", failedStage: "word" },"app-update": { action: "word", channel: "word", trigger: "word" },"device-enroll": { method: "word", outcome: "word" },experiment: { action: "word", experiment: "word" },diff --git a/apps/cua-spaces/src/model/telemetry.ts b/apps/cua-spaces/src/model/telemetry.tsindex 73f012a45d..1b062c1f25 100644--- a/apps/cua-spaces/src/model/telemetry.ts+++ b/apps/cua-spaces/src/model/telemetry.ts@@ -43,7 +43,7 @@ export type TelemetrySignal =mountMethod: string;outcome: string;}- | { type: "share"; action: string; role: string; outcome: string }+ | { type: "share"; action: string; role: string; outcome: string; errorKind: string; failedStage: string }| { type: "app-update"; action: string; channel: string; trigger: string }| { type: "device-enroll"; method: string; outcome: string }| { type: "experiment"; action: "experiment_on" | "experiment_off"; experiment: string }diff --git a/docs/content/docs/cua-sdk/concepts/telemetry-events.mdx b/docs/content/docs/cua-sdk/concepts/telemetry-events.mdxindex a0a0ee4263..b66042eb07 100644--- a/docs/content/docs/cua-sdk/concepts/telemetry-events.mdx+++ b/docs/content/docs/cua-sdk/concepts/telemetry-events.mdx@@ -46,7 +46,7 @@ Every event carries: `telemetry_schema_version`, `event_version`, `product`| `cua_host_setup` | `mode` (`relay` or `direct`), `profile` (`desktop`, `spare`, `both`), `outcome`, `error_kind`, `signed_in`, `token_state` (`provided`, `expired`, `missing`, `not_needed`; never the token), `failed_stage` (`none`, `preflight`, `token`, `register`, `download`, `service`), `http_status` (the status a server answered a failure with, `0` when none) | Machines set up for access, and where a failed setup stopped. || `cua_host_space_provided` | `kind`, `guest_os`, `outcome`, `error_kind` | Spaces a host machine created for your other devices. || `cua_keyvault_action` | `action` (`setup`, `unlock`, `lock`, `import`, `site_login`), `method` (`os_key_store` (Touch ID on a Mac), `passphrase`, `recovery_key`, `none`), `outcome` | Keyvault adoption and how it is unlocked. Nothing about what is stored. |-| `cua_share` | `action` (`share`, `unshare`, `change_role`), `role` (`viewer`, `editor`, `none`), `outcome` | Sharing, and how often it is view-only. Never who. |+| `cua_share` | `action` (`share`, `unshare`, `change_role`), `role` (`viewer`, `editor`, `none`), `outcome` (`cancelled` when the confirmation prompt was dismissed), `error_kind` (`presence_denied`, `presence_cancelled`, `presence_unavailable`, `not_signed_in`, `device_not_enrolled`, `driver_unsupported`, `relay_refused`, `relay_unreachable`, `invalid_who`, `other`, or `none`), `failed_stage` (`request`, `presence`, `account`, `device`, `driver`, `relay`, `other`, or `none`) | Sharing, how often it is view-only, and why it fails. Never who, never the error's words. || `cua_presence_session` | `outcome`, `participants` (bucketed), `duration_bucket` | Multiplayer sessions, their size and length. || `cua_app_update` | `action` (`checked`, `found`, `not_found`, `downloaded`, `installed`, `failed`), `channel` (`stable` or `beta`), `trigger` (`user` or `background`) | Whether people update. || `cua_device_enroll` | `method` (`sign_in`, `approval`, `rekey`), `outcome` | How devices join your account's relay. |diff --git a/docs/content/docs/spaces/guides/install.mdx b/docs/content/docs/spaces/guides/install.mdxindex 8bb55bde93..d5a65f80c0 100644--- a/docs/content/docs/spaces/guides/install.mdx+++ b/docs/content/docs/spaces/guides/install.mdx@@ -76,14 +76,16 @@ General**.## Linux packagesThe supported package is the **.deb** on Ubuntu 24.04. It is sandboxed and-installs the confirmation prompt the Keyvault needs. `sudo apt remove cua-spaces`+installs the confirmation prompt (polkit) that sharing a Space and the Keyvault+need. The prompt asks for your password in a desktop session with a polkit+authentication agent, local or over a remote desktop such as xrdp. `sudo apt remove cua-spaces`turns off what the app set up (see[Check, pause or remove](/spaces/guides/add-a-computer#check-pause-or-remove)).The **AppImage** is a portable build, not a supported one. It cannot use thebrowser sandbox (it starts with `--no-sandbox`), and without the system's-confirmation prompt the Keyvault is unavailable. Use it to try Cua Spaces-without installing, and install the .deb to keep it.+confirmation prompt you cannot share a Space and the Keyvault is unavailable.+Use it to try Cua Spaces without installing, and install the .deb to keep it.For Linux Spaces created on this computer, the `cua` CLI uses Docker (gVisor`runsc`, when installed, adds isolation) or QEMU. QEMU needs read and writediff --git a/docs/content/docs/spaces/guides/share-a-space.mdx b/docs/content/docs/spaces/guides/share-a-space.mdxindex 669f9b5134..b83ebea751 100644--- a/docs/content/docs/spaces/guides/share-a-space.mdx+++ b/docs/content/docs/spaces/guides/share-a-space.mdx@@ -11,8 +11,18 @@ Space. They open it from their own app or terminal as `relay:<machine>`.To share from the app, press **Share** in the Space's toolbar, enter an emailaddress or account ID, and choose **Viewer** or **Editor**. The same list shows-who has access and who is connected. Cua Spaces asks you to confirm with Touch-ID or your login password first.+who has access and who is connected. Cua Spaces asks you to confirm first:+Touch ID or your login password on a Mac, Windows Hello or your account password+on Windows, and your password through polkit on Linux.++<Callout title="Sharing on Linux">+ Sharing on Linux needs Cua Spaces installed from the **.deb**, and a desktop+ session with a polkit authentication agent running (XFCE, GNOME and KDE start+ one). The .deb installs the password prompt; the AppImage cannot, so it cannot+ share. A remote desktop (xrdp, VNC) works too: you get the same password+ prompt. If sharing fails at once with no prompt, update to the latest .deb.+ See [Linux packages](/spaces/guides/install#linux-packages).+</Callout>You can share with one person at a time, or with a whole team at once. See[People and teams](#people-and-teams).diff --git a/docs/content/docs/spaces/guides/troubleshoot.mdx b/docs/content/docs/spaces/guides/troubleshoot.mdxindex d597b9bb11..6fb451e591 100644--- a/docs/content/docs/spaces/guides/troubleshoot.mdx+++ b/docs/content/docs/spaces/guides/troubleshoot.mdx@@ -84,6 +84,7 @@ system, and the Cua Spaces version from **Settings, About**.|---|---|| The agent has no `cua` tools, or can't reach a Space | [If it doesn't work](/spaces/guides/connect-your-agent#if-it-doesnt-work) in Connect your agent || A computer never appears, or shows **Offline** | [If it doesn't work](/spaces/guides/add-a-computer#if-it-doesnt-work) in Add a computer |+| On Linux, Share fails at once with "user presence was not confirmed" | [Sharing on Linux](/spaces/guides/share-a-space) in Share a Space: install the latest .deb and use a desktop session with a polkit agent || An error name such as `capability_missing` or `permission_denied` | [Errors](/spaces/reference#errors) in the Spaces reference || You want Cua Spaces gone, or a clean reinstall | [Uninstall Cua Spaces](/spaces/guides/uninstall), then [Install](/spaces/guides/install) || Something else | Email [email protected] as described above |diff --git a/libs/cua/crates/cua-spaces-app-core/parity/golden/telemetry-funnel.json b/libs/cua/crates/cua-spaces-app-core/parity/golden/telemetry-funnel.jsonindex be9ce22f90..a1e633c9e4 100644--- a/libs/cua/crates/cua-spaces-app-core/parity/golden/telemetry-funnel.json+++ b/libs/cua/crates/cua-spaces-app-core/parity/golden/telemetry-funnel.json@@ -961,6 +961,8 @@"signals": [{"action": "share",+ "errorKind": "none",+ "failedStage": "none","outcome": "ok","role": "viewer","type": "share"@@ -973,6 +975,8 @@"signals": [{"action": "change_role",+ "errorKind": "none",+ "failedStage": "none","outcome": "ok","role": "editor","type": "share"@@ -985,6 +989,8 @@"signals": [{"action": "unshare",+ "errorKind": "none",+ "failedStage": "none","outcome": "ok","role": "none","type": "share"@@ -997,6 +1003,8 @@"signals": [{"action": "share",+ "errorKind": "other",+ "failedStage": "other","outcome": "error","role": "editor","type": "share"@@ -1004,6 +1012,20 @@],"step": "share failed"},+ {+ "at": "share",+ "signals": [+ {+ "action": "share",+ "errorKind": "presence_cancelled",+ "failedStage": "presence",+ "outcome": "cancelled",+ "role": "viewer",+ "type": "share"+ }+ ],+ "step": "confirmation dismissed"+ },{"at": "share","signals": [],diff --git a/libs/cua/crates/cua-spaces-app-core/parity/telemetry-funnel.json b/libs/cua/crates/cua-spaces-app-core/parity/telemetry-funnel.jsonindex f358c1cd17..60e1656d64 100644--- a/libs/cua/crates/cua-spaces-app-core/parity/telemetry-funnel.json+++ b/libs/cua/crates/cua-spaces-app-core/parity/telemetry-funnel.json@@ -600,6 +600,24 @@"error": "[email protected] has no Cua account"}},+ {+ "step": "confirmation dismissed",+ "state": {+ "who": "",+ "role": "viewer",+ "busy": true,+ "request": {+ "kind": "share",+ "space": "local:maya-secret-project",+ "who": "[email protected]",+ "role": "viewer"+ }+ },+ "action": {+ "type": "failed",+ "error": "not shared: user presence was not confirmed: biometric authorization was cancelled"+ }+ },{"step": "typing is not sharing","state": {diff --git a/libs/cua/crates/cua-spaces-app-core/src/telemetry.rs b/libs/cua/crates/cua-spaces-app-core/src/telemetry.rsindex 05213d3c5d..9114df1c83 100644--- a/libs/cua/crates/cua-spaces-app-core/src/telemetry.rs+++ b/libs/cua/crates/cua-spaces-app-core/src/telemetry.rs@@ -129,8 +129,19 @@ pub enum TelemetrySignal {action: String,/// `viewer`, `editor` or `none`.role: String,- /// `ok` or `error`.+ /// `ok`, `error`, or `cancelled` when the confirmation prompt was+ /// dismissed.outcome: String,+ /// Why it did not happen (`presence_denied`, `presence_cancelled`,+ /// `presence_unavailable`, `not_signed_in`, `device_not_enrolled`,+ /// `driver_unsupported`, `relay_refused`, `relay_unreachable`,+ /// `invalid_who` or `other`); `none` when it worked.+ #[serde(default = "none_word")]+ error_kind: String,+ /// Where it stopped (`request`, `presence`, `account`, `device`,+ /// `driver`, `relay` or `other`); `none` when it worked.+ #[serde(default = "none_word")]+ failed_stage: String,},/// An updater step (`cua_app_update`).AppUpdate {@@ -658,13 +669,104 @@ pub fn share(Some(ShareRequest::Unshare { .. }) => ("unshare", "none"),None => return vec![],};+ let (outcome, error_kind, failed_stage) = match action {+ ShareSheetAction::Failed { error } => {+ let (kind, stage) = share_failure(error);+ let word = if kind == "presence_cancelled" {+ "cancelled"+ } else {+ "error"+ };+ (word.to_string(), kind, stage)+ }+ _ => (outcome(ok), "none", "none"),+ };vec![TelemetrySignal::Share {action: act.into(),role: role.into(),- outcome: outcome(ok),+ outcome,+ error_kind: error_kind.into(),+ failed_stage: failed_stage.into(),}]}+fn none_word() -> String {+ "none".into()+}++/// Why a share, unshare or role change failed, and where it stopped, from+/// the error's words (what the daemon and the relay say): one of the fixed+/// kinds of `cua_share`, never the words themselves (CUA-1855).+pub fn share_failure(error: &str) -> (&'static str, &'static str) {+ let e = error.to_ascii_lowercase();+ let has = |words: &[&str]| words.iter().any(|w| e.contains(w));+ // The user's own confirmation, asked before anything reaches the relay+ // (`share_space`: "not shared: <why>").+ if has(&["nothing here can ask you to confirm"]) {+ return ("presence_unavailable", "presence");+ }+ if has(&["not shared:", "presence was not confirmed"]) {+ return if has(&["cancelled", "canceled", "dismissed"]) {+ ("presence_cancelled", "presence")+ } else if has(&[+ "unavailable",+ "prompt failed",+ "no confirmation prompt",+ "cannot run pkcheck",+ ]) {+ ("presence_unavailable", "presence")+ } else {+ ("presence_denied", "presence")+ };+ }+ if has(&[+ "is not an email",+ "not an email or account id",+ "share with an account",+ ]) {+ return ("invalid_who", "request");+ }+ if has(&["device"]) && has(&["enroll", "approv", "revoked", "re-verification"]) {+ return ("device_not_enrolled", "device");+ }+ if has(&[+ "sign in",+ "signed in",+ "not signed",+ "unauthenticated",+ "auth login",+ "session expired",+ "token expired",+ ]) {+ return ("not_signed_in", "account");+ }+ if has(&["relay_attach", "has no cua-spacesd", "cannot be shared"]) {+ return ("driver_unsupported", "driver");+ }+ if has(&[+ "relay: error sending",+ "connection refused",+ "connection reset",+ "timed out",+ "dns error",+ "unreachable",+ "could not connect",+ "failed to connect",+ ]) {+ return ("relay_unreachable", "relay");+ }+ if has(&[+ "relay",+ "only its owner can share",+ "forbidden",+ "permission denied",+ "limit",+ ]) {+ return ("relay_refused", "relay");+ }+ ("other", "other")+}+// ---- Enrollment ----------------------------------------------------------------/// The events one step of the enroll sheet means: enrolled by a fresh@@ -814,7 +916,16 @@ pub fn record(t: &cua_telemetry::Telemetry, signals: &[TelemetrySignal]) -> usizaction,role,outcome,- } => events::share(action, role, Outcome::from_word(outcome)).map(|e| t.capture(e)),+ error_kind,+ failed_stage,+ } => events::share(+ action,+ role,+ Outcome::from_word(outcome),+ error_kind,+ failed_stage,+ )+ .map(|e| t.capture(e)),TelemetrySignal::AppUpdate {action,channel,@@ -915,6 +1026,127 @@ pub fn welcome_left(t: &cua_telemetry::Telemetry, on: bool) -> std::io::Result<(mod tests {use super::*;+ /// CUA-1855: a failed share says why and where, in fixed words; a+ /// dismissed prompt is `cancelled`, not `error`.+ #[test]+ fn a_failed_share_says_why_in_fixed_words() {+ let cases = [+ (+ "env: not shared: user presence was not confirmed: biometric authorization was denied",+ "presence_denied",+ ),+ ("not shared: you declined", "presence_denied"),+ (+ "not shared: user presence was not confirmed: biometric authorization was cancelled",+ "presence_cancelled",+ ),+ (+ "not shared: user presence was not confirmed: user confirmation is unavailable: install Cua Spaces from the .deb",+ "presence_unavailable",+ ),+ (+ "share consent: nothing here can ask you to confirm; share from the Cua app",+ "presence_unavailable",+ ),+ (+ "invalid argument: \"grace\" is not an email address",+ "invalid_who",+ ),+ (+ "sign in to cua.ai (`cua auth login` or the app) to list your machines",+ "not_signed_in",+ ),+ (+ "this device is not enrolled for your cua.ai account (run `cua devices enroll`)",+ "device_not_enrolled",+ ),+ (+ "local:studio does not support `relay_attach`",+ "driver_unsupported",+ ),+ (+ "relay: error sending request for url (https://relay.cua.ai/v1/machines)",+ "relay_unreachable",+ ),+ (+ "relay:abc is shared with you; only its owner can share it",+ "relay_refused",+ ),+ ("something else broke", "other"),+ ];+ for (error, kind) in cases {+ assert_eq!(share_failure(error).0, kind, "{error}");+ }+ let input = ShareInput {+ space_id: "local:studio".into(),+ space_name: "studio".into(),+ shares: vec![],+ signed_in: true,+ shareable: true,+ };+ let before = ShareSheetState {+ request: Some(ShareRequest::Share {+ space: "local:studio".into(),+ who: "[email protected]".into(),+ role: "viewer".into(),+ }),+ busy: true,+ ..Default::default()+ };+ let failed = |error: &str| {+ share(+ &input,+ &before,+ &ShareSheetAction::Failed {+ error: error.into(),+ },+ )+ };+ assert_eq!(+ failed(+ "not shared: user presence was not confirmed: biometric authorization was cancelled"+ ),+ [TelemetrySignal::Share {+ action: "share".into(),+ role: "viewer".into(),+ outcome: "cancelled".into(),+ error_kind: "presence_cancelled".into(),+ failed_stage: "presence".into(),+ }]+ );+ assert_eq!(+ failed("not shared: user presence was not confirmed: polkit did not confirm it is you"),+ [TelemetrySignal::Share {+ action: "share".into(),+ role: "viewer".into(),+ outcome: "error".into(),+ error_kind: "presence_denied".into(),+ failed_stage: "presence".into(),+ }]+ );+ assert_eq!(+ share(&input, &before, &ShareSheetAction::Done),+ [TelemetrySignal::Share {+ action: "share".into(),+ role: "viewer".into(),+ outcome: "ok".into(),+ error_kind: "none".into(),+ failed_stage: "none".into(),+ }]+ );+ // Never who, never the words.+ let text = serde_json::to_string(&failed("[email protected]: no")).unwrap();+ assert!(!text.contains("grace"), "{text}");+ // A host that sends the signal without the new fields still parses.+ let old: TelemetrySignal = serde_json::from_str(+ r#"{"type":"share","action":"share","role":"viewer","outcome":"ok"}"#,+ )+ .unwrap();+ assert!(+ matches!(old, TelemetrySignal::Share { ref error_kind, .. } if error_kind == "none")+ );+ }+#[test]fn checklist_events_are_fixed_steps_in_the_schema() {let all: Vec<&str> = CHECKLIST_STEPSdiff --git a/libs/cua/crates/cua-spaces-ffi/src/app_core_types.rs b/libs/cua/crates/cua-spaces-ffi/src/app_core_types.rsindex 0ba979d7b4..e4178e66d4 100644--- a/libs/cua/crates/cua-spaces-ffi/src/app_core_types.rs+++ b/libs/cua/crates/cua-spaces-ffi/src/app_core_types.rs@@ -9259,8 +9259,17 @@ pub enum AppTelemetrySignal {action: String,/// `viewer`, `editor` or `none`.role: String,- /// `ok` or `error`.+ /// `ok`, `error`, or `cancelled` when the confirmation prompt was+ /// dismissed.outcome: String,+ /// Why it did not happen (`presence_denied`, `presence_cancelled`,+ /// `presence_unavailable`, `not_signed_in`, `device_not_enrolled`,+ /// `driver_unsupported`, `relay_refused`, `relay_unreachable`,+ /// `invalid_who` or `other`); `none` when it worked.+ error_kind: String,+ /// Where it stopped (`request`, `presence`, `account`, `device`,+ /// `driver`, `relay` or `other`); `none` when it worked.+ failed_stage: String,},/// An updater step (`cua_app_update`).AppUpdate {diff --git a/libs/cua/crates/cua-telemetry/src/events.rs b/libs/cua/crates/cua-telemetry/src/events.rsindex a57e164e9a..b07f9a5fad 100644--- a/libs/cua/crates/cua-telemetry/src/events.rs+++ b/libs/cua/crates/cua-telemetry/src/events.rs@@ -1109,8 +1109,17 @@ pub fn keyvault_action(a: KeyvaultAction, m: KeyvaultMethod, outcome: Outcome) -.s("outcome", outcome.as_str())}-/// `cua_share`; None for an action outside the vocabulary.-pub fn share(action: &str, role: &str, outcome: Outcome) -> Option<Event> {+/// `cua_share`; None for an action outside the vocabulary. `error_kind`+/// and `failed_stage` say why and where a failure stopped+/// ([`schema::SHARE_ERROR_KINDS`], [`schema::SHARE_STAGES`]); both are+/// `none` when it worked, and a failure with no known kind is `other`.+pub fn share(+ action: &str,+ role: &str,+ outcome: Outcome,+ error_kind: &str,+ failed_stage: &str,+) -> Option<Event> {let a = pick(schema::SHARE_ACTIONS, action, "");(!a.is_empty()).then(|| {Event::new(event::SHARE)@@ -1124,6 +1133,26 @@ pub fn share(action: &str, role: &str, outcome: Outcome) -> Option<Event> {},).s("outcome", outcome.as_str())+ .s(+ "error_kind",+ match outcome {+ Outcome::Ok => "none",+ _ => match pick(schema::SHARE_ERROR_KINDS, error_kind, "other") {+ "none" => "other",+ k => k,+ },+ },+ )+ .s(+ "failed_stage",+ match outcome {+ Outcome::Ok => "none",+ _ => match pick(schema::SHARE_STAGES, failed_stage, "other") {+ "none" => "other",+ st => st,+ },+ },+ )})}diff --git a/libs/cua/crates/cua-telemetry/src/schema.rs b/libs/cua/crates/cua-telemetry/src/schema.rsindex d790d04113..8d492c84b7 100644--- a/libs/cua/crates/cua-telemetry/src/schema.rs+++ b/libs/cua/crates/cua-telemetry/src/schema.rs@@ -458,6 +458,29 @@ pub const KEYVAULT_METHODS: &[&str] = &["os_key_store", "passphrase", "recovery_pub const SHARE_ACTIONS: &[&str] = &["share", "unshare", "change_role"];/// The role a Space is shared with.pub const SHARE_ROLES: &[&str] = &["viewer", "editor", "none"];+/// Why a share, unshare or role change did not happen; `none` when it did.+/// From the error's words, never the words themselves (CUA-1855).+pub const SHARE_ERROR_KINDS: &[&str] = &[+ "none",+ // The user's confirmation (Touch ID, Windows Hello, polkit): refused,+ // dismissed, or no prompt could be shown.+ "presence_denied",+ "presence_cancelled",+ "presence_unavailable",+ "not_signed_in",+ "device_not_enrolled",+ // The Space cannot be shared (its driver cannot attach to the relay).+ "driver_unsupported",+ "relay_refused",+ "relay_unreachable",+ // Not an email or account id.+ "invalid_who",+ "other",+];+/// Where a failed share stopped; `none` when it worked.+pub const SHARE_STAGES: &[&str] = &[+ "none", "request", "presence", "account", "device", "driver", "relay", "other",+];/// Updater steps. In the product's words: `found` is update_available,/// `downloaded` is update_downloaded (the background download finished),/// `installed` is update_installed.@@ -1341,7 +1364,7 @@ pub const EVENTS: &[EventSpec] = &[},EventSpec {name: event::SHARE,- version: 1,+ version: 2,tier: Tier::Usage,sample_rate: 1.0,products: &["spaces_app"],@@ -1357,8 +1380,18 @@ pub const EVENTS: &[EventSpec] = &["viewer (view-only) or editor; none for unshare.",),OUTCOME,+ p(+ "error_kind",+ Kind::Enum(SHARE_ERROR_KINDS),+ "Why it did not happen: the confirmation was refused, dismissed or could not be shown, not signed in, device not approved, the Space cannot be shared, the relay refused or could not be reached, not an email; none when it worked. Never who.",+ ),+ p(+ "failed_stage",+ Kind::Enum(SHARE_STAGES),+ "Where it stopped (request, presence, account, device, driver, relay); none when it worked.",+ ),],- purpose: "Sharing adoption, and how often Spaces are shared view-only.",+ purpose: "Sharing adoption, how often Spaces are shared view-only, and why sharing fails.",},EventSpec {name: event::PRESENCE_SESSION,diff --git a/libs/cua/crates/cua-telemetry/tests/privacy.rs b/libs/cua/crates/cua-telemetry/tests/privacy.rsindex 9cacc49f07..c4f3f5e4ee 100644--- a/libs/cua/crates/cua-telemetry/tests/privacy.rs+++ b/libs/cua/crates/cua-telemetry/tests/privacy.rs@@ -194,7 +194,7 @@ fn all_builders(s: &str) -> Vec<Event> {events::onboarding_page("welcome", s, "none"),events::space_wizard(s),events::persistent_agent(s, Some(s), Outcome::Ok, Some(s)),- events::share(s, s, Outcome::Ok),+ events::share(s, s, Outcome::Ok, "none", "none"),events::app_update(s, s, s),events::device_enroll(s, Outcome::Ok),events::experiment(s, "sharing"),@@ -214,7 +214,8 @@ fn all_builders(s: &str) -> Vec<Event> {v.push(events::onboarding_page("volume", "completed", s).unwrap());v.push(events::space_wizard("cancelled").unwrap());v.push(events::persistent_agent("create", Some(s), Outcome::Error, Some(s)).unwrap());- v.push(events::share("share", s, Outcome::Ok).unwrap());+ v.push(events::share("share", s, Outcome::Ok, s, s).unwrap());+ v.push(events::share("share", "viewer", Outcome::Error, s, s).unwrap());v.push(events::app_update("installed", s, s).unwrap());v.push(events::app_update("downloaded", s, s).unwrap());v.push(events::device_enroll("rekey", Outcome::Ok).unwrap());@@ -1137,15 +1138,44 @@ fn activation_builders_keep_vocabulary_and_coarsen_the_rest() {assert_eq!(failed.props["http_status"], 401);assert_eq!(failed.props["error_kind"], "unauthenticated");assert_eq!(- events::share("unshare", "editor", Outcome::Ok)+ events::share("unshare", "editor", Outcome::Ok, "none", "none").unwrap().props["role"],"none");assert_eq!(- events::share("share", "viewer", Outcome::Ok).unwrap().props["role"],+ events::share("share", "viewer", Outcome::Ok, "none", "none")+ .unwrap()+ .props["role"],"viewer");+ // CUA-1855: why a share failed, in fixed words; a dismissed prompt is+ // `cancelled`, an unknown kind `other`, and an ok never carries one.+ let dismissed = events::share(+ "share",+ "viewer",+ Outcome::Cancelled,+ "presence_cancelled",+ "presence",+ )+ .unwrap();+ assert_eq!(dismissed.props["outcome"], "cancelled");+ assert_eq!(dismissed.props["error_kind"], "presence_cancelled");+ assert_eq!(dismissed.props["failed_stage"], "presence");+ let unknown =+ events::share("share", "editor", Outcome::Error, "[email protected]", "x").unwrap();+ assert_eq!(unknown.props["error_kind"], "other");+ assert_eq!(unknown.props["failed_stage"], "other");+ let ok = events::share(+ "share",+ "editor",+ Outcome::Ok,+ "presence_denied",+ "presence",+ )+ .unwrap();+ assert_eq!(ok.props["error_kind"], "none");+ assert_eq!(ok.props["failed_stage"], "none");assert_eq!(events::persistent_agent("create", Some("hermes"), Outcome::Ok, None).unwrap()diff --git a/libs/cua/crates/cua-teleport/src/biometric.rs b/libs/cua/crates/cua-teleport/src/biometric.rsindex 3fa6cc4132..5c7cdaae64 100644--- a/libs/cua/crates/cua-teleport/src/biometric.rs+++ b/libs/cua/crates/cua-teleport/src/biometric.rs@@ -64,10 +64,19 @@ const UNAVAILABLE_HELP: &str = "this Mac needs Touch ID or a login password";#[cfg(target_os = "windows")]const UNAVAILABLE_HELP: &str = "Cua asks for Windows Hello, or your Windows account password when Hello is not set up; this account has neither (set a password in Settings, Accounts, Sign-in options)";#[cfg(target_os = "linux")]-const UNAVAILABLE_HELP: &str = "polkit needs an authentication agent in the session and the ai.cua.spaces.keyvault action installed (the Cua .deb installs it)";+const UNAVAILABLE_HELP: &str = "on Linux this needs Cua Spaces installed from the .deb (it sets up the password prompt; the AppImage cannot) and a desktop session with a polkit authentication agent running";#[cfg(not(any(target_os = "macos", target_os = "windows", target_os = "linux")))]const UNAVAILABLE_HELP: &str = "this platform has no confirmation prompt";+/// What a refusal means, and what to do when no prompt was shown. On Linux+/// polkit refuses without asking when its policy does not let this session+/// ask (an older policy, in a remote desktop session: CUA-1725),+/// so the words say how to get the prompt.+#[cfg(target_os = "linux")]+const DENIED: &str = "polkit did not confirm it is you. If no password prompt appeared, update Cua Spaces from the latest .deb (it sets up the prompt) and use a desktop session with a polkit authentication agent running";+#[cfg(not(target_os = "linux"))]+const DENIED: &str = "biometric authorization was denied";+/// Why an interactive authorization did not succeed.#[derive(Debug, Clone, PartialEq, Eq)]pub enum AuthError {@@ -88,7 +97,7 @@ pub enum AuthError {impl std::fmt::Display for AuthError {fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {match self {- Self::Denied => write!(f, "biometric authorization was denied"),+ Self::Denied => f.write_str(DENIED),Self::Unavailable => write!(f, "user confirmation is unavailable: {UNAVAILABLE_HELP}"),Self::Cancelled => write!(f, "biometric authorization was cancelled"),Self::Failed(detail) => write!(f, "the confirmation prompt failed: {detail}"),@@ -408,7 +417,10 @@ fn hello_result(value: i32) -> Result<(), AuthError> {/// `pkcheck`'s exit status (pkcheck(1)): 0 authorized, 1 not authorized,/// 2 no authentication agent to ask (the challenge could not be made),/// 3 the user dismissed the dialog, 127 an error, said on stderr. An error-/// (or a signal) is reported as one, never as the user's refusal.+/// (or a signal) is reported as one, never as the user's refusal, except+/// an action polkit does not know: the policy is not installed (the+/// AppImage cannot install it), so no prompt can be shown here+/// (CUA-1855).#[cfg_attr(not(target_os = "linux"), allow(dead_code))]fn pkcheck_result(code: Option<i32>, stderr: &str) -> Result<(), AuthError> {let detail = || {@@ -424,6 +436,7 @@ fn pkcheck_result(code: Option<i32>, stderr: &str) -> Result<(), AuthError> {Some(1) => Err(AuthError::Denied),Some(2) => Err(AuthError::Unavailable),Some(3) => Err(AuthError::Cancelled),+ _ if stderr.contains("is not registered") => Err(AuthError::Unavailable),_ => Err(AuthError::Failed(detail())),}}@@ -1027,12 +1040,32 @@ mod tests {pkcheck_result(Some(42), ""),Err(AuthError::Failed(_))));+ // No policy installed (an AppImage), as polkit 124 says it.+ assert_eq!(+ pkcheck_result(+ Some(127),+ "Error checking for authorization ai.cua.spaces.keyvault: GDBus.Error:org.freedesktop.PolicyKit1.Error.Failed: Action ai.cua.spaces.keyvault is not registered\n"+ ),+ Err(AuthError::Unavailable)+ );assert_ne!(AuthError::Failed("x".into()).to_string(),AuthError::Denied.to_string());}+ /// CUA-1855: on Linux a refusal and a missing prompt say what to do.+ #[cfg(target_os = "linux")]+ #[test]+ fn linux_errors_name_the_next_step() {+ let denied = AuthError::Denied.to_string();+ assert!(denied.contains("If no password prompt appeared") && denied.contains(".deb"));+ let unavailable = AuthError::Unavailable.to_string();+ assert!(+ unavailable.contains(".deb") && unavailable.contains("polkit authentication agent")+ );+ }+#[test]fn the_start_time_is_the_22nd_field_even_with_an_odd_process_name() {let stat = "4242 (cua daemon) (x) S 1 4242 4242 0 -1 4194560 1000 0 0 0 5 3 0 0 20 0 8 0 987654 1000000 2000 18446744073709551615 1 1 0 0 0 0 0 0 0 0 0 0 17 2 0 0 0 0 0";@@ -1051,12 +1084,27 @@ mod tests {.expect("the policy file the deb installs");assert!(policy.contains(&format!("<action id=\"{POLKIT_ACTION}\">")));assert!(policy.contains(&format!("<action id=\"{POLKIT_DEVICE_ACTION}\">")));- // The user's own password or fingerprint, every time, in a session they are at.- assert!(policy.contains("<allow_active>auth_self</allow_active>"));- assert!(- policy.contains("<allow_any>no</allow_any>")- && policy.contains("<allow_inactive>no</allow_inactive>")+ // The user's own password or fingerprint, every time, in a session+ // they are at: a local desktop (active) or a remote desktop, which+ // polkit files under "any" (xrdp, VNC: CUA-1725). Never without+ // asking, and never from an inactive session.+ assert_eq!(+ policy+ .matches("<allow_active>auth_self</allow_active>")+ .count(),+ 2+ );+ assert_eq!(+ policy.matches("<allow_any>auth_self</allow_any>").count(),+ 2+ );+ assert_eq!(+ policy+ .matches("<allow_inactive>no</allow_inactive>")+ .count(),+ 2);+ assert!(!policy.contains(">yes<") && !policy.contains("auth_self_keep"));// Only root may pass polkit details, so the messages carry no `$(...)`.assert!(!policy.contains("$("),diff --git a/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift b/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swiftindex 7597dfe535..23de65c491 100644--- a/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift+++ b/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift@@ -55406,8 +55406,19 @@ public enum AppTelemetrySignal: Equatable, Hashable {* `viewer`, `editor` or `none`.*/role: String,/**- * `ok` or `error`.- */outcome: String+ * `ok`, `error`, or `cancelled` when the confirmation prompt was+ * dismissed.+ */outcome: String,+ /**+ * Why it did not happen (`presence_denied`, `presence_cancelled`,+ * `presence_unavailable`, `not_signed_in`, `device_not_enrolled`,+ * `driver_unsupported`, `relay_refused`, `relay_unreachable`,+ * `invalid_who` or `other`); `none` when it worked.+ */errorKind: String,+ /**+ * Where it stopped (`request`, `presence`, `account`, `device`,+ * `driver`, `relay` or `other`); `none` when it worked.+ */failedStage: String)/*** An updater step (`cua_app_update`).@@ -55504,7 +55515,7 @@ public struct FfiConverterTypeAppTelemetrySignal: FfiConverterRustBuffer {case 9: return .volumeSetup(surface: try FfiConverterString.read(from: &buf), storage: try FfiConverterString.read(from: &buf), addToFinder: try FfiConverterBool.read(from: &buf), mountMethod: try FfiConverterString.read(from: &buf), outcome: try FfiConverterString.read(from: &buf))- case 10: return .share(action: try FfiConverterString.read(from: &buf), role: try FfiConverterString.read(from: &buf), outcome: try FfiConverterString.read(from: &buf)+ case 10: return .share(action: try FfiConverterString.read(from: &buf), role: try FfiConverterString.read(from: &buf), outcome: try FfiConverterString.read(from: &buf), errorKind: try FfiConverterString.read(from: &buf), failedStage: try FfiConverterString.read(from: &buf))case 11: return .appUpdate(action: try FfiConverterString.read(from: &buf), channel: try FfiConverterString.read(from: &buf), trigger: try FfiConverterString.read(from: &buf)@@ -55590,11 +55601,13 @@ public struct FfiConverterTypeAppTelemetrySignal: FfiConverterRustBuffer {FfiConverterString.write(outcome, into: &buf)- case let .share(action,role,outcome):+ case let .share(action,role,outcome,errorKind,failedStage):writeInt(&buf, Int32(10))FfiConverterString.write(action, into: &buf)FfiConverterString.write(role, into: &buf)FfiConverterString.write(outcome, into: &buf)+ FfiConverterString.write(errorKind, into: &buf)+ FfiConverterString.write(failedStage, into: &buf)case let .appUpdate(action,channel,trigger):