Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions deploy/demo-kill-resume.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,21 +54,35 @@ curl -sf --max-time 2 localhost:9100/healthz >/dev/null || { echo "agent never c
echo "agent back — startup sweep resumes in-flight threads"

step "5/6 — wait for the approval card (sweeper resume → node re-run → outbox)"
# Mode-agnostic: the card is "delivered" when its outbox row is done (works for
# both SLACK_DRY_RUN=true — jsonl log — and live Slack). The jsonl tail below
# is the dry-run rendering; live mode points at the Slack channel instead.
found=""
for _ in $(seq 1 180); do
if [ -f "$LOG" ] && grep -q "$THREAD" "$LOG" 2>/dev/null; then found=1; break; fi
for _ in $(seq 1 300); do
delivered="$(docker exec agent99-postgres-1 \
psql -U agent99 -d agent99 -tA -c \
"SELECT count(*) FROM outbox WHERE idempotency_key LIKE '$THREAD:approval_card:%' AND status = 'done';" 2>/dev/null || echo 0)"
[ "${delivered:-0}" -ge 1 ] && { found=1; break; }
sleep 1
done
if [ -z "$found" ]; then
echo "no card for $THREAD within 180s — check: $COMPOSE logs agent"
echo "no card for $THREAD within 300s — check: $COMPOSE logs agent"
exit 1
fi
grep "$THREAD" "$LOG" | tail -1 | python3 -c '
if [ -f "$LOG" ] && grep -q "$THREAD" "$LOG" 2>/dev/null; then
grep "$THREAD" "$LOG" | tail -1 | python3 -c '
import json, sys
entry = json.loads(sys.stdin.read())
print("[%s] channel=%s ts=%s" % (entry["op"], entry.get("channel"), entry.get("ts")))
print(entry.get("text", ""))
'
else
ts="$(docker exec agent99-postgres-1 \
psql -U agent99 -d agent99 -tA -c \
"SELECT extra->'slack_ts'->>'approval' FROM incidents WHERE thread_id = '$THREAD';")"
echo "[chat.postMessage] live Slack (SLACK_DRY_RUN=false) — approval card ts=$ts"
echo "open the #agent99signoz channel to see it"
fi

step "6/6 — prove resume + exactly-once (audit trail + outbox dedupe)"
docker exec agent99-postgres-1 \
Expand Down
Loading