mirror of
https://github.com/block/buzz.git
synced 2026-08-18 06:50:31 +02:00
Refs #2062 This carries forward the relay-mesh recovery work from #2304 by @Bartok9 (cherry-picked with original authorship/sign-offs) and adds the startup/readiness supervision and packaging fixes found while validating it against a real two-machine Buzz setup. ## From #2304 - Watch the local OpenAI ingress (`:9337`) after launch and re-arm a stale relay-mesh runtime. - Require consecutive failed probes before eviction so a transient inference stall does not cause a cold restart. - Bound stale-runtime shutdown, preserve runtime identity across the asynchronous probe, and never evict a concurrent replacement. - Re-arm only for agents that are actually running; deliberately stopped agents stay stopped. - Persist an actionable sentinel error under the managed-agent store lock and clear only that error after recovery. - Treat serve-to-client fallback as an intentional fail-safe; configured serve restoration remains on its existing path. ## Added here - Use the inference ingress (`:9337`), rather than management port `:3131`, as Buzz's client-readiness boundary. A usable client no longer fails or holds agent-save open merely because management startup is still pending. - Supervise the embedded SDK startup asynchronously, publish a pending status while management is unavailable, and keep its mesh identity alive. - Avoid racing a replacement while SDK startup still owns the embedded runtime. If that pending startup later loses ingress while a running agent still needs it, request a controlled Buzz restart to reclaim the otherwise-unreachable SDK thread. - Defer roster-driven replacement while client management startup is pending. - Keep post-launch recovery in a dedicated module so the mesh entry point remains within the desktop file-size gate. - Explicitly mark generated Unix sidecars executable. On macOS, copying over an existing non-executable destination preserved its old mode, causing packaged `buzz-acp`, `buzz-agent`, and tool sidecars to be reported as missing. ## Validation Automated: - `just ci` — passed, including formatting, Clippy with warnings denied, desktop/web/mobile checks and tests, and builds. - Full Tauri mesh-feature suite — 1,702 passed, 0 failed, 15 ignored. - Mesh-feature Clippy with `-D warnings` — passed. - Release macOS app bundle with `mesh-llm` — built successfully; every bundled sidecar passed executable-mode and deep code-signature verification. Live two-machine E2E: - M5: released Buzz serving `unsloth/gemma-4-26B-A4B-it-GGUF:UD-Q4_K_M`. - Mac mini: this branch's packaged Buzz running a saved `buzz-agent`/relay-mesh agent. - Confirmed `:9337` accepted inference and the saved ACP harness started with no error while `:3131` was still unavailable. - Exact inference succeeded before restart (`CORRECTED-MINI-E2E-OK`). - Bespoke Buzz shut down cleanly in 2.3s, then restored ingress and the saved harness in 18.8s while `:3131` was still unavailable. - Exact inference succeeded after restart (`AFTER-RESTART-E2E-OK`). - A real Buzz `@C55` message traversed desktop → `buzz-acp` → `buzz-agent` → mini `:9337` → M5 compute and published the requested reply successfully. --------- Signed-off-by: Bartok9 <danielrpike9@gmail.com> Signed-off-by: Michael Neale <michael.neale@gmail.com> Co-authored-by: Bartok9 <danielrpike9@gmail.com> Co-authored-by: Michael Neale <michael.neale@gmail.com>
49 lines
1.6 KiB
Bash
Executable File
49 lines
1.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
SIDECARS=(buzz-acp buzz-agent buzz-dev-mcp git-credential-nostr buzz)
|
|
HOST=$(rustc -vV | sed -n 's|host: ||p')
|
|
TARGET=${1:-$HOST}
|
|
BINARIES_DIR="desktop/src-tauri/binaries"
|
|
|
|
# When --target is passed explicitly to cargo (even if it matches the host),
|
|
# binaries land in target/<triple>/release/. Without --target, they land in
|
|
# target/release/. The script receives the target as $1 only when cargo was
|
|
# invoked with --target, so use the qualified path whenever $1 is set.
|
|
if [[ -n "${1:-}" ]]; then
|
|
SRC_DIR="target/${TARGET}/release"
|
|
else
|
|
SRC_DIR="target/release"
|
|
fi
|
|
|
|
# MSVC emits <name>.exe; Tauri's externalBin then expects binaries/<name>-<triple>.exe.
|
|
if [[ "$TARGET" == *windows* ]]; then
|
|
EXE=".exe"
|
|
else
|
|
EXE=""
|
|
fi
|
|
|
|
missing=()
|
|
for bin in "${SIDECARS[@]}"; do
|
|
[[ -f "$SRC_DIR/${bin}${EXE}" ]] || missing+=("${bin}${EXE}")
|
|
done
|
|
if [[ ${#missing[@]} -gt 0 ]]; then
|
|
echo "Error: missing release binaries in $SRC_DIR: ${missing[*]}" >&2
|
|
echo "Run 'cargo build --release -p buzz-acp -p buzz-agent -p buzz-dev-mcp -p git-credential-nostr -p buzz-cli' first." >&2
|
|
exit 1
|
|
fi
|
|
|
|
mkdir -p "$BINARIES_DIR"
|
|
for bin in "${SIDECARS[@]}"; do
|
|
destination="$BINARIES_DIR/${bin}-${TARGET}${EXE}"
|
|
cp "$SRC_DIR/${bin}${EXE}" "$destination"
|
|
|
|
# cp preserves the mode of an existing destination on macOS. Generated
|
|
# sidecar placeholders may not be executable, so make the bundled Unix
|
|
# binaries executable explicitly.
|
|
if [[ -z "$EXE" ]]; then
|
|
chmod 755 "$destination"
|
|
fi
|
|
done
|
|
echo "Sidecars bundled for $TARGET"
|