[Bug]: [macOS] Computer Use never starts — CuaUtility exits with computer_runtime_directory_unsafe, and the failure is misreported as 「设备受限(家长控制)」

Đang mở
#572 5 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
30/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
electron, macos, typescript
Lĩnh vực
desktop, security

Hướng nghiên cứu

Start with assertSafeAncestors and privateDirectory in node_modules/@mavis/computer-use/dist/desktop-lock.js, then blocked() and snapshot() in dist/main/modules/local-runtime/computer-use/component-permissions.js, which map every startup failure to 'restricted'. Done means a failed start surfaces its real error code in the UI instead of the parental-controls label. Changing the SDK's ancestor rule is a separate design question, so check with maintainers before touching it.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

desktop
Product or interface

Desktop app

Version

3.1.9.202 (Electron), macOS 27.2 arm64

Platform

macOS

OS version and architecture

macOS 27.2 arm64

Issue area

Tool call / permission / sandbox

Steps to reproduce
  1. On macOS 27.2 arm64 with MiniMax Code Desktop 3.1.9.202, enable the official Computer Use plugin (computer-use v1.1.1) in the plugin marketplace.
  2. Mention the plugin in a conversation. No computer_* tools are provided at all, while the marketplace still shows the plugin as enabled. There is no error message anywhere in the UI.
  3. In the app's Settings, the Computer Use entry cannot be configured or connected directly: it shows 「设备受限(家长控制)」 ("Restricted (parental controls)"), and after opening that page the page cannot be dismissed — the only way out is force-quitting the whole application.
  4. ~/Library/Logs/MiniMax/main-computer-use.log:
[2026-11-01 02:31:09.315] [info] [CuaUtility] forked generation=1 pid=unknown
[2026-11-01 02:31:09.430] [warn] utility_output {"stream":"stderr","output":"[ComputerUse] {\"schema\":\"computer-use.v1\",\"ts\":1793471469429,\"event\":\"utility_exit\",\"generation\":1,\"outcome\":\"startup_failed\",\"errorCode\":\"computer_runtime_directory_unsafe\"}"}
[2026-11-01 02:31:09.430] [warn] [CuaUtility] child lifecycle ended generation=1 pid=9527 {"exitCode":1}
[2026-11-01 02:31:09.430] [warn] [CuaUtility] utility exited; next computer-use activation will restart it
[2026-11-01 02:31:09.430] [warn] [CuaUtility] startup unavailable; continuing without Computer Use: computer_utility_exited_before_ready
Expected and actual behavior

Expected: the Computer Use runtime starts, and if it cannot start the user is told why.

Actual: the helper is forked and exits ~0.1 s later with errorCode: computer_runtime_directory_unsafe. The host logs a warning and continues the session without Computer Use. The Settings entry reports 「设备受限(家长控制)」, a label that is factually wrong on this machine: the only configuration profile present is com.apple.ironwood.support { allowSiri = 0 }, and no device-management profile restricts screen capture. This is the macOS counterpart of the misreport described for Windows in #548, with a different underlying error code.

Root cause (verified by running the shipped code)

The runtime directory and its lock root are placed under $HOME by the shipped SDK:

node_modules/@mavis/computer-use/dist/desktop-lock.js

export function desktopLockRoot() {
    return path.join(homedir(), '.minimax-computer-use', 'locks');   // :8
}
async function privateDirectory(directory) {                          // :10
    await assertSafeAncestors(directory);
    await mkdir(directory, { recursive: true, mode: 0o700 });
    ...
}
async function assertSafeAncestors(directory) {                       // :23
    ...
    if (!info.isDirectory() || info.isSymbolicLink() ||
        (process.platform !== 'win32' &&
            ((info.uid !== process.getuid?.() && info.uid !== 0) || (info.mode & 0o022) !== 0))) {
        throw new ComputerUseError('computer_runtime_directory_unsafe',
            'Runtime ancestors must be real directories owned by the current user or root and not group/world writable.');
    }
}

The ancestor walk requires every existing ancestor to be owned by the current user or root and not group/world writable (mode & 0o022 === 0). On this machine the home directory is:

$ ls -lde ~
drwxrwxrwx+ 123 kevintung staff 3936 /Users/kevintung
 0: user:lily allow list,add_file,search,add_subdirectory,delete_child,readattr,writeattr,readextattr,writeextattr,readsecurity
 1: group:everyone deny delete

0777 ⇒ mode & 0o022 != 0 ⇒ the check fails on $HOME itself ⇒ the helper throws computer_runtime_directory_unsafe before it can serve anything.

Reproduced with the shipped code, using the SDK's own function:

$ node --input-type=module -e "
  import { privateDirectory, desktopLockRoot } from './node_modules/@mavis/computer-use/dist/desktop-lock.js';
  try { await privateDirectory(desktopLockRoot()); console.log('ok'); }
  catch (e) { console.log('threw', e.code, '|', e.message); }"
threw computer_runtime_directory_unsafe | computer_runtime_directory_unsafe: Runtime ancestors must be real directories owned by the current user or root and not group/world writable.

The failure propagates exactly as the log shows:

  • dist/main/modules/local-runtime/computer-use/cua-entry.js:24 → dataDir: process.env.MINIMAX_DATA_DIR ?? ''
  • dist/main/modules/local-runtime/computer-use/cua-utility-server.js:27-28 → prepareDesktopComputerUseComponent(input.dataDir)
  • dist/main/modules/local-runtime/computer-use/packaged-component.js:14 → prepareInstalledPackagedComponent({ dataDir, packagedRoot, releaseToken })
  • node_modules/@mavis/computer-use/dist/packaged-component.js:72 → await privateDirectory(parent) → the ancestor check above
  • cua-entry.js:54-63 → .catch(...) logs utility_exit with the error code and exits 1
  • dist/main/modules/local-runtime/computer-use/index.js:305 → reject(new Error('computer_utility_exited_before_ready'))
The label is a misreport, and the honest label already exists

dist/main/modules/local-runtime/computer-use/component-permissions.js

const blocked = () => ({ accessibility: 'restricted', screenRecording: 'restricted', captureReady: false });  // :15
...
async function getComputerUsePermissionStatus() {          // :69
    try { return snapshot(await inspect(false)); }
    catch { return blocked(); }                           // :73-75  ← every failure becomes "restricted"
}
async function requestComputerUsePermission(kind) {       // :77
    ...
    catch { return { status: 'restricted',
        message: 'MiniMax Computer Use is unavailable. Install a trusted matching component and try again.' }; }  // :90-95
}

snapshot() (:32-51) also returns blocked() for any status code other than computer_permission_required / computer_capture_verification_required, so computer_runtime_directory_unsafe is reported to the user as 「设备受限(家长控制)」.

The renderer already has a truthful label for exactly this situation — settings.cu_status_unavailable = "Bridge unavailable" (i18n in out/_next/static/chunks/88822-*.js, used in out/_next/static/chunks/app/(pages)/(mavis)/archon/page-*.js where the component renders v ? t("settings.cu_status_unavailable") : p ? t(y[p[s]]) : t("status.loading")). Because the main process converts every startup failure into restricted, that branch is never reached for a failed start.

Verified workaround

The check passes as soon as the home directory is not group/world writable (the ACL entry for the second local account is unaffected, because a named-user ACL entry grants independently of the mode bits):

$ chmod g-w,o-w ~          # 0777 -> 0755
$ ls -lde ~
drwxr-xr-x@ 123 kevintung staff 3936 /Users/kevintung
 0: user:lily allow list,add_file,search,add_subdirectory,delete_child,readattr,writeattr,readextattr,writeextattr,readsecurity
 1: group:everyone deny delete

$ node --input-type=module -e "…privateDirectory(desktopLockRoot())…"   # -> ok
$ node --input-type=module -e "
  import { prepareInstalledPackagedComponent } from './node_modules/@mavis/computer-use/dist/packaged-component.js';
  const trusted = await prepareInstalledPackagedComponent({ dataDir, packagedRoot, releaseToken });
  console.log(trusted.root);"
/Users/<user>/Library/Application Support/MiniMax/computer-use/components/0.34.1/darwin-arm64/1ba0a658ef2736ba66dd10c1e616e9b7d2af3a50c381643ab4d317d9b9486bfc

The component then installs and verifies successfully, and the driver itself is healthy:

$ minimax-computer-use health_report        # binary_version / platform_supported / session_active / bundle_identity: pass
$ minimax-computer-use call get_desktop_state '{}'
  -> screenshot_width 3456, screenshot_height 2234 (a real 3.5 MB PNG)
$ minimax-computer-use permissions status
  Accessibility: granted   Screen Recording: granted
Two further findings

1. The helper has no TCC identity of its own while it is nested in the host bundle.
It ships at …/MiniMax Code.app/Contents/Resources/resources/computer-use/0.34.1/darwin-arm64/MiniMax Computer Use.app with CFBundleIdentifier = com.minimax.computer-use, but macOS attributes TCC grants to the responsible outer application, so the Screen Recording / Accessibility rows belong to the host app and there is no "MiniMax Computer Use" entry a user can toggle. The driver's own doctor reports the layout it expects:

## install layout
bundle:  /Applications/MiniMax Computer Use.app   exists=false
symlink: /Users/<user>/.local/bin/cua-driver   exists=false

Installing that bundle into /Applications (the signature stays valid — codesign -v --deep --strict passes — and LaunchServices registers it) gives the helper its own TCC identity and its own System Settings row, and the grant then attributes to com.minimax.computer-use rather than to the host.

2. A failed activation is not retried inside the same session.
The log promises "next computer-use activation will restart it", but mentioning the plugin again in the same conversation adds no new fork — the log gains no new entry. The activation is session-scoped, so retrying needs a new session or an application restart, and nothing in the UI says so.

Suggested fixes
  1. Do not collapse every failure into "parental controls". Return the actual error code to the UI: computer_runtime_directory_unsafe, computer_component_invalid, computer_utility_exited_before_ready, and so on. The renderer already knows how to show "Bridge unavailable"; the main process should use it for a failed start instead of blocked().
  2. Show the failure to the user. computer_utility_exited_before_ready is currently a warn line in a log file, while the marketplace still shows the plugin as enabled and the conversation silently has no computer_* tools.
  3. Give an actionable message for computer_runtime_directory_unsafe. The condition is "the home directory is group/world writable"; the fix is one command. Today the error code is the only clue and it never reaches the user.
  4. Consider relaxing the ancestor rule for the user's own home directory. The runtime directory itself is created 0700 and owned by the user, so the lock is protected regardless of whether $HOME is 0755 or 0750. A home directory shared with another local account (or created 0777 by an installer) currently disables Computer Use entirely, with no explanation. Either place the runtime root where the product controls it, or allow the user's own home directory as an ancestor when the runtime directory itself satisfies the 0700/owner requirement.
  5. Install the helper as a standalone bundle (the layout doctor already expects) so that the permission prompts and System Settings rows belong to com.minimax.computer-use and the user can grant or revoke them directly.
  6. Retry on the next activation, or state in the UI that a restart is required after a failed start.
  7. Make the permission page dismissible. A page that can only be left by force-quitting the application is unusable regardless of the underlying state.
Notes
  • macOS counterpart of #548 (Windows, computer_component_invalid): same symptom and the same misreported label, different error code and a different packaging constraint.
  • No computer_* tool was available in the affected session, so no agent-side behaviour could be observed. Everything above comes from the application's own logs, the shipped SDK's diagnostics, and direct calls into the shipped code.
Ngôn ngữ chính
TypeScript
Star
2.3k
Fork
315
Merge trung bình
3 giờ 54 phút
Pull request đã merge (30 ngày)
9

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của MiniMax-AI/minimax-code

Tất cả issue của MiniMax-AI/minimax-code

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.