Skip to content

Open source Grok Bot alternative, Bring your own agent and subscription: message Claude Code, Codex, Gemini CLI, Cursor, Copilot and 40+ AI agents as bots on your own computer, from iPhone, Mac, Windows, Linux or terminal. Agent-agnostic and free. Also a Muse and Dots alternative. Built in Rust.

docs: run one shared Android emulator at a time

leepokai61f4c5b2dfff
diff --git a/AGENTS.md b/AGENTS.md
index d1c175cb..521d268b 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -36,7 +36,7 @@ Keep only the latest build: in this checkout, Apple builds go to `build/dd` only
## End-to-end test every change
-After every change, test it end to end on the real apps, not just builds and unit tests: install the new build (old one stopped first) and walk through the changed flow. Drive the desktop app with Playwright (`npm run e2e` against the sandbox) and the iPhone app (iOS Simulator) and Android app (emulator) with one Maestro run (`apps/maestro`); Computer Use only for the native steps they can't reach: [test stack](docs/guides/test-stack.md). Report any check that could not run and why.
+After every change, test it end to end on the real apps, not just builds and unit tests: install the new build (old one stopped first) and walk through the changed flow. Drive the desktop app with Playwright (`npm run e2e` against the sandbox) and the iPhone app (iOS Simulator) and Android app (the one shared emulator, never a second: [test devices](docs/guides/dev-app.md#worktree-sandboxes)) with one Maestro run (`apps/maestro`); Computer Use only for the native steps they can't reach: [test stack](docs/guides/test-stack.md). Report any check that could not run and why.
- **Minimal e2e** (default): only the platform of the computer you test on (on the Mac: macOS).
- **Full e2e** (large changes: platform code, packaging, the desktop main process; or when asked): macOS, Linux (Lima `codync-linux`) and Windows (UTM, [Windows testing](docs/guides/windows-testing.md)). A platform whose VM isn't installed is skipped and reported, not set up.
diff --git a/CLAUDE.md b/CLAUDE.md
index e99b5d9e..b73d6376 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -62,7 +62,7 @@ Keep only the latest build: in this checkout, Apple builds go to `build/dd` only
## End-to-end test every change
-After every change, test it end to end on the real apps, not just builds and unit tests: install the new build (old one stopped first) and walk through the changed flow. Drive the desktop app with Playwright (`npm run e2e` against the sandbox) and the iPhone app (iOS Simulator) and Android app (emulator) with one Maestro run (`apps/maestro`); Computer Use only for the native steps they can't reach: [test stack](docs/guides/test-stack.md). Report any check that could not run and why.
+After every change, test it end to end on the real apps, not just builds and unit tests: install the new build (old one stopped first) and walk through the changed flow. Drive the desktop app with Playwright (`npm run e2e` against the sandbox) and the iPhone app (iOS Simulator) and Android app (the one shared emulator, never a second: [test devices](docs/guides/dev-app.md#worktree-sandboxes)) with one Maestro run (`apps/maestro`); Computer Use only for the native steps they can't reach: [test stack](docs/guides/test-stack.md). Report any check that could not run and why.
- **Minimal e2e** (default): only the platform of the computer you test on (on the Mac: macOS).
- **Full e2e** (large changes: platform code, packaging, the desktop main process; or when asked): macOS, Linux (Lima `codync-linux`) and Windows (UTM, [Windows testing](docs/guides/windows-testing.md)). A platform whose VM isn't installed is skipped and reported, not set up.
- **Desktop build to use**: develop and e2e with `npm run dev` in `apps/desktop` (renderer reloads on save, restart it after `src/main` or preload changes; nothing packaged or signed). In a linked worktree it runs a [sandbox](docs/guides/dev-app.md#worktree-sandboxes) beside the main checkout's Codync Dev (own host build, port and data); `--sandbox` does the same from the main checkout when another session's Codync Dev is running. In the main checkout, after a host change run `node tools/native-host.mjs dev` there first: `npm run dev` prefers that build over `host/target/debug`. Package `npm run dist:mac:dev` (about 45 s) only for what an unpackaged run lacks: the bundled host install, Codync Screen / computer use, system permissions. `dist:*:main` (universal, timestamped, minutes) only to check the production app.
diff --git a/apps/android/README.md b/apps/android/README.md
index a7d6c60f..ea96f56f 100644
--- a/apps/android/README.md
+++ b/apps/android/README.md
@@ -123,11 +123,12 @@ work.
```sh
./gradlew :app:assembleDebugAndroidTest
-ANDROID_SERIAL=emulator-5580 ./gradlew :app:connectedDebugAndroidTest
+./gradlew :app:connectedDebugAndroidTest
```
-Use a disposable emulator/application for ordinary instrumentation: it includes
-local reset and credential fixtures. Do not run it against a personal phone's
+Use the [shared test emulator](../../docs/guides/dev-app.md#worktree-sandboxes),
+under its lock, for ordinary instrumentation: it includes local reset and
+credential fixtures. Do not run it against a personal phone's
saved accounts. Mutating live suites require `fixtureComputerId` matching an
isolated fake-agent host. Shared vectors come from
[remote-relay-vectors.json](../../docs/reference/fixtures/remote-relay-vectors.json).
diff --git a/docs/guides/dev-app.md b/docs/guides/dev-app.md
index 89ed234b..801e3218 100644
--- a/docs/guides/dev-app.md
+++ b/docs/guides/dev-app.md
@@ -37,7 +37,7 @@ Phones follow the same rule. In the main checkout, a simulator's or emulator's C
Test devices for a worktree:
- **iPhone: a new simulator per worktree.** `npm run dev` prints `Codync <name>`'s udid once it exists, and before that the command that creates it (`xcrun simctl create "Codync <name>" "iPhone 17"`): run it once, since simctl allows two simulators of one name. Install the worktree's iOS Dev build on it and test only there. The simulator holds Codync Dev's Keychain (device keys, Clerk session), pairings and notification permission, so a fresh one starts clean, carries nothing into another worktree's test, never touches a simulator signed into your account, and lets agents test at once. Allow notifications again on it when a test needs them. `--prune` deletes it with the sandbox, so it goes when the worktree does.
-- **Android: the shared `codync_worktree` emulator, one test at a time.** Worktrees use only this AVD (Pixel 7, API 36 Google APIs, `hw.keyboard=yes` for the instrumented suite); your own Codync Dev stays on `codync_api36`, which they never touch. A new AVD per worktree would be slow to make and boot, so they take turns on the lock folder `/private/tmp/claude-$(id -u)/android-emulator.lock`: `mkdir -p` its parent, then `mkdir` the lock (it fails while another test holds it) and write your worktree's path into `owner` inside it; `rm -r` gives it back. A lock whose owner worktree is gone, or older than an hour, is stale: remove it and take it. Start from clean app data: `adb shell pm clear com.pokai.Codync.android.dev`, then `adb shell pm grant com.pokai.Codync.android.dev android.permission.POST_NOTIFICATIONS`.
+- **Android: one emulator on this Mac for now, `codync_worktree`, shared by every session.** Only one emulator runs at a time, main checkout included: never start a second AVD or make a new one, not even when the lock is held or another test is slow. This AVD (Pixel 7, API 36 Google APIs, `hw.keyboard=yes` for the instrumented suite) stays running between tests, so the next one needn't boot it. Your own Codync Dev stays on `codync_api36`, which only you start, in place of the shared one (`adb emu kill` first); while it runs, an agent's Android check waits or is reported as not run. Sessions take turns on the lock folder `/private/tmp/claude-$(id -u)/android-emulator.lock`: `mkdir -p` its parent, then `mkdir` the lock (it fails while another test holds it: wait) and write your worktree's path into `owner` inside it; `rm -r` gives it back. A lock whose owner worktree is gone, or older than an hour, is stale: remove it and take it. Holding the lock, check `adb devices` and start the AVD only if no emulator is listed. Start from clean app data: `adb shell pm clear com.pokai.Codync.android.dev`, then `adb shell pm grant com.pokai.Codync.android.dev android.permission.POST_NOTIFICATIONS`.
Still shared: macOS sees every unpackaged run as the same Electron app, so permissions and notifications are shared and a `codync-dev://` sign-in callback may reach another copy (test sign-in on the default Codync Dev); Codync Screen and computer use need the packaged `Codync Dev.app`; a global shortcut (the approval island's) goes to whichever app registered it first.