From 481a16cfd7b2fc678f1912b88e324139022d1346 Mon Sep 17 00:00:00 2001 From: Cameron Pfiffer Date: Mon, 24 Aug 2026 01:40:23 -0700 Subject: [PATCH] Stop the Fly agent after content deployments. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Explicit cleanup prevents a successful worker from lingering in its systemd cgroup and being reported as a timeout failure. 👾 Generated with [Letta Code](https://letta.com) Co-Authored-By: Letta Code --- scripts/sync-git-backed-content-from-origin.sh | 6 ++++++ scripts/test-content-sync-worker.sh | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/scripts/sync-git-backed-content-from-origin.sh b/scripts/sync-git-backed-content-from-origin.sh index 2ba6d49..4423955 100755 --- a/scripts/sync-git-backed-content-from-origin.sh +++ b/scripts/sync-git-backed-content-from-origin.sh @@ -150,7 +150,13 @@ source_fingerprint=$( ) last_fingerprint=$(cat "$STATE_FILE" 2>/dev/null || true) if [[ "$source_fingerprint" != "$last_fingerprint" ]]; then + cleanup_fly_agent() { + timeout 10s fly agent stop >/dev/null 2>&1 || true + } + trap cleanup_fly_agent EXIT fly deploy --depot=false + cleanup_fly_agent + trap - EXIT printf '%s\n' "$source_fingerprint" >"$STATE_FILE.tmp" mv "$STATE_FILE.tmp" "$STATE_FILE" fi diff --git a/scripts/test-content-sync-worker.sh b/scripts/test-content-sync-worker.sh index 5e1f8d3..d3e1af6 100755 --- a/scripts/test-content-sync-worker.sh +++ b/scripts/test-content-sync-worker.sh @@ -108,6 +108,7 @@ EOF cat >"$tmp/scope-bin/fly" <<'EOF' #!/usr/bin/env bash [[ -z ${CAMERON_BSKY_APP_PASSWORD:-} ]] || exit 91 +printf '%s\n' "$*" >>"$SCOPE_FLY_LOG" EOF cat >"$tmp/scope-bin/pnpm" <<'EOF' #!/usr/bin/env bash @@ -136,9 +137,12 @@ PATH="$tmp/scope-bin:$PATH" \ CAMERON_BSKY_APP_PASSWORD=scope-test-secret \ CAMERON_SITE_REPO="$tmp/scope-source" \ CAMERON_SITE_SYNC_STATE_DIR="$tmp/scope-state" \ +SCOPE_FLY_LOG="$tmp/scope-state/fly.log" \ "$tmp/scope-source/scripts/sync-git-backed-content-from-origin.sh" >"$tmp/scope-run.log" test -f "$tmp/scope-state/last-run.json" grep -F '"conflict": 0' "$tmp/scope-state/last-run.json" >/dev/null +grep -Fx 'deploy --depot=false' "$tmp/scope-state/fly.log" >/dev/null +grep -Fx 'agent stop' "$tmp/scope-state/fly.log" >/dev/null echo 'Content sync worker tests passed.' -- 2.51.2