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.
Rust acpagent-client-protocolai-agentsai-assistantclaudeclaude-codecodexcoding-agentscursorgeminigemini-cligrok-bot-alternativeiosiphonelinuxmacosmcpopen-sourcerustself-hosted
ci: lighter, steadier checks (#222)
leepokaif2e9e3328cec
diff --git a/.githooks/pre-commit b/.githooks/pre-commitindex 0964e05b..b06f6c88 100755--- a/.githooks/pre-commit+++ b/.githooks/pre-commit@@ -4,6 +4,16 @@set -eustaged_files=$(git diff --cached --name-only)+# A merge brings in commits whose files were checked when they landed. Only a file that differs from+# both sides (a resolved conflict, or both sides' changes put together) is new here.+if git rev-parse -q --verify MERGE_HEAD >/dev/null; then+ ours_list=$(mktemp)+ theirs_list=$(mktemp)+ printf '%s\n' "$staged_files" | sort > "$ours_list"+ git diff --cached --name-only MERGE_HEAD | sort > "$theirs_list"+ staged_files=$(comm -12 "$ours_list" "$theirs_list")+ rm -f "$ours_list" "$theirs_list"+fitouches() { printf '%s\n' "$staged_files" | grep -Eq "$1"; }repo=$(git rev-parse --show-toplevel)@@ -59,7 +69,7 @@ if touches '^web/'; thenfifor dir in cloud relay discord private-relay; do- if touches "^(cloud/|relay/|discord/|private-relay/|docs/reference/fixtures/remote-relay-vectors\\.json)"; then+ if touches "^($dir/|docs/reference/fixtures/remote-relay-vectors\\.json)"; thenstaged_copyecho "Checking $dir (typecheck, test)..."ln -s "$repo/$dir/node_modules" "$snapshot/$dir/node_modules"diff --git a/.github/workflows/android.yml b/.github/workflows/android.ymlindex 4ffbcb6a..3164f3f7 100644--- a/.github/workflows/android.yml+++ b/.github/workflows/android.yml@@ -19,6 +19,11 @@ on:permissions:contents: read+# A newer push to the same PR supersedes the run in progress.+concurrency:+ group: ${{ github.workflow }}-${{ github.ref }}+ cancel-in-progress: ${{ github.event_name == 'pull_request' }}+jobs:build:runs-on: ubuntu-latest@@ -36,7 +41,9 @@ jobs:packages: platform-tools- run: sdkmanager "platforms;android-37.0" "build-tools;37.0.0"- uses: gradle/actions/setup-gradle@v4- - run: ./gradlew :core:test :app:testDebugUnitTest :app:assembleDebug :app:assembleDebugAndroidTest :app:assembleRelease :app:lintDebug+ # PRs run the tests, compile and lint. The minified release build (R8) runs once a change lands on+ # dev or main, before a tag ships it.+ - run: ./gradlew :core:test :app:testDebugUnitTest :app:assembleDebug :app:assembleDebugAndroidTest :app:lintDebug ${{ github.event_name != 'pull_request' && ':app:assembleRelease' || '' }}- uses: actions/upload-artifact@v4with:name: codync-android-debugdiff --git a/.github/workflows/host.yml b/.github/workflows/host.ymlindex d03fde54..cbafb46e 100644--- a/.github/workflows/host.yml+++ b/.github/workflows/host.yml@@ -30,14 +30,15 @@ jobs:- uses: Swatinem/rust-cache@v2with:workspaces: host+ - uses: taiki-e/install-action@v2+ with:+ tool: cargo-nextest- run: cargo fmt --all --check- run: cargo clippy --workspace --all-targets -- -D warnings- - if: runner.os != 'Windows'- run: cargo test --workspace- # Independent fixture hosts contend on process-global scan locks and Windows disk/process- # startup. Keep each test's async concurrency, but run the harness cases one at a time.- - if: runner.os == 'Windows'- run: cargo test --workspace -- --test-threads=1+ # Each test in its own process (`host/.config/nextest.toml`): fixture hosts share no+ # process-global locks, so Windows runs them side by side too, and a test that only passes+ # on a retry shows as FLAKY instead of failing the run. The host has no doctests.+ - run: cargo nextest run --workspace --profile cirelease:if: startsWith(github.ref, 'refs/tags/v')diff --git a/.github/workflows/kit.yml b/.github/workflows/kit.ymlindex 51895bdd..a401030b 100644--- a/.github/workflows/kit.yml+++ b/.github/workflows/kit.yml@@ -24,7 +24,9 @@ jobs:- name: Test on an iPhone simulatorrun: |DEVICE=$(xcrun simctl list devices available | grep -m1 -oE 'iPhone [^(]+\(([0-9A-F-]{36})\)' | grep -oE '[0-9A-F-]{36}')- xcodebuild test -scheme CodyncKit-Package -destination "platform=iOS Simulator,id=$DEVICE" -resultBundlePath "$RUNNER_TEMP/CodyncKit.xcresult" -quiet+ # A test that fails is run again, up to twice: a timing hiccup on a busy runner no longer fails+ # the whole run (the result bundle still records the retries).+ xcodebuild test -scheme CodyncKit-Package -destination "platform=iOS Simulator,id=$DEVICE" -resultBundlePath "$RUNNER_TEMP/CodyncKit.xcresult" -retry-tests-on-failure -test-iterations 3 -quiet- name: Report test failuresif: failure()run: |diff --git a/.github/workflows/release-desktop.yml b/.github/workflows/release-desktop.ymlindex 08b9f14e..9414795e 100644--- a/.github/workflows/release-desktop.yml+++ b/.github/workflows/release-desktop.yml@@ -21,11 +21,33 @@ concurrency:jobs:check:runs-on: ubuntu-latest+ outputs:+ package: ${{ steps.scope.outputs.package }}defaults:run:working-directory: apps/desktopsteps:- uses: actions/checkout@v4+ - name: Package on this run?+ id: scope+ env:+ EVENT: ${{ github.event_name }}+ BASE_REF: ${{ github.base_ref }}+ BASE_SHA: ${{ github.event.pull_request.base.sha }}+ # Tags, manual runs and release PRs into main always package. Other PRs package only when they+ # touch what the installers are built from: the main process, preload, build config, tools,+ # resources, dependencies. A renderer-only change is covered by typecheck, tests and the build.+ run: |+ if [ "$EVENT" != pull_request ] || [ "$BASE_REF" = main ]; then+ echo package=true >> "$GITHUB_OUTPUT"+ exit 0+ fi+ git fetch --no-tags --depth=1 origin "$BASE_SHA"+ if git diff --name-only FETCH_HEAD HEAD | grep -Eq '^(apps/desktop/(package(-lock)?\.json|electron-builder[^/]*|electron\.vite\.config\.ts|tools/|src/main/|src/preload/|src/shared/|resources/|native/)|\.github/workflows/release-desktop\.yml)'; then+ echo package=true >> "$GITHUB_OUTPUT"+ else+ echo package=false >> "$GITHUB_OUTPUT"+ fi- uses: actions/setup-node@v4with:node-version: 24@@ -46,7 +68,7 @@ jobs:needs: check# Fork PRs get no signing secrets, so they stop at check, Windows and Linux; the release PR into main# builds the Mac app before the tag.- if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository+ if: needs.check.outputs.package == 'true' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)runs-on: macos-26steps:- uses: actions/checkout@v4@@ -159,6 +181,7 @@ jobs:windows:needs: check+ if: needs.check.outputs.package == 'true'runs-on: windows-latestdefaults:run:@@ -216,6 +239,7 @@ jobs:linux:needs: check+ if: needs.check.outputs.package == 'true'strategy:matrix:include:diff --git a/docs/guides/development.md b/docs/guides/development.mdindex c11480a9..20b34fe9 100644--- a/docs/guides/development.md+++ b/docs/guides/development.md@@ -125,7 +125,16 @@ compile, links and anchors resolve). It checks the staged files only, in a copyso other agents' uncommitted edits in the same checkout neither break nor rescue a commit; thehost builds into `host/target/precommit`, and its tests are stopped after 5 minutes so a hungtest fails the commit instead of holding it. The npm checks reuse each package's `node_modules`-(run `npm ci` there first).+(run `npm ci` there first). Each worker package is checked only when its own folder (or the+shared relay vectors) changes. On a merge commit it checks only the files that differ from both+sides (resolved conflicts, or both sides' changes put together); what the merge brings in was checked+when it landed.++CI on a pull request: the host runs `cargo nextest run` with retries (a test that passes only on a+retry shows as FLAKY), iOS Kit retries a failing test up to twice, Android builds the minified release+APK only after a change lands on `dev` or `main`, and the desktop installers are built only when a PR+touches what they're made from (`src/main`, `src/preload`, `src/shared`, build config, tools,+resources, dependencies) or targets `main`; every desktop PR still typechecks, tests and builds.Left to CI: the iOS Kit tests (an iPhone simulator) and the platform builds (Linux screenhelper: GStreamer development packages; macOS: the `Screen` Xcode target against WebRTC).diff --git a/docs/guides/windows-testing.md b/docs/guides/windows-testing.mdindex 8962375a..bcb04182 100644--- a/docs/guides/windows-testing.md+++ b/docs/guides/windows-testing.md@@ -6,9 +6,10 @@ e2e); use the VM for a full e2e, or when a change or a bug depends on Windows it`cmd.exe`, `.cmd` shims, the service, timing). The VM slows the whole Mac down: start it for thecheck and stop it as soon as the check is done.-The Windows host CI runs `cargo test --workspace -- --test-threads=1`: fixture-hosts contend on process-global memory scan locks and disk/process startup.-Tests still exercise concurrent actors internally; assertions and timeouts stay unchanged.+Host CI runs `cargo nextest run --workspace --profile ci` on every OS (`host/.config/nextest.toml`):+each test runs in its own process, so fixture hosts no longer contend on process-global memory scan+locks and Windows runs them in parallel too. A test that fails and then passes on a retry is+reported as FLAKY instead of failing the run: fix it rather than lean on the retry.## The VMdiff --git a/host/.config/nextest.toml b/host/.config/nextest.tomlnew file mode 100644index 00000000..99025d46--- /dev/null+++ b/host/.config/nextest.toml@@ -0,0 +1,10 @@+# cargo-nextest, as CI runs it (`cargo nextest run --workspace --profile ci`).+# Each test runs in its own process, so fixture hosts no longer share process-global locks and+# can run side by side on every OS.++[profile.ci]+# A test that fails and then passes on a retry is reported as FLAKY, and the run still passes.+retries = 2+fail-fast = false+# Report a test after a minute; stop one that hangs after five.+slow-timeout = { period = "60s", terminate-after = 5 }diff --git a/host/src/agent/bot/lifecycle.rs b/host/src/agent/bot/lifecycle.rsindex 0d7975d0..e256bc96 100644--- a/host/src/agent/bot/lifecycle.rs+++ b/host/src/agent/bot/lifecycle.rs@@ -251,10 +251,15 @@ mod tests {// How Codex starts an MCP server.let grouped = spawn("my $pid = fork; if (!$pid) { setpgrp; sleep 30; exit } sleep 30");let detached = spawn("use POSIX (); my $pid = fork; if (!$pid) { POSIX::setsid(); sleep 30; exit } sleep 30");- tokio::time::sleep(Duration::from_millis(300)).await;+ // The children exist once perl has forked them: wait for that instead of a fixed pause,+ // which a busy CI runner can outlast.+ let deadline = tokio::time::Instant::now() + Duration::from_secs(10);+ while !background_work(detached.id()).await {+ assert!(tokio::time::Instant::now() < deadline, "the detached child never showed up");+ tokio::time::sleep(Duration::from_millis(50)).await;+ }assert!(!background_work(plain.id()).await);assert!(!background_work(grouped.id()).await);- assert!(background_work(detached.id()).await);for child in [plain, grouped, detached] {if let Some(pid) = child.id() {let _ = std::process::Command::new("/bin/kill").args(["-KILL", "--", &format!("-{pid}")]).status();diff --git a/host/src/chat/group/tests.rs b/host/src/chat/group/tests.rsindex 19fc9f81..5f925dbb 100644--- a/host/src/chat/group/tests.rs+++ b/host/src/chat/group/tests.rs@@ -75,6 +75,10 @@ use crate::hub::BotStatus;use std::path::PathBuf;use std::time::Duration;+/// How long a step may take before the test calls it stuck. Generous: fixture agents start as+/// real processes, and a busy CI runner (Windows above all) can take seconds to start one.+const WAIT: Duration = Duration::from_secs(30);+/// A host with agent bots `a` and `b` (the scripted fixture agent) and a group of both.struct Room {hub: Arc<Hub>,@@ -145,7 +149,7 @@ impl Room {}async fn settle(&self) {- tokio::time::timeout(Duration::from_secs(10), async {+ tokio::time::timeout(WAIT, async {loop {tokio::time::sleep(Duration::from_millis(300)).await;let idle = ["a", "b"].iter().all(|b| self.hub.runtime(b).status == BotStatus::Idle);@@ -286,7 +290,7 @@ async fn stop_ends_the_room_turn_before_the_next_speaker() {let room = Room::new();room.send("BLOCK everyone look", None).await;let hub = room.hub.clone();- tokio::time::timeout(Duration::from_secs(10), async {+ tokio::time::timeout(WAIT, async {while hub.runtime("a").status != BotStatus::Working {tokio::time::sleep(Duration::from_millis(20)).await;}@@ -307,7 +311,7 @@ async fn ask_busy_a(room: &Room) -> Entry {.await.unwrap();let hub = room.hub.clone();- tokio::time::timeout(Duration::from_secs(10), async {+ tokio::time::timeout(WAIT, async {while hub.runtime("a").status != BotStatus::Working {tokio::time::sleep(Duration::from_millis(20)).await;}@@ -316,7 +320,7 @@ async fn ask_busy_a(room: &Room) -> Entry {.expect("a starts its own turn");room.send("@a are you there", None).await;- tokio::time::timeout(Duration::from_secs(5), async {+ tokio::time::timeout(WAIT, async {loop {let entries = hub.store.history(&room.group, i64::MAX, 100).unwrap();if let Some(e) = entries.into_iter().find(|e| e.kind == "notice") {@@ -352,7 +356,7 @@ async fn stopping_a_busy_member_in_its_own_chat_keeps_its_room_answer() {ask_busy_a(&room).await;// The user frees `a` from its own chat: the answer the room was promised still comes.crate::api::dispatch(&room.hub, &Caller::Local, "stop", json!({"botId": "a"})).await.unwrap();- tokio::time::timeout(Duration::from_secs(10), async {+ tokio::time::timeout(WAIT, async {while room.replies(&main).is_empty() {tokio::time::sleep(Duration::from_millis(50)).await;}@@ -369,7 +373,7 @@ async fn a_late_answer_survives_newer_messages_and_sees_them() {let main = Lane::main(&room.group);ask_busy_a(&room).await;room.send("@b meanwhile check CI", None).await;- tokio::time::timeout(Duration::from_secs(10), async {+ tokio::time::timeout(WAIT, async {while room.replies(&main).is_empty() {tokio::time::sleep(Duration::from_millis(50)).await;}