Skip to content
Source
Sign inSign up
pingdotgg/t3code

feat(desktop): add opt-in cua-driver computer use #4354

Closedinjaneity(GitHub profile, opens in a new tab)wants to merge 241 commits intot3code/codex-turn-mapping fromrefs/pull/4354/headopened View on GitHub

what changed

adds opt-in computer use to the macos, linux, and windows desktop apps. when enabled, desktop passes the packaged cua-driver path and embedded module configuration to its local node server. the existing scoped embedded host owns the driver process and exposes its tools to codex.

packaged builds now download checksum-pinned driver assets for each supported platform and architecture. macos and linux use their release tarballs. windows uses its release zip and powershell expand-archive, which avoids incompatible gnu tar installations earlier on path.

macos keeps its existing permission-inheritance behavior. linux and windows need no additional permission-inheritance implementation and reuse the same embedded lifecycle without installing services, autostart entries, or persistent daemons.

why

the embedded host gives all three platforms one process-ownership model: t3 code starts the driver only after the user opts in, and the scoped finalizer stops it with the server. platform-specific code is limited to release assets, extraction, and executable paths.

validation

  • local: 43 focused tests, affected package typechecks, lint, and formatting pass.
  • cua-linux: 43 focused tests pass; checksum, extraction, binary execution, embedded startup, and clean shutdown pass.
  • cua-windows: 43 focused tests and affected package typechecks pass; checksum, powershell extraction, binary execution, embedded startup, and clean shutdown pass.
  • the windows remote runs in session 0, so gui interaction remains subject to the driver’s documented interactive-session requirement.

ui changes

the existing computer-use setting now appears on every supported desktop platform.

computer-use-enabled computer-use-disabled

checklist

  • this pr is small and focused
  • i explained what changed and why
  • i included before/after screenshots for ui changes
  • i tested the platform-specific paths on linux and windows hosts

Note

Add opt-in embedded cua-driver computer use to the desktop app

  • Adds an enableCua toggle to client settings (default false) exposed in the desktop General Settings panel; the feature is only shown when the desktop bridge is available.
  • On startup, DesktopApp reads enableCua and calls configureCuaDriverServerEnvironment to set cua-related process env vars (T3CODE_CUA_DRIVER_PATH, T3CODE_CUA_DRIVER_HOST_BUNDLE_ID, T3CODE_CUA_DRIVER_MODULE_URL); on failure, it shows a blocking error dialog and continues with cua disabled.
  • Server startup gains a cua-driver.start phase via startEmbeddedCuaDriver, which imports the driver module by URL, starts the host, installs Codex MCP launch args via T3CODE_CODEX_APPEND_LAUNCH_ARGS_ENV, and monitors the driver process; it cleans up on scope shutdown.
  • The desktop build script now downloads, SHA-256 verifies, extracts, and stages the @trycua/cua-driver (v0.12.2) binary for the target platform/arch into prod-resources/cua-driver, then includes it as an Electron extra resource.
  • Risk: the cua-driver binary is fetched at build time from a pinned release URL; a checksum mismatch surfaces as CuaDriverChecksumMismatchError and fails the build.
Macroscope summarized 4d2f83e.

Note

Medium Risk Opt-in feature with scoped driver lifecycle, but it runs a native host, mutates process env for Codex MCP, and enables agents to control the user's machine when turned on.

Overview Adds opt-in computer use for desktop (macOS, Linux, Windows) via @trycua/cua-driver 0.12.2, default off.

Settings & UI: New enableCua on client settings (contracts + General settings when desktopBridge is present). Users must restart after toggling.

Desktop startup: If enabled, configureCuaDriverServerEnvironment sets T3CODE_CUA_DRIVER_* for the local Node server (packaged driver path, host bundle id, embedded module URL). Inherited env vars are cleared when disabled so dev overrides cannot bypass opt-in. Configuration failures show an error dialog and the app continues without computer use.

Server: startEmbeddedCuaDriver starts the embedded host when env is set, wires Codex MCP via T3CODE_CODEX_APPEND_LAUNCH_ARGS, and tears down on driver exit. Codex adapter spawn args prefer live append launch args over stale per-session env snapshots.

Packaging: Desktop artifact build downloads checksum-pinned release binaries per platform/arch, stages them into prod-resources/cua-driver, and includes them in extraResources.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 4d2f83e8ad0de682fd9c91a58b463956b8f06d87. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      Important

      Review skipped

      Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

      ⚙️ Run configuration

      Configuration used: Repository UI

      Review profile: CHILL

      Plan: Pro Plus

      Run ID: f658ed38-d3d5-4952-86ae-9c55d232fc24

      You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

      Use the checkbox below for a quick retry:

      • 🔍 Trigger review
      ✨ Finishing Touches
      🧪 Generate unit tests (beta)
      • Create PR with unit tests

      Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

      ❤️ Share
      Comment `@coderabbitai help` to get the list of available commands.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    3. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Needs human review

      This PR introduces a new opt-in computer use feature that allows agents to see and control the user's computer via cua-driver integration. The security-sensitive nature of this capability, combined with new native binary integration across all platforms and substantial new code paths, warrants human review.

      You can customize Macroscope's approvability policy. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. One Effect service convention issue found in the new CuaDriverEmbedded.ts error model. See inline comment.

      Posted via Macroscope — Effect Service Conventions
    5. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟠 High

      https://github.com/pingdotgg/t3code/blob/64fa56946b1484e11afd4f1aca99e98d71bb891f/packages/contracts/src/settings.ts#L646

      enableCua is added to ClientSettingsSchema but missing from ClientSettingsPatch, so updateSettings({ enableCua: ... }) drops the field during patch decoding and the toggle cannot be persisted. Add enableCua: Schema.optionalKey(Schema.Boolean) to ClientSettingsPatch.

      No longer relevant as of 7b4ff33fbf1ef21c74976e8a9fab029a6c18f044

    6. Effect service conventions review: one error-modeling issue found in the new Cua modules. Everything else (namespace imports from effect/*, Schema.TaggedErrorClass usage, scoped finalizers, Path.Path acquired from the environment, whole-channel Effect.catch) matches the conventions.

      Posted via Macroscope — Effect Service Conventions
    7. injaneity(GitHub profile, opens in a new tab) changed the title

    8. One convention finding on the new Cua driver error definitions. See the inline comment.

      Posted via Macroscope — Effect Service Conventions
    9. Effect service conventions review: two findings on error context and tagged-failure recovery in the new Cua driver modules.

      Posted via Macroscope — Effect Service Conventions
    10. Effect service conventions review: one error-context finding in apps/server/src/cua/CuaDriverEmbedded.ts.

      Posted via Macroscope — Effect Service Conventions
    11. Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

      Fix All in Cursor ❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the [Cursor dashboard](https://www.cursor.com/dashboard/bugbot).

      Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.

      Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit d296a0d663b1b6e97d941e83701bb7324b637c59. Configure [here](https://www.cursor.com/dashboard/bugbot).
    12. closing as superseded by #5533, which rebuilds and attributes this computer-use contribution on the current architecture.

Sign in to join this conversation.