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.

chore: stop pre-commit host tests that hang

leepokaiecc807f0412c
diff --git a/.githooks/pre-commit b/.githooks/pre-commit
index c5b0436f..8f332772 100755
--- a/.githooks/pre-commit
+++ b/.githooks/pre-commit
@@ -13,6 +13,15 @@ snapshot="$git_dir/precommit-snapshot"
lock="$git_dir/precommit.lock"
locked=""
+# Runs a command, and everything it starts, for at most $1 seconds: a hung test would otherwise hold
+# the commit, and every other commit waiting on the lock, until someone notices.
+within() {
+ perl -e '$s = shift; $pid = fork // die "fork: $!\n";
+ if (!$pid) { setpgrp; exec @ARGV or die "exec: $!\n" }
+ $SIG{ALRM} = sub { kill "KILL", -$pid; die "Still running after $s s, so a test hangs: stopped it.\n" };
+ alarm $s; waitpid $pid, 0; exit(($? >> 8) || ($? & 127))' "$@"
+}
+
staged_copy() {
[ -n "$locked" ] && return
until mkdir "$lock" 2>/dev/null; do
@@ -33,9 +42,9 @@ if touches '^(host/|packaging/(updates|engram)/|docs/reference/fixtures/remote-r
# CI's pinned memory runtime (fetched once): without it every test turn waits on installing one.
engram=$(python3 "$repo/packaging/engram/test-runtime.py")
(cd "$snapshot/host" && export CARGO_TARGET_DIR="$repo/host/target/precommit" CODYNC_TEST_ENGRAM="$engram" &&
- cargo fmt --check && cargo clippy --all-targets -- -D warnings && cargo test &&
- cargo test --test memory_e2e -- --ignored &&
- cargo test --bin codync-host native_memory_survives_restart -- --ignored)
+ cargo fmt --check && cargo clippy --all-targets -- -D warnings && cargo test --no-run &&
+ within 300 sh -c 'cargo test && cargo test --test memory_e2e -- --ignored &&
+ cargo test --bin codync-host native_memory_survives_restart -- --ignored')
fi
if touches '^apps/desktop/'; then
diff --git a/docs/guides/development.md b/docs/guides/development.md
index 5a846e73..6e6b9521 100644
--- a/docs/guides/development.md
+++ b/docs/guides/development.md
@@ -94,7 +94,8 @@ fetched once into `host/target/engram-test-runtime`), desktop, cloud and relay (
`npm test`), Linux screen helper formatting, and a parse of the macOS screen helper's Swift
sources (on macOS). It checks the staged files only, in a copy under `.git/precommit-snapshot`,
so other agents' uncommitted edits in the same checkout neither break nor rescue a commit; the
-host builds into `host/target/precommit`. The npm checks reuse each package's `node_modules`
+host builds into `host/target/precommit`, and its tests are stopped after 5 minutes so a hung
+test fails the commit instead of holding it. The npm checks reuse each package's `node_modules`
(run `npm ci` there first).
Left to CI: the iOS Kit tests (an iPhone simulator) and the platform builds (Linux screen