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(desktop): keep the managed host on the app's cloud

leepokaiaaa2f64e8cfe
diff --git a/apps/desktop/src/renderer/store/cloud.ts b/apps/desktop/src/renderer/store/cloud.ts
index 9b18d333..4145f339 100644
--- a/apps/desktop/src/renderer/store/cloud.ts
+++ b/apps/desktop/src/renderer/store/cloud.ts
@@ -83,6 +83,8 @@ export class CloudModel extends Observable {
computers: CloudComputer[] = []
private registeredFor: string | null = null
private enablingCloud = false
+ /** Hosts already pointed at this app's cloud this run (a host-side env override can't be moved). */
+ private aligned = new Set<string>()
private autoClaiming = false
constructor(private app: AppModel) {
@@ -102,6 +104,7 @@ export class CloudModel extends Observable {
/** Re-evaluated on every account or store change. */
private tick() {
+ this.alignCloud()
const user = this.userId
if (!user) {
if (this.computers.length) {
@@ -155,6 +158,19 @@ export class CloudModel extends Observable {
.finally(() => (this.enablingCloud = false))
}
+ /**
+ * The host this app manages uses this build's cloud: a release host bundled into a dev app
+ * would otherwise sit on main while the app and a Debug iPhone sign in to dev.
+ */
+ private alignCloud() {
+ const store = this.app.local
+ const status = store?.cloud
+ if (!account.cloudURL || !store || store.connection.kind !== 'online' || !status?.enabled) return
+ if (status.url === account.cloudURL || this.aligned.has(store.computer.id)) return
+ this.aligned.add(store.computer.id)
+ void this.enableCloud(store).catch(() => {})
+ }
+
/** Signed in, this computer joins the account on its own, unless the user took it out of it. */
private autoClaim() {
const user = this.userId
@@ -243,9 +259,9 @@ export class CloudModel extends Observable {
}
}
- /** A host without a cloud URL of its own gets this app's. */
+ /** The host gets this app's cloud; a build without one keeps the host's. */
private async enableCloud(store: BotStore) {
- const url = store.cloud?.url ? null : account.cloudURL
+ const url = account.cloudURL
if (!store.cloud?.url && !url) throw new CloudError(400, 'badRequest', 'This build of Codync has no cloud to connect to.')
return (await store.ready()).call<CloudStatus>('setCloud', { enabled: true, url }, 30_000)
}
diff --git a/docs/guides/environments-and-deployment.md b/docs/guides/environments-and-deployment.md
index 8e8264df..74b427c9 100644
--- a/docs/guides/environments-and-deployment.md
+++ b/docs/guides/environments-and-deployment.md
@@ -12,7 +12,7 @@ Reviewed against repository configuration on 2026-09-26. Checked-in configuratio
| Cloud Worker / D1 / DO | `cloud/wrangler.toml` | Root production, `dev`, or `local` environment |
| APNs Worker | `relay/wrangler.toml` | Separate deployment and secrets; see [relay README](../../relay/README.md) |
-The host's compiled default follows its build profile like the app: debug builds use `https://dev-api.codync.dev`, release builds `https://api.codync.dev`. Override it with the Mac's **Reach from anywhere** control or `codync-host cloud --url <url>`. `codync-host cloud` displays status; `--disable` turns access off. App and host must point at the same intended cloud.
+The host's compiled default follows its build profile like the app: debug builds use `https://dev-api.codync.dev`, release builds `https://api.codync.dev`. Override it with the Mac's **Reach from anywhere** control or `codync-host cloud --url <url>`. `codync-host cloud` displays status; `--disable` turns access off. App and host must point at the same intended cloud. The desktop app enforces this for the host it manages: when that host's cloud is on but points elsewhere (a release host bundled into a dev build), the app switches it to the build's `account-config.json` cloud once per run.
## Checked-in readiness