From 68a0eaf7dc3073cad9822c3200221e0947915a14 Mon Sep 17 00:00:00 2001 From: ffaerber Date: Wed, 8 Jul 2026 09:34:38 +0200 Subject: [PATCH] fix: record pre-run newest comment id for reply dedup --- .gitea/workflows/scripts/fetch-thread.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.gitea/workflows/scripts/fetch-thread.sh b/.gitea/workflows/scripts/fetch-thread.sh index 0956bb3..e1adda6 100755 --- a/.gitea/workflows/scripts/fetch-thread.sh +++ b/.gitea/workflows/scripts/fetch-thread.sh @@ -26,3 +26,9 @@ jq -rs ' "### comment by \($who):\n\(.body | gsub("\\s*"; ""))\n"' \ /tmp/thread_pages.json > /tmp/thread.md 2>/dev/null || : > /tmp/thread.md echo "thread comments fetched: $(grep -c '^### comment by ' /tmp/thread.md 2>/dev/null || echo 0) (newest 100 kept)" + +# Record the newest comment id on the thread BEFORE the agent runs. publish.sh compares against +# it to detect an agent that self-posted its reply mid-run (via the gitea-api skill, despite the +# prompt telling it not to) and skips the duplicate framework reply. Ids are monotonic — no dates. +jq -rs '[ (add // [])[].id ] | max // 0' /tmp/thread_pages.json > /tmp/thread_max_cid 2>/dev/null || echo 0 > /tmp/thread_max_cid +echo "pre-run newest comment id: $(cat /tmp/thread_max_cid)"