Control Android from ChatGPT: keep approval on the phone
How can a developer direct phone-app work from ChatGPT while keeping approval on the device? In mid-October 2026, Shelly’s Experimental v8.1.0 / v8.1.1 workflow paired ChatGPT with Codex running in Shelly, delegated othe
How can a developer direct phone-app work from ChatGPT while keeping approval on the device? In mid-October 2026, Shelly’s Experimental v8.1.0 / v8.1.1 workflow paired ChatGPT with Codex running in Shelly, delegated other-app operations to ClosePaw, and kept approval on the device rather than in ChatGPT. [M]
The practical questions are where execution happens, what blocks the handoff, and how a returned result is verified.
Where did remote control run, and what blocked pairing?
In the 2026-10-13 design, Shelly acted as the host: shelly codex pair|code ran codex remote-control --no-daemon and printed a manual pairing code for the ChatGPT app’s Codex.
The runtime was codex-termux v0.162.1-termux.1, based on upstream rust-v0.162.1.
Its connection went outbound over HTTPS/WSS to chatgpt_base_url, using wham/remote/control/server/{enroll,pair,pair/status}, and required ChatGPT login because API-key authentication was unsupported.
The initial failure occurred before the network connection: the Android socket implementation assumed a Termux-owned location, while Shelly used dev.shelly.terminal.
The following chain explains why changing the visible temporary directory alone did not resolve that failure.
| Failure-chain step | Before the workaround | Workaround behavior |
|---|---|---|
| Rendezvous location | The foreground host created $TMPDIR/codex-rc-XXXXXX/rc.sock, but that path was a symlink to the physical socket. |
Shelly retained TMPDIR=$HOME/tmp for the rendezvous location. |
| Physical socket root | Android hardcoded /data/data/com.termux/cdx-termux-<euid>, which other Android apps could not resolve or write. |
libexec_wrapper.so v224 mapped that exact location to <app data dir>/cdx, including /data/user/0/dev.shelly.terminal/cdx. |
| Path-length constraint | The physical socket appended a 64-character hexadecimal hash of the canonical rendezvous path. | The short cdx directory kept <dir>/<64 hex> within the 107-byte sockaddr_un.sun_path limit. |
Foreground operation was another important detail: Shelly’s codex() wrapper always supplied root -c overrides, which made the daemon path ineligible, and also passed --no-daemon explicitly.
The separate codex remote-control pair command only contacted $CODEX_HOME/app-server-control-termux/app-server-control.sock, accepted no socket argument, and was rejected together with --no-daemon.
By commit 91831fb07 on 2026-10-13, pairing and app-driven commands worked on-device.
That observed result established remote command execution in Shelly; the October design separately assigned phone-app operation to ClosePaw. [M]
How did app operations cross the device boundary?
The 2026-10-13 handoff passed a natural-language goal through an explicit Android intent targeting ai.closepaw/ai.closepaw.app.MainActivity, with the String extra goal and FLAG_ACTIVITY_NEW_TASK.
Before dispatch, control characters became spaces, whitespace was collapsed, and the goal was capped at 2000 code points identically in TS, the PlanSpec executor, and Kotlin.
That matching sanitization meant the text reviewed by the human was exactly the text dispatched.
A missing ClosePaw installation was detected with resolveActivity and surfaced through a dedicated message.
Approval for other-app operation remained on the device and could not be granted from ChatGPT. [M]
This was the October 2026 Shelly boundary, rather than a general statement about every approval offered by Remote. [M]
For the current upstream ClosePaw behavior, the documented prerequisite is an Android device or emulator running API 31+ (Android 12 or later). [1]
Normal operation uses Android accessibility, with the Accessibility tree as the default perception source and optional point-in-time screenshots in screenshot/hybrid modes. [1]
The mobile_action tool supplies tap, type, and swipe/scroll operations, while open_app and system_button provide navigation. [1]
Background sessions use a virtual display through optional Shizuku integration. [1]
Unfamiliar apps prompt for per-app approval with always-allow, session-only, or deny choices. [1]
Banking, authenticator, and crypto-wallet apps are hard-blocked, while screens marked FLAG_SECURE are invisible to the agent’s perception by design. [1]
Those upstream behaviors describe ClosePaw’s documented platform; the dated Shelly result-return implementation specifically accepted the Shelly-trusted ClosePaw variant.
The distinction matters at the return boundary because the receiver checked the variant’s pinned certificate.
How did a queued request become a verified result?
Before the 2026-10-15 change, shelly closepaw "<goal>" returned when the request entered the approval queue, so its caller never learned what the ClosePaw run actually did.
Commit e3ff5b591 added result return to those callers.
Approved shell requests passed their reqId and a per-run 128-bit nonce in the goal broadcast as shelly_req_id and shelly_result_nonce.
The exported ClosePawResultReceiver accepted dev.shelly.terminal.action.CLOSEPAW_RESULT only with a ClosePaw-created PendingIntent token, the ClosePaw sender identity on API 34+, and a registered reqId with a matching single-use nonce.
Returned result text was treated as data rather than instructions. [M]
The dated design therefore distinguished accepting a request for approval from receiving the run’s result.
Its validation covered the signature, sender, and nonce before returning that result to the caller. [M]
Agent registration followed a related device-review boundary on 2026-10-14: shelly agent add "<NL>" let ChatGPT-driven Codex request a draft and registration, with user approval on the device.
Each request used $HOME/.shelly-agent-req-<reqId>, written through tmp+rename with size, age, and rate caps and with control and bidi characters stripped.
Only RN consumed the text, seeding the normal AI-pane @agent flow, where registration was always confirm-gated and reserved run/stop/delete/edit operations were refused.
When Shelly was backgrounded, the native handoff parked the request and posted a review notification with 10 min expiry.
Other approaches
Remote controlling a development host solves task direction while leaving code execution on the selected Mac, Windows machine, devbox, or other connected host. [2]
Its approval requests cover commands, file changes, network access, and connected tools, with permission applying once, for the current chat, or more broadly depending on the request and host configuration. [2]
Direct app launching encountered a different constraint in the 2026-10-16 Fold6 cover-screen setup: without shelly closepaw, Codex tried am start, which Knox blocked.
Without the wording identifying the phone and Spotify app, Codex instead looked for a Spotify plugin; the intended phone-UI route was shelly closepaw --wait.
What to check
- Check the exact project directory when ChatGPT refuses a folder: on 2026-10-13,
shelly codex trust <dir>addressed trust that was not inherited from parent directories, writing the canonical project’strust_level = "trusted"entry plus its alias spelling. - Check whether a missing accessibility permission explains unavailable screen reading or taps: ClosePaw’s setup requires enabling its Accessibility service for those operations. [1]
- Check Shizuku startup after a reboot when background operation is unavailable: its wireless-debugging startup works on Android 11 or above and must be repeated after each reboot because of system limitations. [3]
- Check protected-screen flags when screenshots are blank: Android documents
FLAG_SECUREas preventing screenshots and display on a non-secure display, such as Casting the screen. [4]
A remaining trust-command limit was explicit in the October implementation: it refused /, storage roots, HOME ancestors, and inline project tables.
Sources
- [1] GitHub - imoonkey/closepaw: Open-source Android phone-use agent. Your phone, on autopilot. · GitHub
- [2] Mastering remote engineering work from your phone
- [3] User manual
- [4] Secure sensitive activities
- The author's own notes
AI disclosure: this post was researched, written and reviewed by AI tools.
Publishing: a post that passes automated checks may be published automatically, before the author reads it.
Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.