Files
orca/native/computer-use-macos/Tests/OrcaComputerUseMacOSTests/SessionLockProbeTests.swift
T
Jinwoo Hong aaa61af50a fix(computer): report a locked screen instead of missing Accessibility (#42277)
* fix(computer): report a locked screen instead of missing Accessibility

Behind the lock screen (display sleep, screen saver or a manual lock) macOS reports Accessibility as untrusted. Orca read that as a missing permission, and its recovery hint led agents to open System Settings. Check the session lock first and return screen_locked; permission setup refuses while locked.

* fix(computer): recheck the lock under the provider lock and at setup launch

* fix(computer): read the lock fresh for setup and keep locked status reads out of the cache

* refactor(computer): drop the extra lock read at setup; the status and setup helper already check it
2026-11-14 02:43:37 -05:00

16 lines
712 B
Swift

import OrcaComputerUseMacOSCore
import XCTest
final class SessionLockProbeTests: XCTestCase {
func testTheSessionLockFlagDecides() {
XCTAssertTrue(SessionLockProbe.isLocked(session: ["CGSSessionScreenIsLocked": kCFBooleanTrue as Any]))
XCTAssertTrue(SessionLockProbe.isLocked(session: ["CGSSessionScreenIsLocked": NSNumber(value: 1)]))
XCTAssertFalse(SessionLockProbe.isLocked(session: ["CGSSessionScreenIsLocked": kCFBooleanFalse as Any]))
}
func testAnAbsentKeyOrMissingSessionIsUnlocked() {
XCTAssertFalse(SessionLockProbe.isLocked(session: ["kCGSSessionOnConsoleKey": NSNumber(value: 1)]))
XCTAssertFalse(SessionLockProbe.isLocked(session: nil))
}
}