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(spaces): survive a process that cannot be inspected; upload nightly dSYMs (#6752)

ddupontbefd52f3f656
diff --git a/.github/workflows/cd-cua-spaces-build.yml b/.github/workflows/cd-cua-spaces-build.yml
index b43f5a9cbc..90823cbb83 100644
--- a/.github/workflows/cd-cua-spaces-build.yml
+++ b/.github/workflows/cd-cua-spaces-build.yml
@@ -16,7 +16,7 @@ name: "CD: Cua Spaces build (shadow)"
# them absolute when it publishes) and the signing notes.
# Not built here: Sparkle appcast (needs the published release), Sigstore
# bundles and release-artifacts.json (made at the tag), Electron macOS (beta
-# only), dSYMs.
+# only). The macOS dSYMs go to Sentry, not into the build set.
#
# Trigger: push to main when a release input changes (paths below). A push
# runs only the producer stages (the SwiftUI Rust slice and the Electron macOS
@@ -352,7 +352,7 @@ jobs:
retention-days: 1
# macOS: sign, notarize, staple; DMG and .pkg. Same steps as build-macos in
- # cd-cua-spaces.yml (without the release upload, the appcast and the dSYMs).
+ # cd-cua-spaces.yml (without the release upload and the appcast).
build-macos:
name: darwin-universal (SwiftUI)
needs: [plan, spacesd-published, macos-rust, web]
@@ -480,6 +480,19 @@ jobs:
--sign "$identity" --out "$RUNNER_TEMP/spaces-app" \
--feed-url "https://github.com/$GITHUB_REPOSITORY/releases/download/cua-spaces-latest/cua-spaces-appcast.xml"
+ # build-release.sh strips the shipped binaries and keeps their symbols
+ # here. Nightly and beta crash reports (CUA-SPACES-DESKTOP-2, -H) were
+ # unreadable without them: Sentry matches a crash to its dSYM by build
+ # UUID, so the build that ships must be the one that uploads. Never
+ # fails the build (see the action).
+ - name: Upload the macOS dSYMs to Sentry
+ uses: ./.github/actions/sentry-upload
+ with:
+ token: ${{ secrets.SENTRY_AUTH_TOKEN }}
+ version: ${{ env.VERSION }}
+ kind: debug-files
+ path: ${{ runner.temp }}/spaces-app/cua-spaces-*-dSYMs.zip
+
- name: Notarize and staple the app
if: steps.signing.outputs.apple == 'true'
env:
diff --git a/apps/cua-spaces-desktop/src/model/daemon.ts b/apps/cua-spaces-desktop/src/model/daemon.ts
index fc19b48337..f1f1181bbd 100644
--- a/apps/cua-spaces-desktop/src/model/daemon.ts
+++ b/apps/cua-spaces-desktop/src/model/daemon.ts
@@ -92,7 +92,7 @@ const alive = (pid: number) => {
};
/** The executable a process runs, when the system says. */
-export function executablePath(pid: number, platform: NodeJS.Platform = process.platform): Promise<string | null> {
+export function executablePath(pid: number, platform: NodeJS.Platform = process.platform, run: typeof execFile = execFile): Promise<string | null> {
if (pid <= 0) return Promise.resolve(null);
if (platform === "linux") {
try {
@@ -106,10 +106,17 @@ export function executablePath(pid: number, platform: NodeJS.Platform = process.
? ["powershell.exe", ["-NoProfile", "-NonInteractive", "-Command", `(Get-Process -Id ${pid}).Path`]]
: ["ps", ["-o", "comm=", "-p", String(pid)]];
return new Promise((resolve) => {
- execFile(cmd as string, args as string[], { timeout: 5000, windowsHide: true }, (error, stdout) => {
- const out = String(stdout ?? "").trim();
- resolve(error || !out ? null : out);
- });
+ // `execFile` can throw while spawning (Windows, when a process cannot be
+ // created: CUA-SPACES-DESKTOP-5), which rejected this promise and then the
+ // supervisor's loop. A process that cannot be inspected has no known path.
+ try {
+ run(cmd as string, args as string[], { timeout: 5000, windowsHide: true }, (error, stdout) => {
+ const out = String(stdout ?? "").trim();
+ resolve(error || !out ? null : out);
+ });
+ } catch {
+ resolve(null);
+ }
});
}
diff --git a/apps/cua-spaces-desktop/test/daemon-startup.test.ts b/apps/cua-spaces-desktop/test/daemon-startup.test.ts
index ad58118bce..fb8756d3d0 100644
--- a/apps/cua-spaces-desktop/test/daemon-startup.test.ts
+++ b/apps/cua-spaces-desktop/test/daemon-startup.test.ts
@@ -61,6 +61,14 @@ describe("the daemon's files", () => {
expect(await executablePath(process.pid)).toMatch(/node|Electron/i);
expect(await executablePath(0)).toBeNull();
});
+
+ it("has no path, instead of rejecting, when the process cannot be inspected (CUA-SPACES-DESKTOP-5)", async () => {
+ const throwing = (() => {
+ throw new Error("spawn failed");
+ }) as unknown as typeof import("node:child_process").execFile;
+ expect(await executablePath(1234, "win32", throwing)).toBeNull();
+ expect(await executablePath(1234, "darwin", throwing)).toBeNull();
+ });
});
describe.skipIf(!posix)("the supervisor", () => {