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.

fix(dev): name the sandbox in the phone sign-in hint, and only make test accounts for sandboxes that exist

leepokaifc47ba726aec
diff --git a/apps/android/README.md b/apps/android/README.md
index 2658059a..a7d6c60f 100644
--- a/apps/android/README.md
+++ b/apps/android/README.md
@@ -154,7 +154,7 @@ and explicit HTTP links. Vosk/JNA and the checksum-verified English model have
notices in [voice-manifest.json](app/src/main/assets/licenses/voice-manifest.json).
That speech prototype does not establish full voice parity.
-AndroidX, Compose, CameraX, Glance, WorkManager, Firebase, Play app update / in-app review
+AndroidX, Compose, CameraX, Glance, WorkManager, Firebase, Play app update
and desugaring artifacts come from Google Maven. Other dependencies use the configured repositories.
AndroidX native libraries, Vosk and JNA are upstream artifacts; no custom native
crypto or camera library is introduced. WebRTC comes from the webrtc-sdk build of libwebrtc.
@@ -175,7 +175,7 @@ crypto or camera library is introduced. WebRTC comes from the webrtc-sdk build o
| Java API desugaring | 2.1.5 | [Android desugaring](https://developer.android.com/studio/write/java11-default-support-table), GPL-2.0 with Classpath Exception; CommonMark runtime support |
| Clerk Android | 1.1.11 | [Clerk SDK](https://github.com/clerk/clerk-android), MIT; native account sessions and browser/provider authentication |
| Firebase BOM / Google Services plugin | 34.19.0 / 4.5.0 | [Firebase Android](https://firebase.google.com/support/release-notes/android), Apache-2.0; FID registration and data-only FCM delivery |
-| Play app update / in-app review | 2.1.0 / 2.0.2 | [Play Core](https://developer.android.com/guide/playcore), [Play Core SDK Terms](https://developer.android.com/guide/playcore#license); the update notice and reminder, and the rating invitation |
+| Play app update | 2.1.0 | [Play Core](https://developer.android.com/guide/playcore), [Play Core SDK Terms](https://developer.android.com/guide/playcore#license); the update notice and reminder |
| WorkManager | 2.12.0 | [AndroidX Work](https://developer.android.com/jetpack/androidx/releases/work), Apache-2.0; bounded background registration retries |
| Glance | 1.2.0 | [AndroidX Glance](https://developer.android.com/jetpack/androidx/releases/glance), Apache-2.0; responsive native app widgets |
| CameraX | 1.6.2 | [AndroidX Camera](https://developer.android.com/jetpack/androidx/releases/camera), Apache-2.0; lifecycle-bound preview/analysis, minimum API 23, optional camera permission |
diff --git a/apps/android/app/src/main/kotlin/com/codync/android/NativeAccounts.kt b/apps/android/app/src/main/kotlin/com/codync/android/NativeAccounts.kt
index b72a91b2..a99acb9d 100644
--- a/apps/android/app/src/main/kotlin/com/codync/android/NativeAccounts.kt
+++ b/apps/android/app/src/main/kotlin/com/codync/android/NativeAccounts.kt
@@ -13,11 +13,11 @@ import com.clerk.api.sso.SSOCancellationException
import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
-import kotlinx.coroutines.flow.first
-import kotlinx.coroutines.withContext
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.collect
+import kotlinx.coroutines.flow.first
import kotlinx.coroutines.launch
+import kotlinx.coroutines.withContext
import java.io.File
import java.io.IOException
@@ -83,7 +83,7 @@ object NativeAccounts {
Clerk.isInitialized.first { it }
if (activeUserId() != null) return
when (val result = Clerk.auth.signInWithTicket(ticket)) {
- is ClerkResult.Failure -> throw SignInError(SignInFailure.Error, result.errorMessage, result.throwable)
+ is ClerkResult.Failure -> throw signInError(result)
is ClerkResult.Success -> result.value.createdSessionId?.let { requireSuccess(Clerk.auth.setActive(it)) }
}
}
diff --git a/apps/desktop/tools/dev.mjs b/apps/desktop/tools/dev.mjs
index 56c8b95d..4dac5e12 100644
--- a/apps/desktop/tools/dev.mjs
+++ b/apps/desktop/tools/dev.mjs
@@ -175,7 +175,7 @@ async function sandbox() {
if (account) {
appEnv.CODYNC_DEV_SIGN_IN_TICKET = account.token
console.log(` test account ${account.email}`)
- console.log(` sign a phone into it npm run phone-account -- --ios <simulator udid> | --android <adb serial>${flags.name ? ` --name ${name}` : ''}\n`)
+ console.log(` sign a phone into it npm run phone-account -- --ios <simulator udid> | --android <adb serial> --name ${name}\n`)
}
app = startApp(appEnv)
app.child.on('exit', (code) => stop(code ?? 0))
diff --git a/apps/desktop/tools/phone-account.mjs b/apps/desktop/tools/phone-account.mjs
index 4e37d64b..3db30472 100644
--- a/apps/desktop/tools/phone-account.mjs
+++ b/apps/desktop/tools/phone-account.mjs
@@ -4,12 +4,13 @@
// (iOS: the CODYNC_DEV_SIGN_IN_TICKET launch variable; Android: a file only adb's run-as can write). The main checkout's
// Codync Dev keeps your own account: there this needs an explicit --name.
import { spawnSync } from 'node:child_process'
-import { statSync } from 'node:fs'
+import { existsSync, statSync } from 'node:fs'
+import { homedir } from 'node:os'
import { basename, dirname, join, resolve } from 'node:path'
import { fileURLToPath } from 'node:url'
import { parseArgs } from 'node:util'
import { mintTicket } from './dev-account.mjs'
-import { sandboxName } from '../src/shared/dev-sandbox.ts'
+import { SANDBOX_PREFIX, sandboxName } from '../src/shared/dev-sandbox.ts'
const root = resolve(dirname(fileURLToPath(import.meta.url)), '../../..')
const { values: flags } = parseArgs({ options: { ios: { type: 'string' }, android: { type: 'string' }, name: { type: 'string' } } })
@@ -31,6 +32,8 @@ if (statSync(join(root, '.git')).isDirectory() && !flags.name) {
fail("The main checkout's Codync Dev keeps your own account. Run this from a worktree, or name a sandbox with --name <name>.")
}
const name = sandboxName(flags.name ?? basename(root))
+// `npm run dev -- --prune` finds a test account through its sandbox folder, so an account is only made for one.
+if (!existsSync(join(homedir(), SANDBOX_PREFIX + name, 'sandbox.json'))) fail(`No sandbox ${name}: start it first with npm run dev.`)
const account = await mintTicket(name)
if (!account) fail('No Clerk test key: set CODYNC_CLERK_SECRET_KEY in the main checkout\'s .env.development (see docs/guides/dev-app.md).')
diff --git a/apps/ios/App/AccountSession.swift b/apps/ios/App/AccountSession.swift
index f02d7672..2da722f0 100644
--- a/apps/ios/App/AccountSession.swift
+++ b/apps/ios/App/AccountSession.swift
@@ -39,6 +39,14 @@ final class AccountSession {
/// Clerk restores the persisted Keychain session during configuration. Don't offer a fresh sign-in
/// until that restore has completed, or an update can briefly look like a signed-out install.
var isReady: Bool { clerk?.isLoaded ?? true }
+ /// Waits up to `timeout` for that restore; false when it didn't finish in time or the task was cancelled.
+ func waitUntilReady(timeout: Duration) async -> Bool {
+ let deadline = ContinuousClock.now + timeout
+ while !isReady, !Task.isCancelled, ContinuousClock.now < deadline {
+ try? await Task.sleep(for: .milliseconds(100))
+ }
+ return isReady
+ }
/// The Codync cloud (accounts and the encrypted relay); nil in builds without one.
let cloudURL: URL?
var isSignedIn: Bool { userID != nil }
@@ -74,9 +82,7 @@ final class AccountSession {
/// A worktree's simulator signs into its sandbox's Clerk test account with a one-time token from
/// `npm run phone-account`, as the desktop sandbox does; only against Clerk's development instance, and only while signed out.
private func signInForDevelopment(ticket: String) async {
- guard let clerk else { return }
- for _ in 0..<200 where !clerk.isLoaded { try? await Task.sleep(for: .milliseconds(100)) }
- guard clerk.isLoaded, !isSignedIn else { return }
+ guard let clerk, await waitUntilReady(timeout: .seconds(20)), !isSignedIn else { return }
do {
let signIn = try await clerk.auth.signInWithTicket(ticket)
if let session = signIn.createdSessionId { try await clerk.auth.setActive(sessionId: session) }
diff --git a/apps/ios/App/AppStore+Shortcuts.swift b/apps/ios/App/AppStore+Shortcuts.swift
index 82dd5a96..8f87a7c8 100644
--- a/apps/ios/App/AppStore+Shortcuts.swift
+++ b/apps/ios/App/AppStore+Shortcuts.swift
@@ -23,12 +23,9 @@ extension AppStore {
/// Waits for Clerk to restore the account first: an intent can run before the scene's userID observer.
private func shortcutTarget(_ bot: ShortcutBotEntity) async throws -> (BotReference, BotStore) {
- let deadline = ContinuousClock.now + .seconds(10)
- while !account.isReady {
- guard ContinuousClock.now < deadline else { throw HostError.unreachable }
- try await Task.sleep(for: .milliseconds(100))
- }
+ let ready = await account.waitUntilReady(timeout: .seconds(10))
try Task.checkCancellation()
+ guard ready else { throw HostError.unreachable }
switchAccount(to: account.userID)
guard let ref = bot.reference(in: storage), let store = accounts.store(for: ref.computerId) else {
throw ShortcutError.botUnavailable
diff --git a/docs/guides/dev-app.md b/docs/guides/dev-app.md
index 3d88a47a..97c95998 100644
--- a/docs/guides/dev-app.md
+++ b/docs/guides/dev-app.md
@@ -32,7 +32,7 @@ Flags go after `npm run dev --`: `--shared` takes the default Codync Dev from a
A sandbox starts past onboarding (welcome and computer-access setup, only where the window hasn't chosen yet); `--onboarding` clears those two settings once per start, so the flow comes back (a signed-in sandbox passes the welcome screen by itself and lands on computer-access setup). With `CODYNC_CLERK_SECRET_KEY` (the Clerk **development** instance's `sk_test_...` key) in the git-ignored `.env.development` at the main checkout's root (copy `.env.development.example`) (every worktree reads that one file) or the environment, it also signs in its own Clerk test account `sandbox-<name>[email protected]`: `tools/dev-account.mjs` finds or creates that user through the Backend API and mints a one-time sign-in token, which `account.ts` trades for a session (`ticket` strategy, unpackaged Dev runs only). The token is minted at every start and used only while the sandbox has no active session; the app also requires a `pk_test_` publishable key, and the key never reaches the host or the agents. Keys that aren't `sk_test_` are refused. Without a key a sandbox starts signed out; it never borrows Codync Dev's login.
-Phones follow the same rule. In the main checkout, a simulator's or emulator's Codync Dev keeps your own account. From a worktree, `npm run phone-account -- --ios <simulator udid>` or `-- --android <adb serial>` (in `apps/desktop`, beside `npm run dev`) signs it into the sandbox's test account, so the phone sees the sandbox computer in its account (run the sandbox with `--cloud`). It mints a one-time token with the same `tools/dev-account.mjs`. On iOS the token goes in through the `CODYNC_DEV_SIGN_IN_TICKET` launch variable (`AccountSession.swift`). On Android it goes into a file that only adb's `run-as` can write (`NativeAccounts.signInForDevelopment`, debug builds only). Both apps trade it only against Clerk's development instance, and only while signed out. In the main checkout the tool needs an explicit `--name`.
+Phones follow the same rule. In the main checkout, a simulator's or emulator's Codync Dev keeps your own account. From a worktree, `npm run phone-account -- --ios <simulator udid>` or `-- --android <adb serial>` (in `apps/desktop`, beside `npm run dev`) signs it into the sandbox's test account, so the phone sees the sandbox computer in its account (run the sandbox with `--cloud`). It mints a one-time token with the same `tools/dev-account.mjs`. On iOS the token goes in through the `CODYNC_DEV_SIGN_IN_TICKET` launch variable (`AccountSession.swift`). On Android it goes into a file that only adb's `run-as` can write (`NativeAccounts.signInForDevelopment`, debug builds only). Both apps trade it only against Clerk's development instance, and only while signed out. In the main checkout the tool needs an explicit `--name`. It only signs into a sandbox that has run once, so `--prune` can delete its account; `npm run dev` prints the exact command.
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.
diff --git a/docs/guides/environments-and-deployment.md b/docs/guides/environments-and-deployment.md
index f35fdd62..a949e652 100644
--- a/docs/guides/environments-and-deployment.md
+++ b/docs/guides/environments-and-deployment.md
@@ -86,7 +86,7 @@ The repository is public, so its whole history counts as published. Last scan: 2
| `0001_init.sql` | applied | applied | — |
| `0002_windows_computers.sql` | 2026-10-07 | 2026-10-07 | dev `00000b79-00000000-000050fc-e6cb8fa431592b1c3d7824f3cf64afb9`, main `0000041d-0000085c-000050fc-fda9fcdf91e3498c08fa7c332a989e24` |
| `0003_desktop_devices.sql` | 2026-10-07 | 2026-10-07 | dev `00000cb2-00000002-000050fd-8600044ac4775783e20c8ff9b4d5fa14`, main `00000420-000012d2-000050fd-12871b6db16548f336c1c9221d28c556` |
-| `0004_android_devices.sql` | 2026-11-01 | with the next `dev` → `main` merge | dev `00003428-00000000-00005115-cc5e0e1311eab7918b2c9470a0e71611` |
+| `0004_android_devices.sql` | 2026-11-01 | not yet: apply by hand (neither the merge nor `deploy:main` runs migrations) | dev `00003428-00000000-00005115-cc5e0e1311eab7918b2c9470a0e71611` |
`0002` lets `computers.platform` be `windows` (Windows hosts register with `std::env::consts::OS`). SQLite can't change a CHECK, so it rebuilds `computers` together with `access_requests` and `grants`, the tables that reference it: dropping a referenced table while foreign keys are enforced would count every referencing row as a violation. Live schemas matched `0001` beforehand; row counts were unchanged afterwards (dev 24 computers, 8 grants, 14 access requests; main 101, 38, 48) with no orphaned rows. A signed `POST /v1/host/register` with `platform: "windows"` returned 200 on both (the probe rows were deleted). Main's Worker answered with the previous version for about 20 seconds after `deploy`.
diff --git a/docs/plans/android-app.md b/docs/plans/android-app.md
index 2c270b4a..d2af4e91 100644
--- a/docs/plans/android-app.md
+++ b/docs/plans/android-app.md
@@ -127,8 +127,8 @@ the Dynamic Island) with its feature graphic, per language.
The host accepts Android pairing (older hosts refuse it, and the app asks to update
Codync on the computer) and counts Android event streams as connected phones, so
pushes are held while one is open. The cloud accepts Android device records through
-the `0004_android_devices.sql` migration, applied to dev on 2026-11-01. Main gets it right after the next `dev` → `main`
-merge, together with that release's cloud deploy ([migration log](../guides/environments-and-deployment.md#migration-log)).
+the `0004_android_devices.sql` migration, applied to dev on 2026-11-01. Main gets it only when it is applied there by hand
+(`wrangler d1 migrations apply codync --remote` after a restore point; the merge and `deploy:main` run no migrations, [migration log](../guides/environments-and-deployment.md#migration-log)).
Until then, signed-in Android phones can't register with the production account. The push Worker needs the matching Firebase
service account as an external secret; the client configuration contains no private key.