Files
orca/native/computer-use-macos/Tests/OrcaComputerUseMacOSTests/TrustedOrcaApplicationTests.swift
T
221eb1ce8b fix(computer-use): trust the dev app's bundle id in the helper's peer check (#26500)
pnpm dev launches the app as com.stablyai.orca.dev, but the macOS helper's
isTrustedOrcaApplication only trusted com.stablyai.orca, com.github.Electron
and ids starting with com.stablyai.orca.dev. (with the trailing dot). Every
computer-use request from a dev build failed with "computer-use agent peer is
not authorized".

Move the bundle id rule into TrustedOrcaApplication in
OrcaComputerUseMacOSCore so it is tested, and trust com.stablyai.orca.dev
exactly as well. Look-alikes such as com.stablyai.orca.devtools stay
untrusted.

Fixes #26498

Co-authored-by: petersindex <287557875+petersindex@users.noreply.github.com>
Co-authored-by: Neil <neil@stably.ai>
2026-10-23 19:20:38 -07:00

23 lines
1.1 KiB
Swift

import Testing
@testable import OrcaComputerUseMacOSCore
@Suite("TrustedOrcaApplication")
struct TrustedOrcaApplicationTests {
@Test("trusts the packaged app, every dev build and stock Electron")
func trusted() {
#expect(TrustedOrcaApplication.isTrusted(bundleId: "com.stablyai.orca"))
// What `pnpm dev` launches as: DEV_BUNDLE_ID in dev-electron-bundle-identity.mjs (#26498).
#expect(TrustedOrcaApplication.isTrusted(bundleId: "com.stablyai.orca.dev"))
#expect(TrustedOrcaApplication.isTrusted(bundleId: "com.stablyai.orca.dev.worktree"))
#expect(TrustedOrcaApplication.isTrusted(bundleId: "com.github.Electron"))
}
@Test("rejects look-alike and unrelated bundle ids")
func untrusted() {
#expect(!TrustedOrcaApplication.isTrusted(bundleId: "com.stablyai.orca.devtools"))
#expect(!TrustedOrcaApplication.isTrusted(bundleId: "com.stablyai.orcax"))
#expect(!TrustedOrcaApplication.isTrusted(bundleId: "com.example.orca"))
#expect(!TrustedOrcaApplication.isTrusted(bundleId: ""))
}
}