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(host): use the dev cloud for every local build

leepokai644c62ba20d2
diff --git a/.github/workflows/host.yml b/.github/workflows/host.yml
index 8954cb51..90cade28 100644
--- a/.github/workflows/host.yml
+++ b/.github/workflows/host.yml
@@ -58,6 +58,7 @@ jobs:
# Vendored C (dbus) would call libgcc's outline atomics, which a static musl link lacks.
env:
CFLAGS_aarch64_unknown_linux_musl: -mno-outline-atomics
+ CODYNC_ENV: main # released hosts use the main cloud; local builds use dev
run: |
VERSION=$(python3 -c 'import tomllib; print(tomllib.load(open("Cargo.toml", "rb"))["package"]["version"])')
test "v$VERSION" = "$GITHUB_REF_NAME" || { echo 'Host version must match release tag'; exit 1; }
diff --git a/.github/workflows/release-desktop.yml b/.github/workflows/release-desktop.yml
index 760294b8..b05a8980 100644
--- a/.github/workflows/release-desktop.yml
+++ b/.github/workflows/release-desktop.yml
@@ -66,6 +66,8 @@ jobs:
security list-keychain -d user -s "$KEYCHAIN_FILE"
- name: Native pieces
+ env:
+ CODYNC_ENV: main # the bundled host uses the main cloud; local builds use dev
run: |
mkdir -p apps/desktop/build/native
# The host, universal.
diff --git a/docs/architecture/overview.md b/docs/architecture/overview.md
index 9bc6c44d..3dbcc11b 100644
--- a/docs/architecture/overview.md
+++ b/docs/architecture/overview.md
@@ -64,4 +64,4 @@ Remote screen uses the channel for signaling and WebRTC for media/input. Cloudfl
Application/host major versions must match. The channel wire version (`v=1`), pairing URL version (`v=3`) and the cloud health endpoint's service version are separate values.
-Debug iOS builds use `apps/shared/Config/dev.plist`; Release uses `main.plist`. The desktop app takes the same values through `apps/desktop/tools/account-config.mjs`. The host has no default cloud URL. Production fields are currently incomplete in checked-in configuration, so a successful Debug install is not production readiness. See [environments](../guides/environments-and-deployment.md).
+Debug iOS builds use `apps/shared/Config/dev.plist`; Release uses `main.plist`. The desktop app takes the same values through `apps/desktop/tools/account-config.mjs`. A local host defaults to the dev cloud; released hosts default to main. Production fields are currently incomplete in checked-in configuration, so a successful Debug install is not production readiness. See [environments](../guides/environments-and-deployment.md).
diff --git a/docs/guides/environments-and-deployment.md b/docs/guides/environments-and-deployment.md
index 74b427c9..82d7204e 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 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.
+The host's compiled default is dev (`https://dev-api.codync.dev`) for every local build, debug or release; only the release workflows build with `CODYNC_ENV=main` and get `https://api.codync.dev`. Local builds of every client are dev (iOS Debug, desktop `account-config.mjs dev`, any `cargo build`), and main is built only by CI, so they never mix. 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.
## Checked-in readiness
diff --git a/host/src/remote/cloud.rs b/host/src/remote/cloud.rs
index 97fe4ba8..313235e0 100644
--- a/host/src/remote/cloud.rs
+++ b/host/src/remote/cloud.rs
@@ -16,15 +16,18 @@ use std::sync::Mutex;
use std::time::Duration;
use tokio::sync::watch;
-/// The cloud a fresh host uses, matching the app's environment: debug builds (Xcode Debug)
-/// use dev, release builds use main. Unit tests have none, so they never reach a real cloud.
-pub const DEFAULT_CLOUD_URL: Option<&str> = if cfg!(test) {
- None
-} else if cfg!(debug_assertions) {
- Some("https://dev-api.codync.dev")
-} else {
- Some("https://api.codync.dev")
-};
+/// The cloud a fresh host uses: main only for builds made with `CODYNC_ENV=main` (the release
+/// workflows), dev for every local build, debug or release, like the apps built next to it.
+/// Unit tests have none, so they never reach a real cloud.
+fn default_cloud_url() -> Option<&'static str> {
+ if cfg!(test) {
+ None
+ } else if option_env!("CODYNC_ENV") == Some("main") {
+ Some("https://api.codync.dev")
+ } else {
+ Some("https://dev-api.codync.dev")
+ }
+}
/// How long one successful state pull keeps an account device allowed.
pub const LEASE_MS: i64 = 15 * 60 * 1000;
@@ -56,7 +59,7 @@ pub fn url(store: &Store) -> Option<String> {
std::env::var("CODYNC_CLOUD_URL")
.ok()
.or_else(|| store.kv_get("cloud_url"))
- .or_else(|| DEFAULT_CLOUD_URL.map(str::to_owned))
+ .or_else(|| default_cloud_url().map(str::to_owned))
.map(|u| u.trim_end_matches('/').to_owned())
.filter(|u| !u.is_empty())
}