Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ open-computer-use/install.sh

```console
$ open-computer-use status
{"accessibility": true, "frontmost": "Otty", "frontmost_pid": 2544, "locked": false}
{"accessibility": true, "frontmost": "Otty", "frontmost_pid": 2544, "locked": false, "sandboxed": false}
```

The loop is observe, act, read back:
Expand Down
9 changes: 9 additions & 0 deletions open_computer_use/axbridge.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1462,9 +1462,18 @@ func freshPermissions() throws -> [String: Any] {
return status
}

/// libsystem_sandbox's check, which has no public header. With no operation it
/// answers whether the process runs under Seatbelt at all.
@_silgen_name("sandbox_check")
private func sandbox_check(_ pid: pid_t, _ operation: UnsafePointer<CChar>?, _ type: Int32) -> Int32

func statusJSON() -> [String: Any] {
let front = frontmostApp()
return [
// A sandbox denies the accessibility and window-server lookups, so inside
// one `accessibility` reads false even when the host app has the permission
// (Codex's workspace-write shell, 2026-11-12).
"sandboxed": sandbox_check(getpid(), nil, 0) != 0,
"accessibility": AXIsProcessTrusted(),
"locked": screenLocked(),
"frontmost": front?.localizedName ?? "",
Expand Down
6 changes: 6 additions & 0 deletions open_computer_use/desktop.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,12 @@ class Desktop:
def __init__(self, app, *, menus=True, limit=250, machine_wide=False):
self.bridge = Bridge()
status = self.bridge.call("status")
if status["sandboxed"]:
self.close()
raise RuntimeError(
"This shell runs inside a sandbox, which hides the accessibility tree whatever "
"System Settings says. Run open-computer-use outside it (in Codex, request escalation)."
)
if not status["accessibility"]:
self.close()
raise RuntimeError(
Expand Down
11 changes: 8 additions & 3 deletions skill/open-computer-use/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,14 @@ another app the whole time.
open-computer-use status
```

`accessibility: false` means the app running this shell lacks the
Accessibility permission: tell the user which System Settings switch to turn on
and stop; never trigger the prompt yourself. `locked: true` means the screen is
`sandboxed: true` means this shell runs inside a sandbox, which hides the
accessibility tree and makes `accessibility` read false whatever System Settings
says: run every `open-computer-use` command outside it (in Codex, request
escalation for it) and check `status` again; never ask the user for a permission
because of a sandboxed reading. Outside a sandbox, `accessibility: false` means
the app running this shell lacks the Accessibility permission: tell the user
which System Settings switch to turn on and stop; never trigger the prompt
yourself. `locked: true` means the screen is
locked and every table comes back empty: stop.

The target app must be running. Start one without bringing it forward with
Expand Down
2 changes: 1 addition & 1 deletion tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class MachineWideContracts(unittest.TestCase):
def desktop(self, **options):
bridge = Mock()
bridge.call.side_effect = lambda method, **_: (
{"accessibility": True, "locked": False} if method == "status"
{"sandboxed": False, "accessibility": True, "locked": False} if method == "status"
else {"disposition": disposition("delivered_unverified")})
with patch("open_computer_use.desktop.Bridge", return_value=bridge):
return Desktop("System Settings", **options), bridge
Expand Down
Loading