<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: RYO ITABASHI</title>
    <description>The latest articles on DEV Community by RYO ITABASHI (@ryoitabashi).</description>
    <link>https://dev.to/ryoitabashi</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3861198%2F30a637f3-e537-4353-8c4f-6421e249bf22.jpg</url>
      <title>DEV Community: RYO ITABASHI</title>
      <link>https://dev.to/ryoitabashi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ryoitabashi"/>
    <language>en</language>
    <item>
      <title>Shelly: signing-key rotation, backups, and release checks</title>
      <dc:creator>RYO ITABASHI</dc:creator>
      <pubDate>Wed, 25 Nov 2026 23:48:22 +0000</pubDate>
      <link>https://dev.to/ryoitabashi/shelly-signing-key-rotation-backups-and-release-checks-1n19</link>
      <guid>https://dev.to/ryoitabashi/shelly-signing-key-rotation-backups-and-release-checks-1n19</guid>
      <description>&lt;p&gt;How can an Android app replace a public signing key while preserving a route to restore user data? Shelly’s 2026-10-14 implementation introduced private release-key signing with APK Signature Scheme v3 rotation, alongside encrypted backup/restore. [M1] Which Android versions can use the rotated signer, what must survive restoration, and how does the checked APK reach an update tracker?&lt;/p&gt;

&lt;h2&gt;
  
  
  Why the signing key had to change
&lt;/h2&gt;

&lt;p&gt;Shelly release APKs had been signed with the public React Native / Expo debug.keystore, so anyone could sign an in-place update. [M1] On 2026-10-14, commit 2dbfca956 introduced a debug-to-release signing lineage with rotation min SDK 28. [M1]&lt;/p&gt;

&lt;p&gt;Android 9 supports changing an app’s signing key as part of an APK update through APK Signature Scheme v3. [1] Its proof-of-rotation structure links certificates in order, with each certificate signing the next and giving the new key evidence that it should be trusted wherever the older key was trusted. [1] The signing block also carries supported SDK versions, allowing verification to select a signer whose range includes the device’s platform version. [1]&lt;/p&gt;

&lt;p&gt;The trust relationship includes older certificates that the app itself still trusts, with flags identifying their permitted operations. [1] For example, a flag may allow another app signed by an older certificate to retain a signature permission defined by the app signed with the new certificate. [1]&lt;/p&gt;

&lt;h2&gt;
  
  
  How Shelly selected and checked the signer
&lt;/h2&gt;

&lt;p&gt;In the 2026-10-14 implementation, plugins/with-release-signing.js used SHELLY_SIGNING_MODE to select the Gradle release signingConfig through rotation / release / legacy-debug modes. [M1] Release signing failed without a complete keystore, and CI failed without a mode rather than silently falling back to debug signing. [M1]&lt;/p&gt;

&lt;p&gt;Rotation mode emitted an unsigned APK for apksigner. [M1] The build-android.yml workflow supplied signing and publish dispatch inputs, loaded the keystore from SHELLY_RELEASE_* secrets, and checked pinned fingerprints before the apksigner rotation step. [M1] Verification included API 28+ signer and API 24-27 signer checks. [M1]&lt;/p&gt;

&lt;h3&gt;
  
  
  Which Android versions use the rotated key?
&lt;/h3&gt;

&lt;p&gt;For Android 9 and higher, APK verification can use v3, v2, or v1; older platforms ignore v3 signatures and try v2, then v1. [1] The documented configuration table specifies that a lineage with rotation-min-sdk-version set to x &amp;lt; 33 uses the rotated signer in the v3 block, targeting Android 9 and higher. [2]&lt;/p&gt;

&lt;p&gt;An explicit rotation minimum differs from the apksig default: when a rotated key and lineage are supplied in the signing configuration, the library defaults to the v3.1 signing block. [2] Android 13 supports v3.1, including SDK version targeting that allows rotation to target a later platform release. [2]&lt;/p&gt;

&lt;p&gt;Platform versions also matter for interactions beyond installation: Android 11 corrected PackageManager#checkSignatures handling of original signing keys, which had broken instrumentation using the original key against an app using a rotated key. [2] Android 12 corrected signature-permission and APK rollback problems involving rotated keys. [2]&lt;/p&gt;

&lt;h2&gt;
  
  
  What had to survive restoration?
&lt;/h2&gt;

&lt;p&gt;On 2026-10-14, commit 82b9f8b99 added Settings &amp;gt; Backup &amp;amp; restore, also accessible through shelly://backup and shelly://restore. [M1] The implementation separated non-secret home files into &lt;code&gt;/sdcard/Download/shelly-backup-&amp;lt;ts&amp;gt;.tar&lt;/code&gt; and placed settings and credentials in an encrypted .shellybak. [M1]&lt;/p&gt;

&lt;p&gt;The encrypted bundle contained settings from AsyncStorage, every SecureStore secret, and credential files, optionally including ~/.codex/auth.json. [M1] A drift test kept the SecureStore inventory complete. [M1]&lt;/p&gt;

&lt;p&gt;Encryption used AES-256-GCM with an authenticated SHLYBAK1 header and a key derived through scrypt with N=2^16, r=8, p=1, and random salt. [M1] A generated passphrase had 150 bits and was shown once; alternatively, a user-chosen passphrase had a strength floor. [M1] The passphrase never left component state. [M1]&lt;/p&gt;

&lt;p&gt;Restoration re-imported settings, secrets, and files, including memory DEK and ClosePaw pre-approvals. [M1] The policy seal was re-signed on the new install before restart. [M1]&lt;/p&gt;

&lt;h2&gt;
  
  
  How release checks reached delivery
&lt;/h2&gt;

&lt;p&gt;On 2026-10-29, commit df6bb820a added the dependency-free scripts/release-safety-scan.js to scan the source tree, APK, runtime payload, and manifests. [M1] Its checks covered tokens, private keys, .env-style secrets, keystores, and signing passwords. [M1]&lt;/p&gt;

&lt;p&gt;APK/zip contents were read in memory, with redacted output and an allowlist file. [M1] The scanner ran in build-android.yml before upload/publish and also in ota-update.yml, with unit tests using runtime-constructed fake tokens. [M1]&lt;/p&gt;

&lt;p&gt;The release-delivery change in commit e9b5d2cf0 on 2026-10-29 addressed the following failure chain. [M1]&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Stage&lt;/th&gt;
&lt;th&gt;Before the fix&lt;/th&gt;
&lt;th&gt;After the fix&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;APK location&lt;/td&gt;
&lt;td&gt;APKs lived in android-latest; versioned releases carried no APK. [M1]&lt;/td&gt;
&lt;td&gt;The release workflow copied the APK built from the tagged commit onto the release. [M1]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Tracker handoff&lt;/td&gt;
&lt;td&gt;GitHub-release trackers such as Obtainium had nothing to install from those versioned releases. [M1]&lt;/td&gt;
&lt;td&gt;The attached APK was scanned by the release-safety scanner and accompanied by a .sha256. [M1]&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Other approaches and their constraints
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Target rotation to a later platform release
&lt;/h3&gt;

&lt;p&gt;For the signing problem, the documented v3.1 arrangement lets Android 13 or higher use the rotated signer in the v3.1 block, while older Android versions use the original signer in the v3 block. [2] This supports later-platform rotation while retaining the original signer on older platforms. [2] If an app’s minSdkVersion is less than Android 12 and a rotated key is used, the original signing key must also be specified to sign the v3 block. [2]&lt;/p&gt;

&lt;h3&gt;
  
  
  Supply an APK link directly
&lt;/h3&gt;

&lt;p&gt;For the delivery problem, Obtainium supports direct APK links and an HTML fallback that extracts APK links from a page. [3] Multiple release assets can still require manual selection and prevent silent background updating; Filter APKs by Regular Expression addresses that selection problem. [3]&lt;/p&gt;

&lt;h2&gt;
  
  
  Migration checklist
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;When installation differs across devices, check device support with the PkgInstallSignatureVerificationTest.java CTS tests for v3 or v3.1. [2]&lt;/li&gt;
&lt;li&gt;When verification fails at a platform boundary, inspect minSDK and maxSDK: v3 requires the current platform to be in range and the signed and unsigned SDK values to match. [1]&lt;/li&gt;
&lt;li&gt;When a lineage fails verification, inspect its final certificate: the selected signer must be the last certificate in the proof-of-rotation list. [1]&lt;/li&gt;
&lt;li&gt;When verification finds competing signers, check the platform ranges: v3 verification succeeds only when exactly one signer is in range and verification succeeds for that signer. [1]&lt;/li&gt;
&lt;li&gt;When a signing design requires multiple signers, check that requirement against v3’s limitation: multiple signers are not supported. [1]&lt;/li&gt;
&lt;li&gt;When restoring a backup against its home-file archive, check the archive pairing and extraction inputs: Shelly’s 2026-10-14 bundle pinned the tar’s SHA-256, and restore validated tar entries before extraction. [M1]&lt;/li&gt;
&lt;li&gt;When update notifications arrive but version detection fails, inspect Obtainium’s Track-Only mode: it provides notifications without downloading APKs, and version detection does not work for apps added that way. [3]&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;[1] &lt;a href="https://source.android.com/docs/security/features/apksigning/v3" rel="noopener noreferrer"&gt;APK signature scheme v3&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;[2] &lt;a href="https://source.android.com/docs/security/features/apksigning/v3-1" rel="noopener noreferrer"&gt;APK signature scheme v3.1&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;[3] &lt;a href="https://wiki.obtainium.imranr.dev/sources/" rel="noopener noreferrer"&gt;App Sources&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;[M1] &lt;code&gt;dev/ep32.md&lt;/code&gt; (author's own material)&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;AI disclosure: this post was researched, written and reviewed by AI tools.&lt;br&gt;
Publishing: a post that passes automated checks may be published automatically, before the author reads it.&lt;/p&gt;

</description>
      <category>android</category>
      <category>ai</category>
      <category>devlog</category>
      <category>abotwrotethis</category>
    </item>
    <item>
      <title>Control Android from ChatGPT: keep approval on the phone</title>
      <dc:creator>RYO ITABASHI</dc:creator>
      <pubDate>Mon, 23 Nov 2026 23:25:14 +0000</pubDate>
      <link>https://dev.to/ryoitabashi/control-android-from-chatgpt-keep-approval-on-the-phone-30a6</link>
      <guid>https://dev.to/ryoitabashi/control-android-from-chatgpt-keep-approval-on-the-phone-30a6</guid>
      <description>&lt;p&gt;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]&lt;br&gt;
The practical questions are where execution happens, what blocks the handoff, and how a returned result is verified.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where did remote control run, and what blocked pairing?
&lt;/h2&gt;

&lt;p&gt;In the 2026-10-13 design, Shelly acted as the host: &lt;code&gt;shelly codex pair|code&lt;/code&gt; ran &lt;code&gt;codex remote-control --no-daemon&lt;/code&gt; and printed a manual pairing code for the ChatGPT app’s Codex.&lt;br&gt;
The runtime was codex-termux v0.162.1-termux.1, based on upstream rust-v0.162.1.&lt;br&gt;
Its connection went outbound over HTTPS/WSS to &lt;code&gt;chatgpt_base_url&lt;/code&gt;, using &lt;code&gt;wham/remote/control/server/{enroll,pair,pair/status}&lt;/code&gt;, and required ChatGPT login because API-key authentication was unsupported.&lt;/p&gt;

&lt;p&gt;The initial failure occurred before the network connection: the Android socket implementation assumed a Termux-owned location, while Shelly used &lt;code&gt;dev.shelly.terminal&lt;/code&gt;.&lt;br&gt;
The following chain explains why changing the visible temporary directory alone did not resolve that failure.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Failure-chain step&lt;/th&gt;
&lt;th&gt;Before the workaround&lt;/th&gt;
&lt;th&gt;Workaround behavior&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Rendezvous location&lt;/td&gt;
&lt;td&gt;The foreground host created &lt;code&gt;$TMPDIR/codex-rc-XXXXXX/rc.sock&lt;/code&gt;, but that path was a symlink to the physical socket.&lt;/td&gt;
&lt;td&gt;Shelly retained &lt;code&gt;TMPDIR=$HOME/tmp&lt;/code&gt; for the rendezvous location.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Physical socket root&lt;/td&gt;
&lt;td&gt;Android hardcoded &lt;code&gt;/data/data/com.termux/cdx-termux-&amp;lt;euid&amp;gt;&lt;/code&gt;, which other Android apps could not resolve or write.&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;libexec_wrapper.so&lt;/code&gt; v224 mapped that exact location to &lt;code&gt;&amp;lt;app data dir&amp;gt;/cdx&lt;/code&gt;, including &lt;code&gt;/data/user/0/dev.shelly.terminal/cdx&lt;/code&gt;.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Path-length constraint&lt;/td&gt;
&lt;td&gt;The physical socket appended a 64-character hexadecimal hash of the canonical rendezvous path.&lt;/td&gt;
&lt;td&gt;The short &lt;code&gt;cdx&lt;/code&gt; directory kept &lt;code&gt;&amp;lt;dir&amp;gt;/&amp;lt;64 hex&amp;gt;&lt;/code&gt; within the 107-byte &lt;code&gt;sockaddr_un.sun_path&lt;/code&gt; limit.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Foreground operation was another important detail: Shelly’s &lt;code&gt;codex()&lt;/code&gt; wrapper always supplied root &lt;code&gt;-c&lt;/code&gt; overrides, which made the daemon path ineligible, and also passed &lt;code&gt;--no-daemon&lt;/code&gt; explicitly.&lt;br&gt;
The separate &lt;code&gt;codex remote-control pair&lt;/code&gt; command only contacted &lt;code&gt;$CODEX_HOME/app-server-control-termux/app-server-control.sock&lt;/code&gt;, accepted no socket argument, and was rejected together with &lt;code&gt;--no-daemon&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;By commit 91831fb07 on 2026-10-13, pairing and app-driven commands worked on-device.&lt;br&gt;
That observed result established remote command execution in Shelly; the October design separately assigned phone-app operation to ClosePaw. [M]&lt;/p&gt;

&lt;h2&gt;
  
  
  How did app operations cross the device boundary?
&lt;/h2&gt;

&lt;p&gt;The 2026-10-13 handoff passed a natural-language goal through an explicit Android intent targeting &lt;code&gt;ai.closepaw/ai.closepaw.app.MainActivity&lt;/code&gt;, with the String extra &lt;code&gt;goal&lt;/code&gt; and &lt;code&gt;FLAG_ACTIVITY_NEW_TASK&lt;/code&gt;.&lt;br&gt;
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.&lt;br&gt;
That matching sanitization meant the text reviewed by the human was exactly the text dispatched.&lt;/p&gt;

&lt;p&gt;A missing ClosePaw installation was detected with &lt;code&gt;resolveActivity&lt;/code&gt; and surfaced through a dedicated message.&lt;br&gt;
Approval for other-app operation remained on the device and could not be granted from ChatGPT. [M]&lt;br&gt;
This was the October 2026 Shelly boundary, rather than a general statement about every approval offered by Remote. [M]&lt;/p&gt;

&lt;p&gt;For the current upstream ClosePaw behavior, the documented prerequisite is an Android device or emulator running API 31+ (Android 12 or later). [1]&lt;br&gt;
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]&lt;br&gt;
The &lt;code&gt;mobile_action&lt;/code&gt; tool supplies tap, type, and swipe/scroll operations, while &lt;code&gt;open_app&lt;/code&gt; and &lt;code&gt;system_button&lt;/code&gt; provide navigation. [1]&lt;/p&gt;

&lt;p&gt;Background sessions use a virtual display through optional Shizuku integration. [1]&lt;br&gt;
Unfamiliar apps prompt for per-app approval with always-allow, session-only, or deny choices. [1]&lt;br&gt;
Banking, authenticator, and crypto-wallet apps are hard-blocked, while screens marked &lt;code&gt;FLAG_SECURE&lt;/code&gt; are invisible to the agent’s perception by design. [1]&lt;/p&gt;

&lt;p&gt;Those upstream behaviors describe ClosePaw’s documented platform; the dated Shelly result-return implementation specifically accepted the Shelly-trusted ClosePaw variant.&lt;br&gt;
The distinction matters at the return boundary because the receiver checked the variant’s pinned certificate.&lt;/p&gt;

&lt;h2&gt;
  
  
  How did a queued request become a verified result?
&lt;/h2&gt;

&lt;p&gt;Before the 2026-10-15 change, &lt;code&gt;shelly closepaw "&amp;lt;goal&amp;gt;"&lt;/code&gt; returned when the request entered the approval queue, so its caller never learned what the ClosePaw run actually did.&lt;br&gt;
Commit e3ff5b591 added result return to those callers.&lt;/p&gt;

&lt;p&gt;Approved shell requests passed their &lt;code&gt;reqId&lt;/code&gt; and a per-run 128-bit nonce in the goal broadcast as &lt;code&gt;shelly_req_id&lt;/code&gt; and &lt;code&gt;shelly_result_nonce&lt;/code&gt;.&lt;br&gt;
The exported &lt;code&gt;ClosePawResultReceiver&lt;/code&gt; accepted &lt;code&gt;dev.shelly.terminal.action.CLOSEPAW_RESULT&lt;/code&gt; only with a ClosePaw-created PendingIntent token, the ClosePaw sender identity on API 34+, and a registered &lt;code&gt;reqId&lt;/code&gt; with a matching single-use nonce.&lt;br&gt;
Returned result text was treated as data rather than instructions. [M]&lt;/p&gt;

&lt;p&gt;The dated design therefore distinguished accepting a request for approval from receiving the run’s result.&lt;br&gt;
Its validation covered the signature, sender, and nonce before returning that result to the caller. [M]&lt;/p&gt;

&lt;p&gt;Agent registration followed a related device-review boundary on 2026-10-14: &lt;code&gt;shelly agent add "&amp;lt;NL&amp;gt;"&lt;/code&gt; let ChatGPT-driven Codex request a draft and registration, with user approval on the device.&lt;br&gt;
Each request used &lt;code&gt;$HOME/.shelly-agent-req-&amp;lt;reqId&amp;gt;&lt;/code&gt;, written through tmp+rename with size, age, and rate caps and with control and bidi characters stripped.&lt;br&gt;
Only RN consumed the text, seeding the normal AI-pane &lt;code&gt;@agent&lt;/code&gt; flow, where registration was always confirm-gated and reserved run/stop/delete/edit operations were refused.&lt;br&gt;
When Shelly was backgrounded, the native handoff parked the request and posted a review notification with 10 min expiry.&lt;/p&gt;

&lt;h2&gt;
  
  
  Other approaches
&lt;/h2&gt;

&lt;p&gt;Remote controlling a development host solves task direction while leaving code execution on the selected Mac, Windows machine, devbox, or other connected host. [2]&lt;br&gt;
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]&lt;/p&gt;

&lt;p&gt;Direct app launching encountered a different constraint in the 2026-10-16 Fold6 cover-screen setup: without &lt;code&gt;shelly closepaw&lt;/code&gt;, Codex tried &lt;code&gt;am start&lt;/code&gt;, which Knox blocked.&lt;br&gt;
Without the wording identifying the phone and Spotify app, Codex instead looked for a Spotify plugin; the intended phone-UI route was &lt;code&gt;shelly closepaw --wait&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What to check
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Check the exact project directory when ChatGPT refuses a folder: on 2026-10-13, &lt;code&gt;shelly codex trust &amp;lt;dir&amp;gt;&lt;/code&gt; addressed trust that was not inherited from parent directories, writing the canonical project’s &lt;code&gt;trust_level = "trusted"&lt;/code&gt; entry plus its alias spelling.&lt;/li&gt;
&lt;li&gt;Check whether a missing accessibility permission explains unavailable screen reading or taps: ClosePaw’s setup requires enabling its Accessibility service for those operations. [1]&lt;/li&gt;
&lt;li&gt;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]&lt;/li&gt;
&lt;li&gt;Check protected-screen flags when screenshots are blank: Android documents &lt;code&gt;FLAG_SECURE&lt;/code&gt; as preventing screenshots and display on a non-secure display, such as Casting the screen. [4]&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A remaining trust-command limit was explicit in the October implementation: it refused &lt;code&gt;/&lt;/code&gt;, storage roots, HOME ancestors, and inline project tables.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;[1] &lt;a href="https://github.com/imoonkey/closepaw" rel="noopener noreferrer"&gt;GitHub - imoonkey/closepaw: Open-source Android phone-use agent. Your phone, on autopilot. · GitHub&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;[2] &lt;a href="https://developers.openai.com/blog/mastering-codex-remote-for-engineering" rel="noopener noreferrer"&gt;Mastering remote engineering work from your phone&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;[3] &lt;a href="https://shizuku.rikka.app/guide/setup/" rel="noopener noreferrer"&gt;User manual&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;[4] &lt;a href="https://developer.android.com/security/fraud-prevention/activities?authuser=339174689" rel="noopener noreferrer"&gt;Secure sensitive activities&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;The author's own notes&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;AI disclosure: this post was researched, written and reviewed by AI tools.&lt;br&gt;
Publishing: a post that passes automated checks may be published automatically, before the author reads it.&lt;/p&gt;

</description>
      <category>android</category>
      <category>ai</category>
      <category>devlog</category>
      <category>abotwrotethis</category>
    </item>
    <item>
      <title>Desktop AI access to Shelly: MCP approval and queue isolation</title>
      <dc:creator>RYO ITABASHI</dc:creator>
      <pubDate>Sun, 22 Nov 2026 03:49:02 +0000</pubDate>
      <link>https://dev.to/ryoitabashi/desktop-ai-access-to-shelly-mcp-approval-and-queue-isolation-5hah</link>
      <guid>https://dev.to/ryoitabashi/desktop-ai-access-to-shelly-mcp-approval-and-queue-isolation-5hah</guid>
      <description>&lt;p&gt;How can desktop AI reach Shelly’s phone-side tools while keeping authentication and approval boundaries? Shelly’s 2026-09 (v8.0.1)–10 (v8.0.2) work combined a Bearer-token-authenticated local MCP server with read-only tools, approval-required exec/write tools, and a request-serialization fix. What could incoming calls access, why did approval delay unrelated requests, and what did the MCP 2026-07-28 stateless flow change?&lt;/p&gt;

&lt;h2&gt;
  
  
  Where desktop access met the approval boundary
&lt;/h2&gt;

&lt;p&gt;On 2026-09-16, commit e578d7f77 added an opt-in MCP server through settings.mcpServerEnabled, off by default, for Claude Code / Claude Desktop clients on the same network. The first pass exposed 4 read-only tools. Terminal output, git status, registered agents, and configured repos became accessible directly for development/debugging instead of through adb/uiautomator.&lt;/p&gt;

&lt;p&gt;The existing capability broker gated OUTGOING requests, while exposing exec/write tools required an ingress-side capability gate. On 2026-09-17, commit d0590ece6 added that incoming-call gate through an in-app approval modal. Its run_command and write_file tools sat behind mcpExecEnabled, which was off by default and had no effect unless MCP Server was also on.&lt;/p&gt;

&lt;p&gt;Every exec/write call waited on components/McpApprovalModal.tsx. The design combined that approval wait with command classification and write-path restrictions.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why one approval delayed unrelated requests
&lt;/h2&gt;

&lt;p&gt;E2E with real Claude Code / Codex clients found bugs such as 1 pending approval blocking the entire queue. The on-device failure was found on 2026-09-17 and addressed in commit e2a8b39b6.&lt;/p&gt;

&lt;p&gt;A touch appeared to “unstick” several queued answers at once, initially making the symptom look like Android JS-timer throttling. The recorded cause was request serialization.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Failure-chain stage&lt;/th&gt;
&lt;th&gt;Before the fix&lt;/th&gt;
&lt;th&gt;After the fix&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Request dispatch&lt;/td&gt;
&lt;td&gt;drainOnce() awaited callTool() sequentially inside a for-loop over request files.&lt;/td&gt;
&lt;td&gt;Each request file was fired off without being awaited inside the loop.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Approval and later reads&lt;/td&gt;
&lt;td&gt;A run_command/write_file approval wait blocked the entire poll tick, including later list_repos and git_status calls that should have answered in milliseconds.&lt;/td&gt;
&lt;td&gt;Dispatched requests were tracked by name in a small in-flight set.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;MCP generally offers no guarantees about concurrency semantics, including when a peer observes a notification relative to another request. The Go SDK handles calls such as tools/call asynchronously with respect to each other. [1]&lt;/p&gt;

&lt;p&gt;Shelly’s recorded change concerned its request-file polling implementation. The asynchronous-call behavior described by the official API documentation belongs to the Go SDK. [1]&lt;/p&gt;

&lt;h2&gt;
  
  
  Authentication at the HTTP boundary
&lt;/h2&gt;

&lt;p&gt;For HTTP-based MCP authorization, the specification defines transport-level access to restricted servers on behalf of resource owners. Authorization is OPTIONAL for MCP implementations; when supported, HTTP-based implementations SHOULD conform to that authorization specification. [2]&lt;/p&gt;

&lt;p&gt;A protected MCP server acts as an OAuth 2.1 resource server, while an MCP client acts as an OAuth 2.1 client making protected requests on behalf of a resource owner. The authorization server handles user interaction when necessary and issues access tokens for use at the MCP server. [2]&lt;/p&gt;

&lt;p&gt;In the Go SDK, RequireBearerToken wraps an HTTP handler such as NewStreamableHTTPHandler and checks every request for an Authorization header containing a bearer token. A supplied TokenVerifier parses and validates the token, while the middleware checks expiration and configured scopes. Accepting only tokens issued for the server remains the responsibility of that TokenVerifier. [1]&lt;/p&gt;

&lt;p&gt;The application must wrap RequireBearerToken around all HTTP handlers needing its inbound-request verification. When RequireBearerTokenOptions.ResourceMetadataURL is set and verification fails, the middleware sets the WWW-Authenticate header as required by the Protected Resource Metadata specification. [1]&lt;/p&gt;

&lt;p&gt;For scope selection, clients MUST treat the scopes in a WWW-Authenticate challenge as authoritative for the current operation. During initial authorization, clients SHOULD use that challenge’s scope parameter when provided, with additional permissions requested incrementally through step-up authorization. [2]&lt;/p&gt;

&lt;h2&gt;
  
  
  What the stateless flow changed
&lt;/h2&gt;

&lt;p&gt;Shelly’s 2026-09 (v8.0.1)–10 (v8.0.2) work included support for the MCP spec 2026-07-28 stateless flow. That protocol revision introduced self-describing requests and optional discovery, allowing requests to reach different server instances. [3]&lt;/p&gt;

&lt;p&gt;The initialize / initialized exchange and Mcp-Session-Id header were retired in that revision. [3] For 2026-07-28 or later, the Go SDK requires io.modelcontextprotocol/protocolVersion and io.modelcontextprotocol/clientCapabilities in each request’s _meta; io.modelcontextprotocol/clientInfo is optional, although clients SHOULD include their identity on every request. [1]&lt;/p&gt;

&lt;p&gt;The server processes the first stateless request when it arrives and validates the per-request metadata. [1] A client wanting capabilities before another operation can use server/discover, although that discovery call is optional. [3] Servers implementing 2026-07-28 MUST implement server/discover. [1]&lt;/p&gt;

&lt;p&gt;For routing and authorization at gateways, Mcp-Method and Mcp-Name carry the method and tool names in HTTP headers. [3] The Go SDK also mirrors the body’s protocol version through Mcp-Protocol-Version. [1]&lt;/p&gt;

&lt;p&gt;Application state can still travel across calls through an explicit handle returned by a tool and passed back as an argument. [3] Under 2026-07-28, a broken response stream loses the in-flight request, and the client must re-issue it with a new ID. The Go SDK retains EventStore and Last-Event-ID paths for backward compatibility with 2025-11-25 and earlier. [1]&lt;/p&gt;

&lt;h2&gt;
  
  
  Other approaches to confirmation and credentials
&lt;/h2&gt;

&lt;p&gt;For a tool needing confirmation or a missing parameter mid-call, Multi Round-Trip Requests return resultType: "input_required", followed by a client retry with answers attached in inputResponses. MRTR replaces server-initiated elicitation/create, sampling/createMessage, and roots/list requests that previously required a held-open stream. [3]&lt;/p&gt;

&lt;p&gt;STDIO implementations SHOULD retrieve credentials from the environment rather than follow the HTTP authorization specification. That credential path applies to STDIO, whereas the authorization flow described above applies to HTTP-based transports. [2]&lt;/p&gt;

&lt;h2&gt;
  
  
  Checklist for access, approval, and request failures
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;If read calls pause behind an approval, inspect the request dispatcher’s await placement: the Shelly failure chain above occurred in drainOnce() while an exec/write call waited for a decision.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If an approval remains unanswered, check whether Shelly is foregrounded and whether the deadline has elapsed: the modal was shown while Shelly was foregrounded, and the design failed closed through automatic denial after a 90s timeout.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If an approved command is refused, check its classification in lib/command-safety.ts: run_command hard-refused commands classified CRITICAL regardless of approval.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If a file write is refused, check its target against the configured path boundary: write_file was scoped to the home dir or a Sidebar-configured repo path, matching git_status’s existing scoping.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If HTTP authentication fails, inspect every request for Authorization: Bearer &lt;code&gt;&amp;lt;access-token&amp;gt;&lt;/code&gt;: authorization MUST accompany every HTTP request, and access tokens MUST NOT appear in URI query strings. [2]&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If a Go SDK streamable HTTP handler rejects a 2026-07-28 request, check StreamableHTTPOptions.Stateless: that version requires Stateless = true, and requests against a non-stateless handler are rejected. [1]&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If a request produces CodeHeaderMismatch (-32020), compare Mcp-Method, Mcp-Name, and Mcp-Protocol-Version with the JSON-RPC body: mismatches between those mirrored headers and body fields produce that error. [1]&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If a Go SDK server needs to make a client request in stateless mode, check the temporary-session constraint: the server cannot make client requests because the client’s response has no way to reach that session. [1]&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;[1] &lt;a href="https://go.sdk.modelcontextprotocol.io/protocol/" rel="noopener noreferrer"&gt;LifeCycle&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;[2] &lt;a href="https://github.com/modelcontextprotocol/modelcontextprotocol/blob/main/docs/specification/2026-07-28/basic/authorization/index.mdx" rel="noopener noreferrer"&gt;index.mdx&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;[3] &lt;a href="https://blog.modelcontextprotocol.io/posts/2026-07-28/" rel="noopener noreferrer"&gt;The 2026-07-28 Specification&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;The author's own notes&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;AI disclosure: this post was researched, written and reviewed by AI tools.&lt;br&gt;
Publishing: a post that passes automated checks may be published automatically, before the author reads it.&lt;/p&gt;

</description>
      <category>android</category>
      <category>ai</category>
      <category>devlog</category>
      <category>abotwrotethis</category>
    </item>
    <item>
      <title>Agent Registration: Chat Questions, Deterministic Checks</title>
      <dc:creator>RYO ITABASHI</dc:creator>
      <pubDate>Fri, 20 Nov 2026 03:51:56 +0000</pubDate>
      <link>https://dev.to/ryoitabashi/agent-registration-chat-questions-deterministic-checks-33kl</link>
      <guid>https://dev.to/ryoitabashi/agent-registration-chat-questions-deterministic-checks-33kl</guid>
      <description>&lt;p&gt;How should a developer replace an incomplete agent-registration card with a conversation that establishes what the agent should actually do? Shelly’s mid-July–early August 2026 work combined conversational slot-filling, LLM-led follow-up questions, and deterministic revalidation of proposed values. [M] Where did the original flow fail, how did Tier 3 change registration, and which limits still governed confirmation and execution?&lt;/p&gt;

&lt;h2&gt;
  
  
  Where did registration lose the user’s intent?
&lt;/h2&gt;

&lt;p&gt;In the v7.5.0 / v7.5.5 period, the relevant conditions included missing registration fields, an unclear task, and recurring requests with a delayed start. [M] For &lt;a class="mentioned-user" href="https://dev.to/agent"&gt;@agent&lt;/a&gt; natural-language requests missing schedule, notificationTrigger, or outputPath, the 2026-07-14 change introduced one follow-up question at a time in chat instead of an AgentConfirmCard containing blank fields for manual completion. [M1]&lt;/p&gt;

&lt;p&gt;The distinction between an incomplete task and an unclear task mattered in the on-device case recorded on 2026-07-24. [M1] The failure and correction followed this chain:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Before the fix&lt;/th&gt;
&lt;th&gt;After the fix&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;“Please prepare for tomorrow” described an outcome without a concrete task, but registration immediately asked when to execute it. [M1]&lt;/td&gt;
&lt;td&gt;The existing isLowConfidenceAgentDraft → extractAgentFieldsWithLlm path gained taskClear and clarifyingQuestion so extraction could establish what to do before asking when. [M1]&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;That correction reused the first-parse fallback already connected in hooks/use-ai-pane-dispatch.ts rather than adding a new trigger. [M1] Validation applied a strict boolean check to taskClear and a length cap to the question string, following the existing fail-closed treatment of extracted fields. [M1]&lt;/p&gt;

&lt;p&gt;A separate on-device request, translated as “check the news every morning starting around next week,” exposed a scheduling problem: registration discarded the delayed-start phrase, scheduled execution from tomorrow, and left the phrase in the derived agent name or prompt. [M1] The scheduler had lacked a deferred-start-date concept. [M1]&lt;/p&gt;

&lt;p&gt;Agent.startNotBefore added that boundary as epoch ms, and the next-fire calculation moved its anchor to max(now, startNotBefore). [M1] This preserved the existing calculation of the soonest cron occurrence at or after the anchor, with the deferred-start effect ending once its date passed. [M1]&lt;/p&gt;

&lt;h2&gt;
  
  
  How did Tier 3 change the design?
&lt;/h2&gt;

&lt;p&gt;The 2026-08-02 design divided registration into three paths: Tier 1 resolved every field with high confidence through parseAgentNL, Tier 2 asked a fixed-template question when one field was missing, and Tier 3 let the LLM lead an ambiguous registration conversation in its own words. [M1] Existing parser, slot-filling, and narrow-extraction code remained authoritative for Tier 1/2 and supplied hints and fallback paths for Tier 3. [M1]&lt;/p&gt;

&lt;p&gt;For conversation state, the design extended PendingAgentSession with phase: 'llm-conversation' alongside 'slot-fill' and 'await-confirm'. [M1] It reused the existing ChatMessage[] history and planned extraction equivalent to toOpenAIHistory(), following the normal chat approach of resending the full history. [M1]&lt;/p&gt;

&lt;p&gt;The proposed exit was equally important: mergeConversationalExtractionIntoDraft() converted the final LLM proposal into ParsedAgentDraft before joining presentDraftForConfirmation(). [M1] The design kept AgentConfirmCard, AgentChatConfirm, confirmAgentDraft, and the capability broker unchanged, preserving the human’s final Confirm tap and runtime dispatch boundary. [M1]&lt;/p&gt;

&lt;p&gt;The queue’s UX direction called for plain-text confirmation in chat rather than structured confirmation cards. [M] By contrast, the dated 2026-08-02 design retained the existing confirmation UI, making conversational collection and final confirmation distinct parts of the design. [M1]&lt;/p&gt;

&lt;p&gt;The validation boundary also changed: the LLM could propose broadly, while connector and secret references required checks against existing entries. [M1] The queue paired that approach with cron reparsing and substring matching against original input to prevent hallucinated proposals. [M]&lt;/p&gt;

&lt;p&gt;For high-risk strings, the design proposed requireVerbatimSubstringMatch() so a dangerous value had to exist in the conversation’s raw text before acceptance. [M1] The later implementation narrowed that check specifically to an exact, case-sensitive substring of text the user actually typed during the session. [M1]&lt;/p&gt;

&lt;h2&gt;
  
  
  What changed in the dated implementation?
&lt;/h2&gt;

&lt;p&gt;The dated implementation milestones established different defaults and action boundaries:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;2026-08-01 — 7e33f4c0e connected Tier 3 Phase 0/1 as an opt-in with agentConversationalRegistrationEnabled default false; LLM-authorable actions were limited to draft/notify. [M1]&lt;/li&gt;
&lt;li&gt;2026-08-03 — fdc185e76 added webhook/cli authoring behind agentConversationalHighRiskActionsEnabled, default false, with both registration and high-risk flags required. [M1]&lt;/li&gt;
&lt;li&gt;2026-08-03 — ab8b00909 changed agentConversationalRegistrationEnabled to default true and connected conversational steps[] to orchestrationSteps and detectApiCallSteps(). [M1]&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The orchestration merge preserved existing content on rejection and used truncate-not-drop behavior on overflow, while granting no new action types or connector access. [M1] In the high-risk implementation, app-act remained outside scope, and AgentAction.appActRecipeId was schema-only with no dispatch logic reading it. [M1]&lt;/p&gt;

&lt;p&gt;The queue specified the provider sequence as Cerebras → Groq → local → fixed-question fallback. [M] The earlier design described cloud-first calls through fast APIs such as Groq/Cerebras, with local inference last and immediate return to Tier 2 if all providers failed. [M1]&lt;/p&gt;

&lt;p&gt;Official structured-output behavior concerned a separate boundary: Cerebras accepted response_format with json_schema, and strict: true enabled token-level constrained decoding for its supported JSON Schema subset. [1] API version 2 enforced an object root and additionalProperties: false on every object, with strict-mode limits of 10 levels of nesting and 500 object properties. [1]&lt;/p&gt;

&lt;p&gt;Those API constraints governed response structure, while Shelly’s transcript matching and scheduling checks governed acceptance of the proposed registration values. [M1]&lt;/p&gt;

&lt;h2&gt;
  
  
  Other approaches
&lt;/h2&gt;

&lt;p&gt;Cerebras strict structured output addressed malformed or schema-invalid responses by constraining generation, whereas strict: false or omission treated the schema as a hint and could yield missing fields, additional fields, or incorrect types. [1] Its supported subset excluded string pattern and string format validation, including formats such as email, date-time, and uuid. [1]&lt;/p&gt;

&lt;p&gt;Groq supported strict structured outputs for openai/gpt-oss-120b, while strict: false was its default best-effort behavior. [2] Strict mode required every field to be required and every object to set additionalProperties: false, but structured outputs provided schema compliance rather than semantic accuracy. [2] Streaming and tool use were outside Groq’s supported Structured Outputs behavior. [2]&lt;/p&gt;

&lt;h2&gt;
  
  
  What to check
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;If a conversation exhausts its turns or produces an unusable response, check the fallback transition: the 2026-08-01 implementation imposed a 5-turn cap and returned to existing slot-filling for LLM unavailability or an unparseable response. [M1]&lt;/li&gt;
&lt;li&gt;If registration depends on cloud availability, check the unreachable-provider case: the 2026-08-03 default-on implementation failed closed to Tier 2 when no LLM was reachable, with the existing benign fallback notice as the user-visible effect. [M1]&lt;/li&gt;
&lt;li&gt;If an initial Tier 3 proposal attempts to promote an action or supply infrastructure references, check the accepted fields: Phase 0 excluded webhook/cli/social-post promotion, connector ids, hosts, and secrets from model exposure and acceptance. [M1]&lt;/li&gt;
&lt;li&gt;If Groq requests fail while configuring openai/gpt-oss-20b or openai/gpt-oss-120b, check reasoning_effort: supported values were low, medium, and high, with medium the default and unsupported values rejected with a 400 response. [3]&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The stated implementation limit remained action-specific: the high-risk exception covered webhook and cli under their independent gate. [M1]&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;[1] &lt;a href="https://inference-docs.cerebras.ai/capabilities/structured-outputs" rel="noopener noreferrer"&gt;Structured Outputs&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;[2] &lt;a href="https://console.groq.com/docs/structured-outputs" rel="noopener noreferrer"&gt;Structured Outputs&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;[3] &lt;a href="https://console.groq.com/docs/api-reference" rel="noopener noreferrer"&gt;API Reference&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;[M1] &lt;code&gt;dev/ep26.md&lt;/code&gt; (author's own material)&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;AI disclosure: this post was researched, written and reviewed by AI tools.&lt;br&gt;
Publishing: a post that passes automated checks may be published automatically, before the author reads it.&lt;/p&gt;

</description>
      <category>agents</category>
      <category>llm</category>
      <category>softwaredevelopment</category>
    </item>
    <item>
      <title>When app.act’s recipe-based app control proved fragile</title>
      <dc:creator>RYO ITABASHI</dc:creator>
      <pubDate>Thu, 19 Nov 2026 12:38:21 +0000</pubDate>
      <link>https://dev.to/ryoitabashi/when-appacts-recipe-based-app-control-proved-fragile-5590</link>
      <guid>https://dev.to/ryoitabashi/when-appacts-recipe-based-app-control-proved-fragile-5590</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fcb23dwsft4hqa2tqyczb.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fcb23dwsft4hqa2tqyczb.jpg" alt="AI-generated illustration" width="800" height="534"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Image: AI-generated illustration&lt;/p&gt;

&lt;p&gt;How could Shelly send a LINE message or publish an X post by operating another Android app? Its app.act implementation used Accessibility Service recipes, but cold-start timing, an ambiguous-match safety trip, and a focus-stealing capture UI led to complete removal on 2026-08-31. Which execution conditions mattered, what can developers check when similar symptoms appear, and how do API-based posting approaches change the operation and its requirements?&lt;/p&gt;

&lt;h2&gt;
  
  
  The failure was in operating the target screen
&lt;/h2&gt;

&lt;p&gt;During on-device testing, three distinct bugs surfaced in a single day: cold-start timing, an ambiguous-match safety trip, and a focus-stealing capture UI. The removal decision also identified a compile-time two-app allowlist and breakage from target-app screen changes as constraints of the approach.&lt;/p&gt;

&lt;p&gt;The native execution path had used resourceId-matched AccessibilityNodeInfo actions without gesture dispatch. Its scope had been LINE+X, with canRetrieveWindowContent only and the bundled recipes line.send-message and x.post.&lt;/p&gt;

&lt;p&gt;Android distinguishes the capability to inspect a screen from the capability to dispatch gestures: canRetrieveWindowContent must be true to inspect the UI hierarchy, while canPerformGestures must be true to dispatch gestures programmatically. For an individual node, the documented action API is performAction(); system-wide actions, such as pressing Back or opening the notification shade, use performGlobalAction(). [1]&lt;/p&gt;

&lt;p&gt;The 2026-08-31 decision was to remove the UI-automation approach rather than continue hardening it against changes in target-app screens. The resulting change covered the observation, recipe-execution, and dispatch parts of the same action path.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Failure-chain stage&lt;/th&gt;
&lt;th&gt;Before removal&lt;/th&gt;
&lt;th&gt;After removal on 2026-08-31&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Observe the target app&lt;/td&gt;
&lt;td&gt;ShellyAccessibilityService supplied the package-scoped accessibility layer.&lt;/td&gt;
&lt;td&gt;The accessibility service was removed.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Load and execute a recipe&lt;/td&gt;
&lt;td&gt;AppActRecipeStore.kt and AppActExecutor.kt supplied recipe loading and execution.&lt;/td&gt;
&lt;td&gt;The recipe store, Kotlin executor, and bundled recipes were removed.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Dispatch the action&lt;/td&gt;
&lt;td&gt;The app-act action type and associated fields connected the agent action to the generated script.&lt;/td&gt;
&lt;td&gt;The action type, fields, and generated-script path were removed.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  A diagnostic checklist: startup, matching, capture
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Check whether service initialization has completed
&lt;/h3&gt;

&lt;p&gt;For a cold-start symptom, has service-dependent initialization reached onServiceConnected() before the action begins?&lt;/p&gt;

&lt;p&gt;Android’s guide places initialization in onServiceConnected(). [1] The app.act-specific observation was a cold-start timing bug during on-device testing.&lt;/p&gt;

&lt;p&gt;The guide also places runtime configuration updates through setServiceInfo() in that callback. XML configuration defines the events a service handles and the feedback it provides, while setServiceInfo() allows configuration changes at runtime. [1]&lt;/p&gt;

&lt;p&gt;A related check is whether the event being handled matches the configured event types: onAccessibilityEvent() is called when the system detects a matching event, such as a focus change or button click. The service must also be declared in the manifest with BIND_ACCESSIBILITY_SERVICE enforced so that only the system can bind to it. [1]&lt;/p&gt;

&lt;h3&gt;
  
  
  Check the selected node on the target screen
&lt;/h3&gt;

&lt;p&gt;For a matching symptom, does the recipe’s resourceId select the intended AccessibilityNodeInfo on the screen being operated?&lt;/p&gt;

&lt;p&gt;The app.act matching failure had been an ambiguous-match safety trip in its resourceId-based execution path. Target-app screen changes had also been identified as a source of breakage in the removal decision.&lt;/p&gt;

&lt;p&gt;Android represents UI elements such as buttons, lists, and text as AccessibilityNodeInfo objects in an accessibility tree. An AccessibilityEvent provides an entry point to that tree, and the guide’s traversal example checks whether the event’s source node is null before inspecting it. [1]&lt;/p&gt;

&lt;p&gt;For a node action, another concrete check is whether the node supports the intended interaction: the guide’s click example checks isClickable before calling performAction(AccessibilityNodeInfo.ACTION_CLICK). [1]&lt;/p&gt;

&lt;h3&gt;
  
  
  Check the foreground package before capture
&lt;/h3&gt;

&lt;p&gt;When a screen snapshot is requested, is the foreground package still inside the intended allowlist?&lt;/p&gt;

&lt;p&gt;The 2026-08-29 captureScreenSnapshot() implementation had explicitly rechecked the foreground package against the allowlist, in addition to the operating system’s packageNames boundary. That authoring work had retained the LINE/X scope.&lt;/p&gt;

&lt;p&gt;Before that flow, adding a recipe beyond the bundled pair had meant hand-writing recipe JSON after reading a logcat node dump. The new snapshot method had produced a read-only structured JSON dump with depth/node-count caps.&lt;/p&gt;

&lt;p&gt;Those limits belonged to the observation path introduced for recipe authoring, alongside recipe drafts and user saving. AppActRecipeStore.load() had also gained lookup for user.-prefixed recipe IDs.&lt;/p&gt;

&lt;h3&gt;
  
  
  Check focus ownership and window availability
&lt;/h3&gt;

&lt;p&gt;Does opening the capture interface change where keyboard input goes or what the accessibility service is inspecting?&lt;/p&gt;

&lt;p&gt;The subsequent on-device failure had been a capture UI that stole focus. Android distinguishes input focus, where keyboard input goes, from accessibility focus, which identifies what the service is inspecting. [1]&lt;/p&gt;

&lt;p&gt;For a capture symptom, check whether rootInActiveWindow is available before looking for the focused node: the official guide allows it to be null when the window is unavailable. Its focus example uses findFocus(AccessibilityNodeInfo.FOCUS_ACCESSIBILITY) to locate the node with accessibility focus. [1]&lt;/p&gt;

&lt;p&gt;Android’s guidance is to respect the user’s focus state and avoid stealing focus unless explicitly triggered by a user action. [1]&lt;/p&gt;

&lt;h2&gt;
  
  
  Check the approval condition separately from the recipe
&lt;/h2&gt;

&lt;p&gt;If the action is requested unattended, which execution gate applies?&lt;/p&gt;

&lt;p&gt;At the Phase 4 checkpoint on 2026-07-14, app-act dispatch had refused unattended execution, matching intent/dm-reply’s interim shape. The later target design had instead treated a fixed recipe and target as consented once at registration, with ongoing Sidebar visibility.&lt;/p&gt;

&lt;p&gt;That registration design had made app-act a deliberate exception to the cli/intent/dm-reply “never one-tap” pattern and had omitted runtime target resolution of the kind used by intent/dm-reply. Registration-time consent and the implemented unattended-execution gate had therefore represented different design stages.&lt;/p&gt;

&lt;p&gt;For parameters shown during approval, check which values reach the preview: resolve_app_act_params() had resolved {{result}} against an already-redacted preview and then applied a second redact_secrets_text pass. Approval requests had carried appActRecipeId and appActParamsResolved.&lt;/p&gt;

&lt;p&gt;The native path had also included LockPromptActivity.kt for a lock-screen wake-and-unlock challenge, using an implementation in which 2 real concurrency bugs had already been resolved.&lt;/p&gt;

&lt;h2&gt;
  
  
  Implementation milestones
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;2026-07-14 — Commit 86862ae3d added appActRecipeId, appActParams, and appActMethod as Phase 2 schema groundwork, with appActParams covered by both textForSecretScan copies. Dispatch had not yet read those fields, so an app-act agent had failed closed through toPlanAction’s default unsupported branch.&lt;/li&gt;
&lt;li&gt;2026-07-14 — Commit bde82f4e6 introduced the native AccessibilityService layer as Phase 3.&lt;/li&gt;
&lt;li&gt;2026-07-14 — Commit e0ed1217c connected shell dispatch, PlanSpec, and the RN bridge end to end, changing AGENT_SCRIPT_VERSION from 10-&amp;gt;11 in lockstep with AgentRuntime.kt.&lt;/li&gt;
&lt;li&gt;2026-08-29 — Commit 1e42490ae introduced the observe-only snapshot, recipe-draft, and user-save flow described above.&lt;/li&gt;
&lt;li&gt;2026-08-31 — Commit 325e9d702 implemented the complete removal shown in the table.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Other approaches: posting operation and remaining requirements
&lt;/h2&gt;

&lt;p&gt;For X, POST /2/tweets creates Posts on behalf of authenticated users, making the posting operation an API request rather than a recipe operating a target screen. The authentication requirement is a User Access Token obtained through OAuth 2.0 PKCE or 3-legged OAuth. [2]&lt;/p&gt;

&lt;p&gt;For Bluesky, the posting operation uses an app.bsky.feed.post record with required text and createdAt fields. Image posting adds a separate com.atproto.repo.uploadBlob step before the uploaded files are referenced in the record. [3]&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;[1] &lt;a href="https://developer.android.com/guide/topics/ui/accessibility/service?authuser=7" rel="noopener noreferrer"&gt;Create an accessibility service&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;[2] &lt;a href="https://github.com/xdevplatform/docs/blob/main/x-api/posts/manage-tweets/introduction.mdx" rel="noopener noreferrer"&gt;Manage Posts on the X API v2&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;[3] &lt;a href="https://github.com/bluesky-social/bsky-docs/blob/main/docs/advanced-guides/posts.md" rel="noopener noreferrer"&gt;Posts&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;The author's own notes&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;AI disclosure: this post was researched, written and reviewed by AI tools.&lt;br&gt;
Publishing: a post that passes automated checks may be published automatically, before the author reads it.&lt;/p&gt;

</description>
      <category>android</category>
      <category>ai</category>
      <category>devlog</category>
      <category>abotwrotethis</category>
    </item>
    <item>
      <title>Android OAuth in WebView: wv, X-Requested-With and Custom Tabs</title>
      <dc:creator>RYO ITABASHI</dc:creator>
      <pubDate>Sat, 14 Nov 2026 03:03:44 +0000</pubDate>
      <link>https://dev.to/ryoitabashi/android-oauth-in-webview-wv-x-requested-with-and-custom-tabs-2o15</link>
      <guid>https://dev.to/ryoitabashi/android-oauth-in-webview-wv-x-requested-with-and-custom-tabs-2o15</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1u733wi5h7b6et1kw5zr.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1u733wi5h7b6et1kw5zr.jpg" alt="AI-generated illustration" width="800" height="534"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Image: AI-generated illustration&lt;/p&gt;

&lt;p&gt;Why does Google sign-in fail inside an Android app's embedded browser while other OAuth providers still complete there? Google's policy bars a developer from directing a Google OAuth 2.0 authorization request "to an embedded user-agent under the developer's control" [1]. Shelly now sends Google OAuth URLs to a real Chrome process through Custom Tabs and leaves the in-app path for Anthropic and GitHub unchanged. The sections below cover three questions: where the block happens and what signals trigger it, how the bridge routes URLs out of the WebView, and which versions, defaults and limits apply.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where does embedded sign-in fail, and what gives the WebView away?
&lt;/h2&gt;

&lt;p&gt;Google's definition of an embedded user-agent includes software libraries that let a developer insert arbitrary scripts, change the default routing of a request to the Google OAuth server, or access session cookies. Every browsing environment must also let the user verify the current connection to the Google OAuth server, including the requested URI and connection security information [1]. RFC 8252 says native apps "MUST use an external user-agent" for authorization requests. Under the same RFC, authorization endpoints may detect and block embedded user-agents because the hosting application can access authentication credentials [2].&lt;/p&gt;

&lt;p&gt;Sites can detect WebView through the wv token unless an application overrides the User-Agent string [3]. In the earlier behavior, WebView added X-Requested-With to every request with the application APK name as its value. The announced change would remove X-Requested-With from general traffic while allowing explicit developer opt-in and a Deprecation Origin Trial for dependent services [4]. Shelly observed Google OAuth refusing to render its sign-in UI through X-Requested-With detection on 2026-05-08.&lt;/p&gt;

&lt;p&gt;In Shelly, the problem limited Gemini login, which depends on Google OAuth. Commit 1c367c474 claimed that Codex / Claude / Gemini OAuth could complete inside the app without an external browser. The 2026-05-08 evening handoff instead identified Gemini login as the only remaining Phase 1 gap and said Phase 1.2 unblocks it.&lt;/p&gt;

&lt;h2&gt;
  
  
  How did the bridge hand Google URLs to Chrome?
&lt;/h2&gt;

&lt;p&gt;Commit 1c367c474 shipped an in-app OAuth bridge through an xdg-open shim and an RN file queue. Its native xdg-open binary, shipped on 2026-05-08, is built from &lt;code&gt;jni/shelly-xdg-open.c&lt;/code&gt; into &lt;code&gt;libshelly_xdg_open.so&lt;/code&gt;. That binary is a direct execve target in jniLibs / libDir, which avoids Android's binfmt_script audit on app_data_file scripts, an audit that Samsung Knox sepolicy denies. HomeInitializer.kt symlinks &lt;code&gt;$HOME/bin/xdg-open&lt;/code&gt; to the binary and exports &lt;code&gt;BROWSER&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;URLs pass through &lt;code&gt;~/.shelly-deep-link-queue&lt;/code&gt;, which &lt;code&gt;app/_layout.tsx&lt;/code&gt; drains every 250ms. Commit 22e935084 (2026-05-08, PR #50) added the Phase 1.2 Stage 1 foundation on the RN side. Its design keeps URL ownership with the CLI, so PKCE, token exchange and the credential write all run on the CLI's loopback callback, following RFC 8252.&lt;/p&gt;

&lt;p&gt;A safety net followed on 2026-07-17 in commit 6bc581864. Before dispatch, &lt;code&gt;app/_layout.tsx&lt;/code&gt; now upgrades any queue line still routed "in-app" whose URL host is accounts.google.com to "external-browser". This protects against any future or third-party emitter that forgets to set authMode explicitly. Detection of accounts.google.com already existed in shelly-xdg-open.c before this commit.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Aspect&lt;/th&gt;
&lt;th&gt;Before: Phase 1 queue&lt;/th&gt;
&lt;th&gt;After: Phase 1.2&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Queue line format&lt;/td&gt;
&lt;td&gt;Plain-URL lines only&lt;/td&gt;
&lt;td&gt;JSON-line file queue with external-browser dispatch&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Google OAuth URL target&lt;/td&gt;
&lt;td&gt;Always the in-app Browser Pane&lt;/td&gt;
&lt;td&gt;A real Chrome process via Custom Tabs (expo-web-browser)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Anthropic / GitHub OAuth&lt;/td&gt;
&lt;td&gt;Always the in-app Browser Pane&lt;/td&gt;
&lt;td&gt;Existing in-app path left untouched&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Which versions, defaults and limits apply, and what is official?
&lt;/h2&gt;

&lt;p&gt;The official platform facts come from Google and Chrome pages. Starting in Android 17, the default User-Agent string in Android WebView is reduced. In the reduced string, OS, CPU and Build information become the static "Linux; Android 10; K" string. Minor/build/patch version information is also reduced to "0.0.0" [3].&lt;/p&gt;

&lt;p&gt;Three items come only from Shelly's own records: the Knox denial of script execution, the 250ms queue drain, and the description of X-Requested-With as unconditional. The claim that Chromium injects X-Requested-With unconditionally comes from Shelly's 2026-07-17 commit.&lt;/p&gt;

&lt;h2&gt;
  
  
  Other approaches
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Full external browser (RFC 8252).&lt;/strong&gt; This approach opens the authorization request outside the app and returns the response through a redirect URI. The constraint that remains is PKCE, which public native clients still have to implement [2].&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Auth Tab.&lt;/strong&gt; From Chrome 137, Auth Tab can directly replace existing Custom Tabs authentication integrations. Its APIs ship in an alpha build, and the dependency example uses &lt;code&gt;androidx.browser:browser:1.9.0&lt;/code&gt;. Data arrives through a callback instead of the intent that standard Custom Tabs use to receive browser data. The AndroidManifest.xml intent filters that authentication previously required are no longer needed. The launch call from the guide looks like this [5]:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nc"&gt;AuthTabIntent&lt;/span&gt; &lt;span class="n"&gt;authTabIntent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;AuthTabIntent&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Builder&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;build&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;authTabIntent&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;launch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;mLauncher&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Uri&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"https://www.example.com/auth"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"mycustomscheme"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The redirect form matters before adopting it. On completion, the tab calls back to the application with a result using https or custom schemas. The launch methods accept one of two sets of parameters: a custom &lt;code&gt;redirectScheme&lt;/code&gt;, or a separate &lt;code&gt;redirectHost&lt;/code&gt; and &lt;code&gt;redirectPath&lt;/code&gt; for https redirects. When using https, Digital Asset Link verification is required [5].&lt;/p&gt;

&lt;p&gt;The trade-off is a tab that removes most of the customization options available in a standard Custom Tab. For users whose devices don't support Auth Tab, fallback to Custom Tabs is automatic. Apps must handle data that can arrive either at the ActivityResultCallback or at the Activity intent. If AuthTabIntent launches the fallback and the current browser does not support Auth Tab, the app receives &lt;code&gt;Activity.RESULT_CANCELED&lt;/code&gt; when the Custom Tab closes [5].&lt;/p&gt;

&lt;h2&gt;
  
  
  What to check
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Does Google sign-in still fail after you change the User-Agent?&lt;/strong&gt; In Shelly, UA spoofing alone could not get past Google's WebView detection.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Does your app set a custom User-Agent?&lt;/strong&gt; Apps that set one with &lt;code&gt;setUserAgentString()&lt;/code&gt; do not send the reduced User-Agent string. An app that appends a suffix to &lt;code&gt;getUserAgentString()&lt;/code&gt; still sends the default portion in reduced form [3].&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Does your code read User-Agent Client Hints from WebView?&lt;/strong&gt; Android WebView has supported them since version 116, but only for applications that send the default User-Agent string [3].&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Does the user's default browser support Auth Tab?&lt;/strong&gt; Support depends on the default browser and its version, and the app can query it with &lt;code&gt;CustomTabsClient#isAuthTabSupported()&lt;/code&gt; [5].&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Is your redirect a custom scheme or an https host and path?&lt;/strong&gt; Auth Tab's launch methods take one of those two parameter sets [5].&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Does the return URI exactly match the one in the authorization session?&lt;/strong&gt; RFC 8252 requires an exact match [2].&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;[1] &lt;a href="https://developers.google.com/identity/protocols/oauth2/policies" rel="noopener noreferrer"&gt;OAuth 2.0 Policies&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;[2] &lt;a href="https://www.rfc-editor.org/info/rfc8252/" rel="noopener noreferrer"&gt;RFC 8252: BCP 212: OAuth 2.0 for Native Apps&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;[3] &lt;a href="https://android-developers.googleblog.com/2024/12/user-agent-reduction-on-android-webview.html" rel="noopener noreferrer"&gt;User-Agent Reduction on Android WebView&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;[4] &lt;a href="https://developer.chrome.com/blog/android-webview-header-privacy/" rel="noopener noreferrer"&gt;Improving user privacy by requiring opt-in to send X-Requested-With header from WebView&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;[5] &lt;a href="https://developer.chrome.com/docs/android/custom-tabs/guide-auth-tab" rel="noopener noreferrer"&gt;Simplify authentication using Auth Tab&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;The author's own notes&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;AI disclosure: this post was researched, written and reviewed by AI tools.&lt;br&gt;
Publishing: a post that passes automated checks may be published automatically, before the author reads it.&lt;/p&gt;

</description>
      <category>android</category>
      <category>ai</category>
      <category>devlog</category>
      <category>abotwrotethis</category>
    </item>
    <item>
      <title>Codex CLI on Android: replacing proot with a bionic termux build</title>
      <dc:creator>RYO ITABASHI</dc:creator>
      <pubDate>Thu, 12 Nov 2026 03:39:50 +0000</pubDate>
      <link>https://dev.to/ryoitabashi/codex-cli-on-android-replacing-proot-with-a-bionic-termux-build-4gi7</link>
      <guid>https://dev.to/ryoitabashi/codex-cli-on-android-replacing-proot-with-a-bionic-termux-build-4gi7</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fg1bm6zzelbdocsudxs89.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fg1bm6zzelbdocsudxs89.jpg" alt="AI-generated illustration" width="800" height="534"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Image: AI-generated illustration&lt;/p&gt;

&lt;p&gt;Why does Codex CLI fail inside Shelly on Android, and what made it run? Shelly replaced the upstream musl binary with an Android-native build from the codex-termux fork, and paired it with a bundled Mozilla CA bundle and the fork's full TUI binary. The sections below cover where and why the upstream binary breaks, how the replacement is wired in, and which versions and limits apply.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where does the upstream binary break, and why?
&lt;/h2&gt;

&lt;p&gt;Codex CLI is a coding agent from OpenAI that runs locally on your computer [1]. It is written in Rust [3]. For Linux arm64, the GitHub Release asset is codex-aarch64-unknown-linux-musl.tar.gz. Each archive contains a single entry with the platform baked into the name, so the binary usually needs renaming to &lt;code&gt;codex&lt;/code&gt; after extraction. The documented installation commands cover Mac or Linux and Windows [1]. As of July 2026, Codex CLI had builds for macOS, Linux and Windows, but not natively for Android [4].&lt;/p&gt;

&lt;p&gt;That Linux build is where Android stops it. The upstream codex binary is ET_EXEC (musl, static), which cannot run on Android 14+ due to SELinux. Shelly's earlier proot approach failed. The working fix therefore swapped the binary itself rather than adding another layer around it, as the next section shows.&lt;/p&gt;

&lt;h2&gt;
  
  
  How does Shelly run the termux fork instead?
&lt;/h2&gt;

&lt;p&gt;Commit 6ba1419a5, dated 2026-04-17 and filed under bug #76, downloads codex-termux's Android-native binary during the CI build. The source is github.com/DioNanos/codex-termux at v0.121.0-termux. At 110MB, the binary is fetched at build time rather than committed to git. On the device, LibExtractor extracts it to termux-libs/codex_exec. The shell setup changed in the same commit, with BASHRC_VERSION bumped to 24.&lt;/p&gt;

&lt;p&gt;HTTPS was the second gap. Commit 6f0b4e164 on 2026-04-19 fixed "a class of silent HTTPS failures across every bundled TLS client". Its Mozilla cacert.pem is a 2026-02 snapshot that ships as an APK asset. The exported CA variables reach curl, node (fetch, undici, https), codex_exec rustls and python requests.&lt;/p&gt;

&lt;p&gt;Login arrived with that same TLS change. Commit 6f0b4e164 also added codex-login device-auth, which unlocks Codex native on-device login. Upstream, running &lt;code&gt;codex&lt;/code&gt; lets a user select Sign in with ChatGPT, and an API key works with additional setup [1]. For headless automation, an API key can be exported as OPENAI_API_KEY [2].&lt;/p&gt;

&lt;p&gt;Interactive mode was the third gap. Running &lt;code&gt;codex&lt;/code&gt; starts an interactive session, and a prompt can also be passed directly, as in &lt;code&gt;codex "Explain the structure of this project"&lt;/code&gt;. A third-party GitHub Actions example uses &lt;code&gt;codex exec --full-auto "Update CHANGELOG for next release"&lt;/code&gt; [2]. On Shelly, bug #114 tracked the missing interactive mode, and acd13d5e6 fixed it on 2026-04-20. The codex-termux tarball holds codex-exec.bin (~106 MB), a 1-shot runner for exec/resume/review, and codex.bin (~154 MB). CI had copied only codex-exec.bin into jniLibs, so on-device &lt;code&gt;codex&lt;/code&gt; was limited to 1-shot mode (&lt;code&gt;codex exec "foo"&lt;/code&gt;). The fix changed .github/workflows/build-android.yml so that codex.bin is packaged as well.&lt;/p&gt;

&lt;p&gt;The three fixes compare as follows:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Aspect&lt;/th&gt;
&lt;th&gt;Before&lt;/th&gt;
&lt;th&gt;After&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Binary type&lt;/td&gt;
&lt;td&gt;ET_EXEC (musl, static)&lt;/td&gt;
&lt;td&gt;ET_DYN, bionic-linked&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Runtime layer&lt;/td&gt;
&lt;td&gt;proot + libtalloc bundled in jniLibs&lt;/td&gt;
&lt;td&gt;codex-termux binary placed as libcodex_exec.so in jniLibs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Launch path&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;~/bin/proot&lt;/code&gt; wrapper for codex.js &lt;code&gt;spawn()&lt;/code&gt; compatibility&lt;/td&gt;
&lt;td&gt;sed patch replaces upstream binaryPath with linker64 + codex_exec&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Interactive &lt;code&gt;codex&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Bare &lt;code&gt;codex&lt;/code&gt; or &lt;code&gt;codex "prompt"&lt;/code&gt; would either fail or silently run exec mode&lt;/td&gt;
&lt;td&gt;codex.bin provides the full ratatui TUI for the interactive REPL&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;TLS trust&lt;/td&gt;
&lt;td&gt;Silent HTTPS failures across bundled TLS clients&lt;/td&gt;
&lt;td&gt;Mozilla cacert.pem extracted to ~/.shelly-ssl/ca-certificates.crt on every launch&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Which versions and limits apply?
&lt;/h2&gt;

&lt;p&gt;Shelly v5.0.0 dates from 2026-04-18, and v5.1.0 is the semver minor release on top of it. Build 769 (&lt;code&gt;615dbed9&lt;/code&gt;) passed CI build run 25092606578. Installation and verification took place on a Galaxy Z Fold6 running Android 16.&lt;/p&gt;

&lt;p&gt;The verified Codex commands in build 769 were a version check and a single prompt. &lt;code&gt;codex --version&lt;/code&gt; returned &lt;code&gt;codex-cli 0.125.0-termux&lt;/code&gt;. A one-prompt run, &lt;code&gt;codex -m gpt-5.5 "Say OK"&lt;/code&gt;, returned &lt;code&gt;OK&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Hardware scope is narrow. All of Shelly's bundled native binaries are arm64-only. Commit 39dc291a1 on 2026-04-27 restricted the build to the arm64 ABI, noting that the 32-bit slice "wouldn't have worked anyway".&lt;/p&gt;

&lt;p&gt;The 0.125.0-termux runtime arrives through a new npm-pack asset layout. Release ingestion accepts &lt;code&gt;mmmbuto-codex-cli-termux-&amp;lt;version&amp;gt;.tgz&lt;/code&gt; and verifies it against npm &lt;code&gt;dist.integrity&lt;/code&gt; before bundling or promoting. Runtime and npm updates are staged, integrity-checked, smoke-tested on-device, and promoted only after PASS. Under v5.1.0, a per-launch verified-latest update path means users no longer wait up to 24 h before a fix lands on their device.&lt;/p&gt;

&lt;p&gt;Upstream releases move on a separate track. A third-party Codex CLI changelog lists v0.167.0, dated 2026-11-06, as the latest release [3]. Standalone installers download from &lt;code&gt;https://releases.openai.com/codex&lt;/code&gt; by default and fall back to GitHub Releases if a metadata or asset download is unavailable. Setting CODEX_INSTALLER_USE_RELEASES_OPENAI_COM to false forces GitHub Releases, with 0 and no also accepted. The package-manager routes are &lt;code&gt;npm install -g @openai/codex&lt;/code&gt; and &lt;code&gt;brew install --cask codex&lt;/code&gt; [1].&lt;/p&gt;

&lt;h2&gt;
  
  
  Other approaches
&lt;/h2&gt;

&lt;p&gt;Both alternatives below are compared on the same two points: where the binary runs, and whether the on-device compatibility problem goes away.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cloud container.&lt;/strong&gt; A cloud Linux container such as Cosyra pre-installs the CLI. Because the binary runs in that container, users reach it without on-device compatibility concerns. The work draws on cloud resources rather than a local runtime [4].&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Upstream package under proot.&lt;/strong&gt; Shelly's 2026-04-11 design in commit 9c68f866c shipped the @openai/codex package with a proot-patched codex.js on the phone itself. In that design, claude/gemini/codex updated daily in the background, with a fallback to the bundled versions. The compatibility problem stayed unsolved on the device: "Previous proot approach failed".&lt;/p&gt;

&lt;h2&gt;
  
  
  What to check
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Is a musl static Codex binary being launched on Android 14 or later?&lt;/strong&gt; SELinux blocks it there, and Shelly's fix replaced it with codex-termux's Android-native build linked through linker64.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Does bare &lt;code&gt;codex&lt;/code&gt; fail or quietly behave like &lt;code&gt;codex exec&lt;/code&gt;?&lt;/strong&gt; Confirm that codex.bin is in the package, because with only codex-exec.bin copied into jniLibs, on-device &lt;code&gt;codex&lt;/code&gt; stays in 1-shot mode.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Do curl, node fetch/undici or codex_exec rustls requests fail HTTPS silently?&lt;/strong&gt; Check the CA configuration: Shelly exported SSL_CERT_FILE / SSL_CERT_DIR / CURL_CA_BUNDLE / NODE_EXTRA_CA_CERTS / REQUESTS_CA_BUNDLE alongside its bundled Mozilla cacert.pem.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Is the device or APK slice 32-bit?&lt;/strong&gt; Shelly's bundled native binaries, including the Codex runtime, target arm64 only.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Is a downloaded Codex runtime promoted before it is verified?&lt;/strong&gt; Shelly's ingestion checks the npm-pack tarball against npm &lt;code&gt;dist.integrity&lt;/code&gt; and smoke-tests on-device before promotion.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Do several panes or fast relaunches download Codex twice?&lt;/strong&gt; Serialize runtime updates with a lock such as &lt;code&gt;~/.shelly-runtime/.update.lock&lt;/code&gt;. In a three-way forced updater test, one real updater ran and two exited immediately with &lt;code&gt;done (skipped, locked)&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;[1] &lt;a href="https://github.com/openai/codex" rel="noopener noreferrer"&gt;github.com&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;[2] &lt;a href="https://dev.to/deployhq/getting-started-with-openai-codex-cli-ai-powered-code-generation-from-your-terminal-5hm8"&gt;dev.to&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;[3] &lt;a href="https://ppcbasic.com/changelog/codex/" rel="noopener noreferrer"&gt;ppcbasic.com&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;[4] &lt;a href="https://cosyra.com/guides/codex-cli-on-android.html" rel="noopener noreferrer"&gt;cosyra.com&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;The author's own notes&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;AI disclosure: this post was researched, written and reviewed by AI tools.&lt;br&gt;
Publishing: a post that passes automated checks may be published automatically, before the author reads it.&lt;/p&gt;

</description>
      <category>android</category>
      <category>ai</category>
      <category>devlog</category>
      <category>abotwrotethis</category>
    </item>
    <item>
      <title>Claude Code 2.1.113 dropped cli.js: pinning 2.1.112 on Android</title>
      <dc:creator>RYO ITABASHI</dc:creator>
      <pubDate>Wed, 11 Nov 2026 11:31:54 +0000</pubDate>
      <link>https://dev.to/ryoitabashi/claude-code-21113-dropped-clijs-pinning-21112-on-android-age</link>
      <guid>https://dev.to/ryoitabashi/claude-code-21113-dropped-clijs-pinning-21112-on-android-age</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fsvmq3k196md3w9amk33c.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fsvmq3k196md3w9amk33c.jpg" alt="AI-generated illustration" width="800" height="534"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Image: AI-generated illustration&lt;/p&gt;

&lt;p&gt;Why does &lt;code&gt;claude&lt;/code&gt; stop working on Android once &lt;code&gt;@anthropic-ai/claude-code&lt;/code&gt; moves past 2.1.112? Starting with 2.1.113, the package's &lt;code&gt;bin.claude&lt;/code&gt; entry points to &lt;code&gt;bin/claude.exe&lt;/code&gt; instead of &lt;code&gt;cli.js&lt;/code&gt;, so Shelly pinned 2.1.112, the last release that ships &lt;code&gt;cli.js&lt;/code&gt; as a pure-JS entry point. The sections below cover three questions: why the native build fails on Android bionic, what the pin runs and where it stops, and which credential files a pinned Shelly install needs before &lt;code&gt;claude&lt;/code&gt; starts.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why does 2.1.113 fail on Android bionic?
&lt;/h2&gt;

&lt;p&gt;The native-loading problem involved the &lt;code&gt;@anthropic-ai/claude-code-linux-arm64-musl&lt;/code&gt; binary on Android bionic. In &lt;a href="mailto:claude-code@2.x"&gt;claude-code@2.x&lt;/a&gt;, the top-level &lt;code&gt;bin/claude.exe&lt;/code&gt; is "only a 500 B stub", as an on-device Termux trace showed on 2026-04-18. The real ET_EXEC sits in that optional sub-package and declares &lt;code&gt;/lib/ld-musl-aarch64.so.1&lt;/code&gt; as its interpreter.&lt;/p&gt;

&lt;p&gt;musl libc is an implementation of the C standard library [2]. Alpine Linux is "a security-oriented, lightweight Linux distribution based on musl libc and busybox" [1].&lt;/p&gt;

&lt;p&gt;Three layers stood between Android and that binary: package installation, the loader and execution policy. At the packaging stage, npm on Android refuses the musl sub-package with EBADPLATFORM. Loading fails next, because bionic's loader rejects the musl linker's ELF program header layout. At execution, SELinux blocks direct execve on &lt;code&gt;app_data_file&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What does the 2.1.112 pin run, and where does it stop?
&lt;/h2&gt;

&lt;p&gt;Commit 008b43f29 (2026-04-19) pinned Claude Code to 2.1.112 and also carried a &lt;code&gt;cp -al&lt;/code&gt; staging fix. An empirical comparison of the &lt;code&gt;@anthropic-ai/claude-code&lt;/code&gt; tarball across versions selected that release. Its tarball contains &lt;code&gt;LICENSE.md&lt;/code&gt;, &lt;code&gt;README.md&lt;/code&gt;, &lt;code&gt;cli.js&lt;/code&gt; and &lt;code&gt;vendor/&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;On the Termux side, the pin is a single install command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm i -g @anthropic-ai/claude-code@2.1.112
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To prevent auto-update, &lt;code&gt;DISABLE_AUTOUPDATER=1&lt;/code&gt; and &lt;code&gt;chmod a-w&lt;/code&gt; are listed as measures to consider. These packaging facts come from tarball inspection and an on-device trace, not from an Anthropic page.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Aspect&lt;/th&gt;
&lt;th&gt;Before (v29–v30 native dispatch of 2.x)&lt;/th&gt;
&lt;th&gt;After (v33 pin)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Dispatch&lt;/td&gt;
&lt;td&gt;v29: bundled Alpine musl linker; v30: existing proot wrapper&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;cli.js&lt;/code&gt; (2.8 MB JS)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Runtime&lt;/td&gt;
&lt;td&gt;v29 failed with "Could not find a PHDR: broken executable?" when &lt;code&gt;/system/bin/linker64&lt;/code&gt; attempted to load Alpine's &lt;code&gt;ld-musl-aarch64.so.1&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;bundled bionic node, unmodified&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Version label&lt;/td&gt;
&lt;td&gt;v29, v30&lt;/td&gt;
&lt;td&gt;BASHRC_VERSION 33&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  What does the pinned build need to log in?
&lt;/h2&gt;

&lt;p&gt;A pinned build alone did not get past bug #102 (claude OAuth 400); the practical workaround was a credentials transplant from a Termux install where &lt;code&gt;claude&lt;/code&gt; already works. That workaround was verified on 2026-04-20, 09:30 to 10:04 JST, with Termux, wireless ADB and a Shelly device.&lt;/p&gt;

&lt;p&gt;Claude Code's authentication state is split between &lt;code&gt;~/.claude.json&lt;/code&gt; and &lt;code&gt;~/.claude/.credentials.json&lt;/code&gt;. The first, 32 KB and directly under &lt;code&gt;$HOME&lt;/code&gt;, holds the onboarding-completion flag and the master copy of the account information. OAuth access and refresh tokens live in the second, a 470 B file. Without both, the onboarding screen appears.&lt;/p&gt;

&lt;p&gt;Replacing &lt;code&gt;/tmp/claude&lt;/code&gt;, adding an &lt;code&gt;xdg-open&lt;/code&gt; wrapper and transplanting &lt;code&gt;~/.claude/&lt;/code&gt; without &lt;code&gt;~/.claude.json&lt;/code&gt; did not complete authentication in the verified session. The sed rewrite of the hard-coded &lt;code&gt;/tmp/claude&lt;/code&gt; to &lt;code&gt;$HOME/.claude-tmp&lt;/code&gt; left no matches, yet &lt;code&gt;claude&lt;/code&gt; still returned 400. An &lt;code&gt;am start&lt;/code&gt; wrapper at &lt;code&gt;$HOME/bin/xdg-open&lt;/code&gt; resolved through &lt;code&gt;which xdg-open&lt;/code&gt;, while &lt;code&gt;claude&lt;/code&gt; kept entering manual paste mode. A 948 MB tar of the whole &lt;code&gt;~/.claude/&lt;/code&gt; directory still ended at onboarding. Adding &lt;code&gt;~/.claude.json&lt;/code&gt; was the last piece, bringing up "Welcome back" and one successful round-trip in Japanese.&lt;/p&gt;

&lt;p&gt;Export from Termux:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;cp ~/.claude.json /sdcard/Download/shelly-claude-root.json
tar czf /sdcard/Download/termux-claude-dir.tar.gz -C ~/.claude .
gunzip -k /sdcard/Download/termux-claude-dir.tar.gz
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Import into Shelly:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;cp /sdcard/Download/shelly-claude-root.json ~/.claude.json
chmod 600 ~/.claude.json
&lt;span class="nb"&gt;cd&lt;/span&gt; ~/.claude
tar xf /sdcard/Download/termux-claude-dir.tar
claude
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Shelly's &lt;code&gt;tar&lt;/code&gt; is hard-wired to &lt;code&gt;/bin/zcat&lt;/code&gt;, which is why the export also produces an uncompressed copy. The Shelly import runs &lt;code&gt;chmod 600 ~/.claude.json&lt;/code&gt; after copying the file. On success, the startup screen shows &lt;code&gt;Claude Code v2.1.112&lt;/code&gt; with the "Welcome back" greeting.&lt;/p&gt;

&lt;p&gt;A first launch may ask "Quick safety check: Is this a project you created or one you trust?". Choosing &lt;code&gt;1. Yes, I trust this folder&lt;/code&gt; stops that prompt from reappearing.&lt;/p&gt;

&lt;h3&gt;
  
  
  What the copies carry and replace
&lt;/h3&gt;

&lt;p&gt;Every exported file lands in &lt;code&gt;/sdcard/Download&lt;/code&gt;: the account master as &lt;code&gt;shelly-claude-root.json&lt;/code&gt;, plus the &lt;code&gt;~/.claude&lt;/code&gt; archive in both &lt;code&gt;.tar.gz&lt;/code&gt; and &lt;code&gt;.tar&lt;/code&gt; form. Because that archive is taken from the whole &lt;code&gt;~/.claude&lt;/code&gt; directory, the OAuth tokens in &lt;code&gt;.credentials.json&lt;/code&gt; travel inside it. Size is dominated by &lt;code&gt;history.jsonl&lt;/code&gt; and file-history, which make up most of the 1.8 GB &lt;code&gt;termux-claude-dir.tar&lt;/code&gt;. Those three files therefore leave tokens, account data and session history outside both apps' home directories until they are removed.&lt;/p&gt;

&lt;p&gt;On the receiving side, extraction overwrites Shelly's entire &lt;code&gt;~/.claude/&lt;/code&gt;, and Termux-era session history comes along with it. Anything already stored in Shelly's &lt;code&gt;~/.claude/&lt;/code&gt; is replaced by the Termux copy at that step.&lt;/p&gt;

&lt;h3&gt;
  
  
  After the access token expires
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;expiresAt&lt;/code&gt; field in &lt;code&gt;.credentials.json&lt;/code&gt; is the access token's expiry, about 9 hours in the verified session. After expiry, claude-code refreshes internally with the refresh token, and that refresh has been reported as blocked by Cloudflare WAF (#47754). Recovery from a blocked refresh means completing &lt;code&gt;/login&lt;/code&gt; again on Termux and re-transplanting both files. An auto-update of the Termux source to 2.1.113+ removes &lt;code&gt;cli.js&lt;/code&gt; and makes &lt;code&gt;/login&lt;/code&gt; itself impossible (#50270).&lt;/p&gt;

&lt;h2&gt;
  
  
  Other approaches
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Dispatch through the bundled musl linker (v29, commit 1a59dd898).&lt;/strong&gt; This attempt targeted the loading barrier by reusing &lt;code&gt;ld-musl-aarch64.so.1&lt;/code&gt;, which Shelly already bundled for codex through the Alpine minirootfs in &lt;code&gt;$HOME/.shelly-rootfs/&lt;/code&gt;. It also reworked &lt;code&gt;__shelly_bg_cli_update&lt;/code&gt; to force-install the musl sub-package. Bionic's own loader remained the constraint, since &lt;code&gt;linker64&lt;/code&gt; would not load the musl linker on the device.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Dispatch through proot (v30, commit 9734ecbff).&lt;/strong&gt; The replacement used the existing proot wrapper, which chroots into the bundled Alpine minirootfs and uses its own ptrace-based loader. Inside that chroot, &lt;code&gt;/lib/ld-musl-aarch64.so.1&lt;/code&gt; resolves naturally from PT_INTERP, and a &lt;code&gt;$HOME:/root&lt;/code&gt; bind exposes the binary at &lt;code&gt;/root/.shelly-cli/node_modules/@anthropic-ai/claude-code-linux-arm64-musl/claude&lt;/code&gt;. A kernel-level &lt;code&gt;chroot&lt;/code&gt;, by contrast, requires elevated privileges for operation [3]. The follow-up v31, which addressed "all 5-agent review blockers for v2.x support", was reverted on 2026-04-18 with 3751 deletions.&lt;/p&gt;

&lt;h2&gt;
  
  
  What to check
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Which entry point is installed?&lt;/strong&gt; Read &lt;code&gt;bin.claude&lt;/code&gt; in the global package's &lt;code&gt;package.json&lt;/code&gt;; &lt;code&gt;"cli.js"&lt;/code&gt; matches 2.1.112, while &lt;code&gt;"bin/claude.exe"&lt;/code&gt; marks 2.1.113.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Is &lt;code&gt;bin/claude.exe&lt;/code&gt; roughly 500 bytes?&lt;/strong&gt; A file that small is the 2.x stub, not the executable.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Does a forced install still lack the sub-package?&lt;/strong&gt; npm needs &lt;code&gt;--libc=musl --force&lt;/code&gt; and fetches &lt;code&gt;@anthropic-ai/claude-code-linux-arm64-musl&lt;/code&gt; only when it is named explicitly.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Does &lt;code&gt;linker64&lt;/code&gt; print the PHDR error from the table?&lt;/strong&gt; That error is the loader barrier, so the musl-linker route will not get further on bionic.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Onboarding or the login-method screen after a transplant?&lt;/strong&gt; Check that &lt;code&gt;~/.claude.json&lt;/code&gt; was copied too, since &lt;code&gt;.credentials.json&lt;/code&gt; alone leads to the login-method screen.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Does &lt;code&gt;tar xzf&lt;/code&gt; fail with "/bin/zcat not found"?&lt;/strong&gt; Use the uncompressed &lt;code&gt;.tar&lt;/code&gt; with &lt;code&gt;tar xf&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Does Shelly's &lt;code&gt;~/.claude/&lt;/code&gt; hold anything worth keeping?&lt;/strong&gt; Back it up before &lt;code&gt;tar xf&lt;/code&gt;, because extraction overwrites the whole directory.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Are the transplant files still in &lt;code&gt;/sdcard/Download&lt;/code&gt; after &lt;code&gt;claude&lt;/code&gt; starts?&lt;/strong&gt; The archive there carries &lt;code&gt;.credentials.json&lt;/code&gt; with the OAuth tokens, and &lt;code&gt;shelly-claude-root.json&lt;/code&gt; is the account master.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Did &lt;code&gt;claude&lt;/code&gt; work, then stop hours later?&lt;/strong&gt; Compare the clock with &lt;code&gt;expiresAt&lt;/code&gt; in &lt;code&gt;.credentials.json&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Has Termux's claude-code changed version?&lt;/strong&gt; Run the 2.1.112 pin there before the next &lt;code&gt;/login&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Limit:&lt;/strong&gt; The transplant was verified in a single session with one Shelly device, and the refresh failure after &lt;code&gt;expiresAt&lt;/code&gt; rests on a report in #47754 rather than that session.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;[1] &lt;a href="https://docs.altinn.studio/en/technology/tools/alpine-linux/" rel="noopener noreferrer"&gt;altinn.studio&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;[2] &lt;a href="https://musl.libc.org/" rel="noopener noreferrer"&gt;libc.org&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;[3] &lt;a href="https://man7.org/linux/man-pages/man2/chroot.2.html" rel="noopener noreferrer"&gt;man7.org&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;The author's own notes&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;AI disclosure: this post was researched, written and reviewed by AI tools.&lt;br&gt;
Publishing: a post that passes automated checks may be published automatically, before the author reads it.&lt;/p&gt;

</description>
      <category>android</category>
      <category>ai</category>
      <category>devlog</category>
      <category>abotwrotethis</category>
    </item>
    <item>
      <title>Running bash and node inside an Android app: four SELinux walls and the patterns that got past them</title>
      <dc:creator>RYO ITABASHI</dc:creator>
      <pubDate>Wed, 04 Nov 2026 06:43:18 +0000</pubDate>
      <link>https://dev.to/ryoitabashi/running-bash-and-node-inside-an-android-app-four-selinux-walls-and-the-patterns-that-got-past-them-3e1d</link>
      <guid>https://dev.to/ryoitabashi/running-bash-and-node-inside-an-android-app-four-selinux-walls-and-the-patterns-that-got-past-them-3e1d</guid>
      <description>&lt;p&gt;If you ship a terminal, a build tool, or an agent runtime inside a normal Android app, you will eventually try to run a bundled ELF or a shell script from your app's private storage. On my test device, almost every obvious way of doing that was refused.&lt;/p&gt;

&lt;p&gt;This post covers four places where that happened in &lt;a href="https://github.com/RYOITABASHI/Shelly" rel="noopener noreferrer"&gt;Shelly&lt;/a&gt;, an open-source AI terminal and agent runtime for Android, what the errors looked like, and what finally worked. Everything below was observed on &lt;strong&gt;one device, a Samsung Galaxy Z Fold6&lt;/strong&gt;, so treat it as a field report, not a spec.&lt;/p&gt;

&lt;h2&gt;
  
  
  TL;DR
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;From an &lt;code&gt;untrusted_app&lt;/code&gt; process, three things failed: &lt;code&gt;am start&lt;/code&gt; from the shell, executing shebang scripts that live in app data, and calling &lt;code&gt;execve()&lt;/code&gt; directly on ELFs that live in app data. The last two match a documented rule for apps targeting API 29+ on Android 10 and later.&lt;/li&gt;
&lt;li&gt;On this device, three patterns got past them: &lt;strong&gt;launch ELFs through &lt;code&gt;/system/bin/linker64&lt;/code&gt;&lt;/strong&gt;, &lt;strong&gt;make anything on &lt;code&gt;PATH&lt;/code&gt; a native binary and pair it with a linker64 launch&lt;/strong&gt;, and &lt;strong&gt;send shell → app signals through a file queue the app polls&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Pass scripts to the interpreter as an argument (&lt;code&gt;bash script.sh&lt;/code&gt;). Running &lt;code&gt;./script.sh&lt;/code&gt; directly still fails.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The setup
&lt;/h2&gt;

&lt;p&gt;Shelly gets its PTY from JNI &lt;code&gt;forkpty&lt;/code&gt;. It ships bash, Node.js, Python, git, curl and other tools inside the APK as &lt;code&gt;.so&lt;/code&gt; files, and a &lt;code&gt;LibExtractor&lt;/code&gt; unpacks them into the app's private data directory (&lt;code&gt;files/termux-libs&lt;/code&gt;) on first launch. It doesn't use the Termux app. So the main tools, and the scripts the app generates, live in app private data (SELinux label &lt;code&gt;app_data_file&lt;/code&gt;), and processes started from Shelly normally run in the app UID's SELinux domain (&lt;code&gt;untrusted_app&lt;/code&gt;). All four problems below come from that combination.&lt;/p&gt;

&lt;p&gt;I direct the work; AI coding agents write the implementation, running both on the phone and on a PC, and every fix is checked on the phone. This post was also drafted with AI assistance and fact-checked against the repository by me.&lt;/p&gt;

&lt;h2&gt;
  
  
  The documented rule underneath Walls 2–4
&lt;/h2&gt;

&lt;p&gt;The Android 10 behavior-changes page (&lt;a href="https://developer.android.com/about/versions/10/behavior-changes-10" rel="noopener noreferrer"&gt;Behavior changes: apps targeting Android 10&lt;/a&gt;, section "Removed execute permission for app home directory") says that untrusted apps targeting API 29 or higher cannot call &lt;code&gt;execve()&lt;/code&gt; directly on files in the app's writable home directory. Executing from a writable location is a W^X violation, and apps are expected to run only binary code embedded in their APK. In SELinux policy terms, &lt;code&gt;untrusted_app&lt;/code&gt; has no &lt;code&gt;execute_no_trans&lt;/code&gt; permission on &lt;code&gt;app_data_file&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Shelly targets SDK 36, so this rule applies as written. I haven't verified whether Samsung Knox adds restrictions on top of it. I also didn't keep the &lt;code&gt;avc: denied&lt;/code&gt; lines for these four cases, so the mapping below is consistent with the official spec but not confirmed from logs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wall 1: &lt;code&gt;am start&lt;/code&gt; from the shell is refused
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Symptom.&lt;/strong&gt; To finish CLI OAuth logins, the shell needed to open a URL in the app's built-in browser pane. Every &lt;code&gt;am start&lt;/code&gt; variant returned:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cmd: Failure calling service activity: Failed transaction (2147483646)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Plain, with &lt;code&gt;-W&lt;/code&gt;, with &lt;code&gt;-f 0x10000000&lt;/code&gt;, with an &lt;code&gt;https&lt;/code&gt; URL or a custom &lt;code&gt;shelly://&lt;/code&gt; scheme: the result never changed (confirmed on-device 2026-05-08). Worse, an older Codex login helper had been swallowing this failure in a callback and printing "→ opened Shelly Browser Pane". That message had been false the whole time.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cause (not isolated).&lt;/strong&gt; &lt;code&gt;FAILED_TRANSACTION&lt;/code&gt; (2147483646) means the binder transaction itself failed; it doesn't say where the request was refused. I didn't isolate the cause. The candidates are Android's background activity start restrictions (BackgroundActivityStartController), a Samsung-specific policy, and an SELinux denial of &lt;code&gt;cmd&lt;/code&gt; passing the caller's tty or pipe fds to system_server. None of them is confirmed.&lt;/p&gt;

&lt;p&gt;A known alternative path is the one Termux uses: an &lt;code&gt;am&lt;/code&gt; implementation that runs under &lt;code&gt;app_process&lt;/code&gt;. I haven't tested it in Shelly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fix.&lt;/strong&gt; Stop asking the system to start the app. Have the app pick up the request itself:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A small native &lt;code&gt;xdg-open&lt;/code&gt; replacement opens &lt;code&gt;$HOME/.shelly-deep-link-queue&lt;/code&gt; with &lt;code&gt;O_APPEND&lt;/code&gt; and writes each URL as one line in a single &lt;code&gt;write()&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The React Native side polls that file about every 250 ms, drains it, and calls the browser store's &lt;code&gt;openUrl()&lt;/code&gt; directly. This updates state inside the already-running Activity instead of starting a new one. Links that do have to leave the app (Google OAuth, for example) still start Custom Tabs or Chrome from the foreground Activity, which is an allowed start.&lt;/li&gt;
&lt;li&gt;On Linux local filesystems, lines written this way don't interleave in practice. That isn't a POSIX guarantee, though: POSIX only promises write atomicity for pipes and FIFOs. If you need a stronger guarantee, use a lock, write-then-rename, or one spool file per writer.&lt;/li&gt;
&lt;li&gt;The queue accepts only &lt;code&gt;http&lt;/code&gt; and &lt;code&gt;https&lt;/code&gt;. Passing &lt;code&gt;file://&lt;/code&gt;, &lt;code&gt;content://&lt;/code&gt; or &lt;code&gt;intent://&lt;/code&gt; through a queue into a WebView would open a path to privilege escalation, so both the C writer and the RN reader validate.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Wall 2: shebang scripts on &lt;code&gt;PATH&lt;/code&gt; fail with "bad interpreter: Success"
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Symptom.&lt;/strong&gt; The first &lt;code&gt;xdg-open&lt;/code&gt; replacement was a shell script. Three shebangs were tried:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Version&lt;/th&gt;
&lt;th&gt;Shebang&lt;/th&gt;
&lt;th&gt;Result&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;v78&lt;/td&gt;
&lt;td&gt;&lt;code&gt;#!/system/bin/sh&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;bad interpreter: Success&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;v79&lt;/td&gt;
&lt;td&gt;&lt;code&gt;#!$HOME/bin/bash&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;same&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;v80&lt;/td&gt;
&lt;td&gt;&lt;code&gt;#!/system/bin/linker64 ...libbash.so&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;stopped before deploy after review predicted the same failure&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Cause.&lt;/strong&gt; The documented rule above. When you execute a script directly, the kernel checks exec permission on the script file itself before it ever starts the interpreter. A script in app data fails that check, so no shebang can help.&lt;/p&gt;

&lt;p&gt;An error that ends in "Success" tells you nothing useful. My guess is that &lt;code&gt;errno&lt;/code&gt; was overwritten by some other call before &lt;code&gt;strerror&lt;/code&gt; ran. That's an inference; I haven't verified it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fix.&lt;/strong&gt; v81 dropped scripts and used a native binary. It's written in C, built with the NDK clang using &lt;code&gt;-fPIE -pie&lt;/code&gt;, packaged as &lt;code&gt;jniLibs/arm64-v8a/libshelly_xdg_open.so&lt;/code&gt;, unpacked into app data by &lt;code&gt;LibExtractor&lt;/code&gt;, and linked from &lt;code&gt;.bashrc&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# simplified from the .bashrc that HomeInitializer.kt generates&lt;/span&gt;
&lt;span class="nb"&gt;ln&lt;/span&gt; &lt;span class="nt"&gt;-sf&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$SHELLY_LIB_DIR&lt;/span&gt;&lt;span class="s2"&gt;/shelly_xdg_open"&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$HOME&lt;/span&gt;&lt;span class="s2"&gt;/bin/xdg-open"&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;BROWSER&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$HOME&lt;/span&gt;&lt;span class="s2"&gt;/bin/xdg-open"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A native ELF on &lt;code&gt;PATH&lt;/code&gt; isn't enough by itself. The extracted file still sits in private app data, so the same exec rule applies to it. Shelly pairs these binaries with either the per-command &lt;code&gt;libexec_wrapper.so&lt;/code&gt; (see Wall 3) or an explicit linker64 launch.&lt;/p&gt;

&lt;p&gt;Five months later the same class of failure hit &lt;code&gt;$HOME/bin/shelly&lt;/code&gt;, which was still a &lt;code&gt;#!/system/bin/sh&lt;/code&gt; script. Any caller that didn't have the interactive shell function (&lt;code&gt;bash -c&lt;/code&gt;, &lt;code&gt;sh -c&lt;/code&gt;, a node &lt;code&gt;child_process&lt;/code&gt;) got:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.../home/bin/shelly: /system/bin/sh: bad interpreter: Permission denied
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The fix used the same pattern (&lt;code&gt;jni/shelly-cmd.c&lt;/code&gt; → &lt;code&gt;libshelly_cmd.so&lt;/code&gt; → symlink). On build 2818 (2026-11-03) it returned rc=0 in four contexts: inside &lt;code&gt;bash script.sh&lt;/code&gt;, under &lt;code&gt;sh -c&lt;/code&gt;, under &lt;code&gt;bash -c&lt;/code&gt;, and from node &lt;code&gt;spawnSync('shelly')&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wall 3: a bash wrapper, and why &lt;code&gt;./script.sh&lt;/code&gt; still fails
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Symptom.&lt;/strong&gt; To make &lt;code&gt;bash script.sh&lt;/code&gt; work, the first attempt put a &lt;code&gt;#!/system/bin/sh&lt;/code&gt; wrapper at &lt;code&gt;$HOME/bin/bash&lt;/code&gt;. It failed with &lt;code&gt;bad interpreter: Permission denied&lt;/code&gt; (2026-04-16).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cause.&lt;/strong&gt; The same rule as Wall 2. Both the wrapper script and the ELF behind it live in app data, so neither can be &lt;code&gt;execve()&lt;/code&gt;d directly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fix.&lt;/strong&gt; Replace the wrapper file with a shell function in &lt;code&gt;.bashrc&lt;/code&gt;, and never exec app-data ELFs directly. Hand them to the system dynamic linker:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Run binary via linker64 (SELinux blocks direct execve on app_data_file)&lt;/span&gt;
_run&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;1&lt;/span&gt;&lt;span class="k"&gt;:-}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt;
    /&lt;span class="k"&gt;*&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nv"&gt;LD_LIBRARY_PATH&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$SHELLY_LD_LIBRARY_PATH&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; /system/bin/linker64 &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$@&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="p"&gt;;;&lt;/span&gt;
    &lt;span class="k"&gt;*&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nb"&gt;printf&lt;/span&gt; &lt;span class="s1"&gt;'_run: first arg must be an absolute path, got: %s\n'&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;1&lt;/span&gt;&lt;span class="k"&gt;:-&lt;/span&gt;&lt;span class="p"&gt;(empty)&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&amp;amp;2&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;return &lt;/span&gt;64 &lt;span class="p"&gt;;;&lt;/span&gt;
  &lt;span class="k"&gt;esac&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;bash()&lt;/code&gt;, &lt;code&gt;node()&lt;/code&gt;, &lt;code&gt;git()&lt;/code&gt; and the other tool functions are built on &lt;code&gt;_run&lt;/code&gt;. Shell functions take priority over &lt;code&gt;PATH&lt;/code&gt;, so &lt;code&gt;bash -c '…'&lt;/code&gt; and &lt;code&gt;bash script.sh&lt;/code&gt; now work.&lt;/p&gt;

&lt;p&gt;Child processes changed along the way. Shelly used to set &lt;code&gt;LD_PRELOAD=libexec_wrapper.so&lt;/code&gt; for the whole PTY. When that interposer crashed, every new tab crashed before its prompt, so v180 removed the PTY-wide preload. Today the library is injected per command, only where it's needed: &lt;code&gt;git&lt;/code&gt;, &lt;code&gt;make&lt;/code&gt;, &lt;code&gt;vim&lt;/code&gt; and similar tools, plus &lt;code&gt;bash&lt;/code&gt; / &lt;code&gt;sh&lt;/code&gt; when the interactive shell calls them with a script or &lt;code&gt;-c&lt;/code&gt;. The library rewrites each child &lt;code&gt;execve()&lt;/code&gt; into a &lt;code&gt;linker64 /proc/self/fd/N&lt;/code&gt; launch.&lt;/p&gt;

&lt;p&gt;That removal broke something. A &lt;code&gt;shelly()&lt;/code&gt; function that still &lt;code&gt;execve()&lt;/code&gt;d the &lt;code&gt;$HOME/bin/bash&lt;/code&gt; symlink directly started failing with &lt;code&gt;Permission denied&lt;/code&gt; (bug #166), because it had been relying on the PTY-wide preload. The fix routed it through &lt;code&gt;_run&lt;/code&gt; like everything else (&lt;a href="https://github.com/RYOITABASHI/Shelly/commit/a9d403f1d868f6d37a6dc004bcc2a1da18882703" rel="noopener noreferrer"&gt;&lt;code&gt;a9d403f1d&lt;/code&gt;&lt;/a&gt;: the symptom was reproduced on the device and the fix implemented; that commit doesn't record a post-fix device check).&lt;/p&gt;

&lt;p&gt;Running a shebang script directly still fails. A device audit on 2026-08-17 got exit 126; the recorded essence of the output is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/usr/bin/env: bad interpreter: Permission denied
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So the project rule is: &lt;strong&gt;always run scripts as &lt;code&gt;bash script.sh&lt;/code&gt;&lt;/strong&gt;. When the script is an argument, bash just reads the file, and nothing checks the script's own exec permission.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wall 4: raw &lt;code&gt;node&lt;/code&gt; in generated agent scripts exits 126
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Symptom.&lt;/strong&gt; Shelly's autonomous agents run as shell scripts the app generates, and those scripts call &lt;code&gt;node&lt;/code&gt; and &lt;code&gt;curl&lt;/code&gt;. Calling &lt;code&gt;node&lt;/code&gt; directly in that context exited 126, which I attribute to the SELinux/W^X exec denial.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cause.&lt;/strong&gt; The &lt;code&gt;node()&lt;/code&gt; function in the interactive &lt;code&gt;.bashrc&lt;/code&gt; doesn't exist in a generated, non-interactive script. A bare &lt;code&gt;node&lt;/code&gt; resolves to the app-data ELF on &lt;code&gt;PATH&lt;/code&gt; and calls &lt;code&gt;execve()&lt;/code&gt; on it directly, which is the same rule as Wall 3.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fix.&lt;/strong&gt; Put the same linker64 routing into the generated script and replace every &lt;code&gt;node&lt;/code&gt;/&lt;code&gt;curl&lt;/code&gt; call (script version 5 → 6):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;shelly_run_app_binary&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="nv"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$1&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nb"&gt;shift
  &lt;/span&gt;&lt;span class="nv"&gt;binary&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;shelly_app_binary_path &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$name&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="k"&gt;return &lt;/span&gt;127
  &lt;span class="nv"&gt;binary_dir&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;binary&lt;/span&gt;&lt;span class="p"&gt;%/*&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="nt"&gt;-x&lt;/span&gt; /system/bin/linker64 &lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then
    &lt;/span&gt;&lt;span class="nv"&gt;LD_LIBRARY_PATH&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;SHELLY_LD_LIBRARY_PATH&lt;/span&gt;&lt;span class="k"&gt;:-${&lt;/span&gt;&lt;span class="nv"&gt;SHELLY_LIB_DIR&lt;/span&gt;&lt;span class="k"&gt;:-&lt;/span&gt;&lt;span class="nv"&gt;$binary_dir&lt;/span&gt;&lt;span class="k"&gt;}}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; /system/bin/linker64 &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$binary&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$@&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nv"&gt;$?&lt;/span&gt;
  &lt;span class="k"&gt;fi&lt;/span&gt;
  &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$binary&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$@&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
shelly_node&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt; shelly_run_app_binary node &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$@&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If &lt;code&gt;/system/bin/linker64&lt;/code&gt; is missing, the helper falls back to running &lt;code&gt;"$binary"&lt;/code&gt; directly, which would hit the same rule.&lt;/p&gt;

&lt;p&gt;A note on diagnosis: exit 126 means "found but not executable", and that has many causes (missing mode bits, a &lt;code&gt;noexec&lt;/code&gt; mount, a bad interpreter, a wrong binary format, and so on). By itself it doesn't prove an SELinux denial. To check for one, run &lt;code&gt;adb logcat | grep 'avc: denied'&lt;/code&gt; from a PC; the app can't read its own &lt;code&gt;avc&lt;/code&gt; lines.&lt;/p&gt;

&lt;h2&gt;
  
  
  A checklist from Shelly's constraints
&lt;/h2&gt;

&lt;p&gt;The usual first choice is an official mechanism. For talking between apps or processes: explicit Intents, PendingIntent, a bound Service over Binder, or a ContentProvider. For native code: load it through JNI, or run files that the package manager installed from &lt;code&gt;jniLibs&lt;/code&gt; into &lt;code&gt;ApplicationInfo.nativeLibraryDir&lt;/code&gt;, which is the documented place where an app may execute its own native files.&lt;/p&gt;

&lt;p&gt;Shelly's case is narrower. It's installed with packaging that leaves &lt;code&gt;jniLibs&lt;/code&gt; inside the APK instead of extracting them, and on this device &lt;code&gt;nativeLibraryDir&lt;/code&gt; was empty. v49 tried to use it and v53 gave up. So the list below is what Shelly chose under those conditions:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;On this device, app-data ELFs could be launched through &lt;code&gt;linker64&lt;/code&gt;.&lt;/strong&gt; Wrap &lt;code&gt;/system/bin/linker64 &amp;lt;absolute path&amp;gt; args…&lt;/code&gt; in one function or helper, and reject relative paths with a clear error. This is a device-dependent workaround I observed, not a public or portable API: it only covers 64-bit bionic ELFs, it has PIE and linker-namespace constraints, and an OS update could change it. In later work, starting glibc's &lt;code&gt;ld.so&lt;/code&gt; through linker64 failed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Only native binaries go on &lt;code&gt;PATH&lt;/code&gt;, paired with a linker64 launch.&lt;/strong&gt; A script on &lt;code&gt;PATH&lt;/code&gt; fails the first time anything execs it directly.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pass scripts as arguments.&lt;/strong&gt; Use &lt;code&gt;bash script.sh&lt;/code&gt; or &lt;code&gt;linker64 libbash.so script.sh&lt;/code&gt;, and never depend on shebang resolution.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A file queue for shell → app signals is a same-UID, limited-purpose design choice.&lt;/strong&gt; Validate on both the writer and reader side.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Apply the same rules to generated scripts and child processes.&lt;/strong&gt; Interactive shell functions don't carry over to them.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Don't swallow exit codes.&lt;/strong&gt; A helper that prints "opened" without checking the result hides a platform limit for months.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Limits of this report
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;N=1.&lt;/strong&gt; Only a Galaxy Z Fold6 was tested. The Android version isn't even consistent in the project's own records: the 2026-05-08 commit says Android 14, while other notes on the same device from April 2026 onward say Android 16.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Knox-specific restrictions aren't verified.&lt;/strong&gt; Walls 2–4 are explained by the documented AOSP rule, but nothing was tested on non-Samsung hardware. The cause of Wall 1 is unknown.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No &lt;code&gt;avc: denied&lt;/code&gt; lines&lt;/strong&gt; for these four cases were kept. The mapping of each failure to a rule is inferred from the official spec and the observed behavior.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A file queue only works while the app is running.&lt;/strong&gt; The 250 ms RN poll stops when the app is in the background. A different feature hit exactly that timeout and moved to a native &lt;code&gt;FileObserver&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Not every path is covered.&lt;/strong&gt; A &lt;code&gt;shelly&lt;/code&gt; call from a parent that doesn't load the exec wrapper (for example, a &lt;code&gt;/system/bin/sh&lt;/code&gt; invoked by full path) still can't execute.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://developer.android.com/about/versions/10/behavior-changes-10" rel="noopener noreferrer"&gt;Behavior changes: apps targeting Android 10&lt;/a&gt; ("Removed execute permission for app home directory")&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/RYOITABASHI/Shelly/commit/1c367c474821e3df50aeb86344816f6d1ef4171c" rel="noopener noreferrer"&gt;&lt;code&gt;1c367c474&lt;/code&gt;&lt;/a&gt;: native &lt;code&gt;xdg-open&lt;/code&gt; and the RN file queue&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/RYOITABASHI/Shelly/commit/65b07cb017bb58d4797b7430833c4e0fca26d52e" rel="noopener noreferrer"&gt;&lt;code&gt;65b07cb01&lt;/code&gt;&lt;/a&gt;: shebang bash wrapper replaced by a shell function&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/RYOITABASHI/Shelly/commit/bf643629ad3c1bfa848c22438a11673f766f8d53" rel="noopener noreferrer"&gt;&lt;code&gt;bf643629a&lt;/code&gt;&lt;/a&gt;: agent scripts routed through linker64&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/RYOITABASHI/Shelly/commit/a9d403f1d868f6d37a6dc004bcc2a1da18882703" rel="noopener noreferrer"&gt;&lt;code&gt;a9d403f1d&lt;/code&gt;&lt;/a&gt;: &lt;code&gt;shelly()&lt;/code&gt; routed through &lt;code&gt;_run&lt;/code&gt; (bug #166)&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/RYOITABASHI/Shelly/commit/14d020c85a008db41f3c2187fa33bd0f4f6e23e0" rel="noopener noreferrer"&gt;&lt;code&gt;14d020c85&lt;/code&gt;&lt;/a&gt;: native &lt;code&gt;shelly&lt;/code&gt; PATH shim&lt;/li&gt;
&lt;li&gt;Sources: &lt;a href="https://github.com/RYOITABASHI/Shelly/blob/main/modules/terminal-emulator/android/src/main/jni/shelly-xdg-open.c" rel="noopener noreferrer"&gt;&lt;code&gt;shelly-xdg-open.c&lt;/code&gt;&lt;/a&gt;, &lt;a href="https://github.com/RYOITABASHI/Shelly/blob/main/modules/terminal-emulator/android/src/main/jni/shelly-cmd.c" rel="noopener noreferrer"&gt;&lt;code&gt;shelly-cmd.c&lt;/code&gt;&lt;/a&gt;, &lt;a href="https://github.com/RYOITABASHI/Shelly/blob/main/modules/terminal-emulator/android/src/main/jni/shelly-glibc-exec.c" rel="noopener noreferrer"&gt;&lt;code&gt;shelly-glibc-exec.c&lt;/code&gt;&lt;/a&gt;, &lt;a href="https://github.com/RYOITABASHI/Shelly/blob/main/modules/terminal-emulator/android/src/main/java/expo/modules/terminalemulator/LibExtractor.kt" rel="noopener noreferrer"&gt;&lt;code&gt;LibExtractor.kt&lt;/code&gt;&lt;/a&gt;, &lt;a href="https://github.com/RYOITABASHI/Shelly/blob/main/modules/terminal-emulator/android/src/main/java/expo/modules/terminalemulator/HomeInitializer.kt" rel="noopener noreferrer"&gt;&lt;code&gt;HomeInitializer.kt&lt;/code&gt;&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Drafted with AI assistance; facts checked against the repository by the author.&lt;/em&gt;&lt;br&gt;
RYO ITABASHI · &lt;a href="https://github.com/RYOITABASHI/Shelly" rel="noopener noreferrer"&gt;github.com/RYOITABASHI/Shelly&lt;/a&gt;&lt;/p&gt;

</description>
      <category>android</category>
      <category>selinux</category>
      <category>linux</category>
      <category>security</category>
    </item>
    <item>
      <title>How to let ChatGPT operate your Android phone (open source, and you approve every action)</title>
      <dc:creator>RYO ITABASHI</dc:creator>
      <pubDate>Wed, 28 Oct 2026 04:54:09 +0000</pubDate>
      <link>https://dev.to/ryoitabashi/how-to-let-chatgpt-operate-your-android-phone-open-source-and-you-approve-every-action-1mi6</link>
      <guid>https://dev.to/ryoitabashi/how-to-let-chatgpt-operate-your-android-phone-open-source-and-you-approve-every-action-1mi6</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fvafxzz0to7a4dba3l8ys.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fvafxzz0to7a4dba3l8ys.gif" alt="ChatGPT asks the phone to save a Spotify playlist; one tap approves it on the phone; Spotify runs on a hidden screen; ChatGPT reports back" width="300" height="737"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The ChatGPT app can't touch your phone. But its Codex mode can drive a machine you pair with it, and that machine can be the phone itself. This post shows how to set that up with &lt;strong&gt;Shelly&lt;/strong&gt;, an open-source Android terminal, so ChatGPT can run commands and phone-app tasks on your device. Every phone action waits for your approval on the phone.&lt;/p&gt;

&lt;p&gt;Everything here runs on the phone. No PC, no Termux, no root.&lt;/p&gt;

&lt;h2&gt;
  
  
  What you need
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;An &lt;strong&gt;arm64 Android phone&lt;/strong&gt;. I develop on a Galaxy Z Fold6; other devices aren't verified yet.&lt;/li&gt;
&lt;li&gt;A &lt;strong&gt;ChatGPT account&lt;/strong&gt; with access to Codex in the ChatGPT app.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Shelly&lt;/strong&gt; (GPL-3.0): APK from &lt;a href="https://github.com/RYOITABASHI/Shelly/releases" rel="noopener noreferrer"&gt;GitHub Releases&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;For tasks inside other apps (Spotify, Maps…): the &lt;strong&gt;ClosePaw Shelly build&lt;/strong&gt; from &lt;a href="https://github.com/RYOITABASHI/closepaw/releases" rel="noopener noreferrer"&gt;its releases page&lt;/a&gt;, plus &lt;strong&gt;Shizuku&lt;/strong&gt;. Terminal-only tasks don't need these.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 1: Install Shelly and sign in to Codex
&lt;/h2&gt;

&lt;p&gt;Install the APK and allow "All files access" on first launch. Then, in Shelly's terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;codex
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you're not signed in yet, Shelly starts ChatGPT's device-code login in its built-in browser pane. It uses your ChatGPT subscription, not an API key.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Pair the phone with the ChatGPT app
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;shelly codex pair
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This runs the official &lt;code&gt;codex remote-control&lt;/code&gt; on the phone and prints a pairing code. In the ChatGPT app, open Codex, add a remote machine, and enter the code. The phone now shows up as a machine in ChatGPT.&lt;/p&gt;

&lt;p&gt;To keep the connection alive across app restarts and network changes, turn on &lt;strong&gt;Settings → Codex Login → Keep ChatGPT connected&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Ask for something
&lt;/h2&gt;

&lt;p&gt;Plain terminal tasks work right away:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;On this phone, show me how much free storage is left. Reply in English.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;For a task inside another app, name the tool so Codex knows how to reach the phone's UI:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;On this phone, open the Spotify app and save the playlist "Grunge Forever" to my library. Use &lt;code&gt;shelly closepaw --wait&lt;/code&gt;. Reply in English.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Codex runs &lt;code&gt;shelly closepaw --wait "&amp;lt;goal&amp;gt;"&lt;/code&gt; in the phone's terminal. Shelly then posts a notification asking &lt;strong&gt;you&lt;/strong&gt; to approve. Approve it (the notification needs the device unlocked), and ClosePaw operates Spotify on a background virtual display while your screen stays yours. When it finishes, the result goes back to ChatGPT, which tells you what happened.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why approval lives on the phone
&lt;/h2&gt;

&lt;p&gt;If ChatGPT could approve its own actions, a web page it read could quietly add "…and also do this", and nobody would see it happen. So:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Only the phone owner can approve: the notification button (with the device unlocked), or &lt;code&gt;approve &amp;lt;hash&amp;gt;&lt;/code&gt; typed in Shelly's own chat.&lt;/li&gt;
&lt;li&gt;ChatGPT can't approve. Writing an "approved" file from the shell doesn't work either, because the one-time nonce exists only in Shelly's process memory.&lt;/li&gt;
&lt;li&gt;The result coming back has to come from the signature-pinned ClosePaw build and carry the request's nonce. It's passed to ChatGPT as data, not as instructions.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Prompt rules like "never approve yourself" aren't a security boundary. The approval has to live somewhere the model can't reach.&lt;/p&gt;

&lt;h2&gt;
  
  
  Things that tripped me up
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Codex gives up on quiet commands.&lt;/strong&gt; If a command prints nothing for about 10 seconds, Codex tends to end its turn. &lt;code&gt;shelly closepaw --wait&lt;/code&gt; prints progress lines and an explicit "keep waiting" so the result makes it back into the same chat turn.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Say "on this phone" and name the tool.&lt;/strong&gt; Without that, Codex looked for a Spotify plugin, or tried &lt;code&gt;am start&lt;/code&gt;, which Samsung's Knox blocks for apps.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ask for English explicitly&lt;/strong&gt; if your account usually answers in another language.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Limits, honestly
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Verified end-to-end on one device (N=1).&lt;/li&gt;
&lt;li&gt;Phone-app tasks depend on ClosePaw reading the screen. Long multi-step tasks (like adding 10 songs one by one) were unreliable in my tests. Short, concrete goals work best.&lt;/li&gt;
&lt;li&gt;The APK is big because it bundles bash, git, Python, Node and the Codex CLI.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Beyond ChatGPT
&lt;/h2&gt;

&lt;p&gt;Shelly is also a full terminal (bash, git, Python 3, Node.js, ssh, tmux, vim bundled), with multi-pane AI chat, local LLMs, and scheduled agents that wake on the phone's alarm and save sourced notes to Markdown or Obsidian.&lt;/p&gt;

&lt;p&gt;Source and releases: &lt;a href="https://github.com/RYOITABASHI/Shelly" rel="noopener noreferrer"&gt;github.com/RYOITABASHI/Shelly&lt;/a&gt;. Bug reports and results from other phones are very welcome.&lt;/p&gt;

</description>
      <category>android</category>
      <category>chatgpt</category>
      <category>opensource</category>
      <category>ai</category>
    </item>
    <item>
      <title>I Still Can't Write Code. But Now ChatGPT Can Drive My Phone — and It Can't Approve Itself.</title>
      <dc:creator>RYO ITABASHI</dc:creator>
      <pubDate>Fri, 16 Oct 2026 02:19:33 +0000</pubDate>
      <link>https://dev.to/ryoitabashi/i-still-cant-write-code-but-now-chatgpt-can-drive-my-phone-and-it-cant-approve-itself-48c7</link>
      <guid>https://dev.to/ryoitabashi/i-still-cant-write-code-but-now-chatgpt-can-drive-my-phone-and-it-cant-approve-itself-48c7</guid>
      <description>&lt;p&gt;Last month I wrote about the alarm that fired into nothing — how an agent I'd scheduled for 8am went off on time and then silently didn't run, and what it took before I'd trust a schedule again.&lt;/p&gt;

&lt;p&gt;This one is about handing that same phone to ChatGPT. Not "ChatGPT writes a script and I paste it." ChatGPT, in the ChatGPT app, asking my phone to do something, the phone doing it on a screen I'm not looking at, and the answer coming back into the chat.&lt;/p&gt;

&lt;h2&gt;
  
  
  What it looks like
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fz93jfo5czu9vy83lhkka.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fz93jfo5czu9vy83lhkka.gif" alt="ChatGPT asks, ClosePaw drives Google Maps in the background" width="560" height="437"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I typed one request into the ChatGPT app: save the top-rated vintage stores near Shimokitazawa to a Google Maps list. On the right, my phone asks me to approve once. Then Google Maps starts moving on its own in the bottom-right pane — a background virtual display, not my screen — and a minute later ChatGPT tells me which two stores it saved. The list is really there when I open Maps.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fpswhlo2jyt800bdtj6jx.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fpswhlo2jyt800bdtj6jx.gif" alt="One message from ChatGPT registers a daily agent; at 16:27 a note appears in Obsidian" width="560" height="437"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The second one is quieter and, honestly, the one I use more: one message from ChatGPT registers an agent that runs on the phone every day at 16:27, researches the latest AI papers with Perplexity, and drops a sourced English summary into Obsidian. No ChatGPT, no tap, at 16:27. Every day after that, too.&lt;/p&gt;

&lt;h2&gt;
  
  
  How the pieces fit
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;ChatGPT → Shelly.&lt;/strong&gt; The ChatGPT app can drive Codex remote control on a machine you pair it with. Shelly already ships Codex natively, so it can host that on the phone itself: &lt;code&gt;shelly codex pair --background&lt;/code&gt;, and from the ChatGPT app the phone is just another machine. Commands ChatGPT runs land in Shelly's real Android PTY.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Shelly → ClosePaw.&lt;/strong&gt; Shelly doesn't tap screens. &lt;a href="https://github.com/RYOITABASHI/closepaw/releases" rel="noopener noreferrer"&gt;ClosePaw&lt;/a&gt; does — an agent that looks at the screen and operates apps. I forked it so that a request from Shelly (and only Shelly, pinned by signing certificate) runs on a Shizuku virtual display without opening ClosePaw or asking ClosePaw's own confirmation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Back to ChatGPT.&lt;/strong&gt; &lt;code&gt;shelly closepaw --wait "&amp;lt;goal&amp;gt;"&lt;/code&gt; blocks until I approve and ClosePaw finishes, then prints what ClosePaw reported. ChatGPT reads that and answers.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The part I cared about most
&lt;/h2&gt;

&lt;p&gt;If ChatGPT can drive the phone, ChatGPT can also, in principle, do the whole loop by itself: ask, approve, act. A web page it reads could say "also run this," and nobody would ever look.&lt;/p&gt;

&lt;p&gt;So a hand-off to ClosePaw always waits for &lt;strong&gt;one approval on the phone&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the notification's Approve button, which requires unlocking the device, or&lt;/li&gt;
&lt;li&gt;typing &lt;code&gt;approve &amp;lt;hash8&amp;gt;&lt;/code&gt; in Shelly's own chat.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;ChatGPT can't approve. Writing an "approved" file from the terminal doesn't work either — the one-time nonce only lives in Shelly's process memory. I considered "let ChatGPT ask me, and I'll type yes in ChatGPT," and dropped it: the thing that finally sends that "yes" to the phone is ChatGPT itself.&lt;/p&gt;

&lt;p&gt;The result that comes back is checked too: it has to come from the signature-pinned ClosePaw build, carry the request's own one-time 128-bit nonce, and on Android 14+ the sender package has to match. The text itself is treated as data — control and bidi characters stripped — not as instructions.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the demo shoot found
&lt;/h2&gt;

&lt;p&gt;It took about eight takes. Each one broke something I would otherwise have shipped:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The first version never told ChatGPT the result. ClosePaw finished; ChatGPT kept saying "waiting for approval." A demo where you can't see the result isn't a demo.&lt;/li&gt;
&lt;li&gt;Approving from the notification yanked Shelly full-screen and wrecked the split screen. Now the approval is handled in the background.&lt;/li&gt;
&lt;li&gt;I said "with Perplexity" and the agent quietly picked something else on its scheduled run — the named tool was being dropped at confirm time.&lt;/li&gt;
&lt;li&gt;I asked in English and got Japanese summaries, because my profile memory is Japanese. The task's own language now wins.&lt;/li&gt;
&lt;li&gt;gpt-4.1-mini, driving ClosePaw, got lost saving three stores. gpt-4.1 and two stores worked.&lt;/li&gt;
&lt;li&gt;At one point I tapped the "show the background screen" button and LINE opened, chat list and all, mid-recording. That take is gone.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What I still can't do
&lt;/h2&gt;

&lt;p&gt;Write the Kotlin that holds this together. Promise that the virtual display trick works the same on every phone. Tell you whether OpenAI's remote-control host reconnects on its own when my phone hops from Wi-Fi to LTE — I'm finding that out this week.&lt;/p&gt;

&lt;p&gt;What I can do is notice when the demo looks good and the result isn't actually there, and refuse to post it until it is.&lt;/p&gt;

&lt;p&gt;GitHub: &lt;a href="https://github.com/RYOITABASHI/Shelly" rel="noopener noreferrer"&gt;github.com/RYOITABASHI/Shelly&lt;/a&gt; — v8.1.0, GPLv3. ClosePaw's Shelly build: &lt;a href="https://github.com/RYOITABASHI/closepaw/releases" rel="noopener noreferrer"&gt;RYOITABASHI/closepaw releases&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>agents</category>
      <category>ai</category>
      <category>automation</category>
      <category>chatgpt</category>
    </item>
    <item>
      <title>I Still Can't Write Code. But I Finally Found Why the Alarm Fired and Nothing Happened.</title>
      <dc:creator>RYO ITABASHI</dc:creator>
      <pubDate>Fri, 04 Sep 2026 08:21:01 +0000</pubDate>
      <link>https://dev.to/ryoitabashi/i-still-cant-write-code-but-i-finally-found-why-the-alarm-fired-and-nothing-happened-2ano</link>
      <guid>https://dev.to/ryoitabashi/i-still-cant-write-code-but-i-finally-found-why-the-alarm-fired-and-nothing-happened-2ano</guid>
      <description>&lt;p&gt;Back in July I wrote about the moment my phone started waking itself up at 8am to run an agent I'd registered from a home screen widget. I was proud of that post. AlarmManager, &lt;code&gt;setExactAndAllowWhileIdle&lt;/code&gt;, fires through Doze, screen off, phone face down on the nightstand — I said all of that with a straight face like I'd earned the right to.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F5tcwdrw9yixq05qlnrtf.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F5tcwdrw9yixq05qlnrtf.jpg" alt="Image The agent registration dialog: '@agent every day at 8am summarize the news and notify me'" width="799" height="295"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then, weeks later, on the same phone, at the registered time: nothing. No notification. No log line. The agent just didn't run.&lt;/p&gt;

&lt;h2&gt;
  
  
  The alarm that fires into nothing
&lt;/h2&gt;

&lt;p&gt;Here's the thing about "I still can't write code" — I also can't read a stack trace and know I'm looking at the right one. What I can do is ask for &lt;code&gt;dumpsys alarm&lt;/code&gt;, read what comes back, and notice when it doesn't match what actually happened.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;dumpsys alarm&lt;/code&gt; said the alarm fired. Right time, right entry, no complaints. But the receiver that was supposed to wake up and run the agent never printed its first log line. Not late. Not with an error. It just never ran, as if the alarm had gone off inside an empty room.&lt;/p&gt;

&lt;p&gt;Tapping the same agent's "run now" button from the app worked instantly. So the agent itself wasn't broken. Something between "the OS decided to fire the alarm" and "code in my app actually executes" was failing, silently, only when the phone had been left alone for a while.&lt;/p&gt;

&lt;p&gt;I had it walk me through what was actually happening under the hood, because "trust me, it's fixed" isn't something I'm willing to write in a post title.&lt;/p&gt;

&lt;h2&gt;
  
  
  The setup that looks correct and isn't
&lt;/h2&gt;

&lt;p&gt;The alarm was wired the way basically every tutorial tells you to wire it: &lt;code&gt;AlarmManager&lt;/code&gt; fires a &lt;code&gt;PendingIntent&lt;/code&gt; that targets a &lt;code&gt;BroadcastReceiver&lt;/code&gt;, and that receiver's job is just to call &lt;code&gt;startForegroundService()&lt;/code&gt; and hand off to where the real work happens.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;AlarmManager --(exact &amp;amp; allow-while-idle)--&amp;gt; BroadcastReceiver.onReceive()
                                                  --&amp;gt; startForegroundService(...)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Reasonable. Conventional. And, on Android 14 with Samsung's One UI on top, apparently optional. If the app's process had been sitting frozen in the background for a while, the system fired the alarm and then just... didn't guarantee the broadcast would reach a receiver in a process that isn't currently alive enough to care. AlarmManager kept its promise. The broadcast didn't keep its promise. Nobody threw an exception about it, because from the OS's point of view, nothing went wrong.&lt;/p&gt;

&lt;h2&gt;
  
  
  The fix, in the version I can actually explain
&lt;/h2&gt;

&lt;p&gt;The fix is to stop routing through the receiver at all. Point the alarm's &lt;code&gt;PendingIntent&lt;/code&gt; straight at the Foreground Service:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="k"&gt;private&lt;/span&gt; &lt;span class="k"&gt;fun&lt;/span&gt; &lt;span class="nf"&gt;runServicePendingIntent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Context&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;agentId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;intervalMs&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Long&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;cron&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="p"&gt;?&lt;/span&gt;
&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="nc"&gt;PendingIntent&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;intent&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Intent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;TerminalSessionService&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="k"&gt;class&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;java&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;apply&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;action&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;TerminalSessionService&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;ACTION_RUN_AGENT&lt;/span&gt;
        &lt;span class="nf"&gt;putExtra&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;TerminalSessionService&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;EXTRA_AGENT_ID&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;agentId&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="nf"&gt;putExtra&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;TerminalSessionService&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;EXTRA_INTERVAL_MS&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;intervalMs&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(!&lt;/span&gt;&lt;span class="n"&gt;cron&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;isNullOrBlank&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt; &lt;span class="nf"&gt;putExtra&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;TerminalSessionService&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;EXTRA_CRON&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cron&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;rc&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;getAgentRequestCode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;agentId&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Build&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;VERSION&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;SDK_INT&lt;/span&gt; &lt;span class="p"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="nc"&gt;Build&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;VERSION_CODES&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;O&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;PendingIntent&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getForegroundService&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;rc&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;intent&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;piFlags&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;PendingIntent&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getService&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;rc&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;intent&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;piFlags&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The way this was explained to me: when an exact-while-idle alarm targets a foreground service directly, the OS treats &lt;em&gt;starting that service&lt;/em&gt; as the privileged, wake-the-device action itself. There's no second hop where a broadcast has to successfully find its way to a receiver in a process the system doesn't feel like fully waking up. The delivery step that was quietly failing simply isn't there to fail anymore.&lt;/p&gt;

&lt;p&gt;Same phone, same scenario that used to go silent. It doesn't anymore.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Frhfpvacbu64osjgbxq8z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Frhfpvacbu64osjgbxq8z.png" alt="Image Before/after: routing through a BroadcastReceiver vs. targeting the Foreground Service directly" width="800" height="358"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What else it took to actually trust this
&lt;/h2&gt;

&lt;p&gt;A fix that only works in the one scenario I happened to catch isn't a fix, it's a patch on a symptom. A few more things had to be true before I'd trust a schedule with something I actually care about:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The screen stays off, the work still has to finish.&lt;/strong&gt; A &lt;code&gt;PARTIAL_WAKE_LOCK&lt;/code&gt; keeps the CPU up while the agent runs — with an explicit timeout, so a future bug in releasing it costs 35 minutes of battery, not the rest of the day.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Rebooting the phone clears every alarm.&lt;/strong&gt; That's documented Android behavior, and it's exactly the kind of thing that turns into a quiet, hard-to-notice regression. A boot receiver reloads whatever was scheduled and re-arms it — from native storage, specifically, because the JS side of the app isn't even running yet at that point in boot.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A broken agent shouldn't get to wake the phone forever.&lt;/strong&gt; Three failures in a row and it disables itself, alarm and all, instead of dutifully waking the device every morning to fail the same way.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Manual "run now" and the scheduled alarm can't share an identity&lt;/strong&gt;, or triggering one silently corrupts the other's saved schedule. Small detail, the kind that's invisible until it isn't.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;None of that was obvious to me going in. All of it came out of the same instinct that started this whole post: don't take "it worked once" as the finish line.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I still can't do
&lt;/h2&gt;

&lt;p&gt;Read Kotlin fluently enough to have spotted this myself. Tell you, from first principles, which Android OEM will be the next one to quietly break a contract the OS itself defined. Promise you this is the last silent failure mode in here — I'd be lying, and the whole point of this post is that I stopped believing "it worked once" a while ago.&lt;/p&gt;

&lt;p&gt;What I can do is notice when a thing that's supposed to happen at 8am doesn't, ask why in plain language until I get an answer I actually understand, and refuse to write a triumphant blog post about a schedule I haven't watched fail and come back from.&lt;/p&gt;

&lt;p&gt;GitHub: github.com/RYOITABASHI/Shelly — GPLv3. If your alarm doesn't fire either, I'd genuinely like to hear about it.&lt;/p&gt;

</description>
      <category>kotlin</category>
      <category>opensource</category>
      <category>ai</category>
      <category>android</category>
    </item>
  </channel>
</rss>
