From 1987ba792dd9386bfbc41a1fd989219c74aa882d Mon Sep 17 00:00:00 2001 From: Felix Faerber Date: Sat, 4 Jul 2026 14:12:32 +0300 Subject: [PATCH 1/2] fix(activity-log): strip the PR-description block from the reasoning trail MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The 'tool calls & reasoning' activity log dumped each text part verbatim, including the agent's BEGIN_PR_DESCRIPTION..END_PR_DESCRIPTION block — which is already published as the PR description, so it appeared twice (e.g. homelab PR #117). Strip that block from text parts, and drop a text entry that becomes empty after stripping. Co-Authored-By: Claude Opus 4.8 (1M context) --- .gitea/workflows/scripts/build-activity-log.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/scripts/build-activity-log.sh b/.gitea/workflows/scripts/build-activity-log.sh index ef266a5..bd92c51 100755 --- a/.gitea/workflows/scripts/build-activity-log.sh +++ b/.gitea/workflows/scripts/build-activity-log.sh @@ -13,7 +13,13 @@ jq -r ' def trunc(n): if length > n then (.[0:n] + "…") else . end; select(.type=="tool_use" or .type=="text") | if .type=="text" then - "šŸ’¬ " + ((.part.text // "") | trunc(4000)) + # Drop the PR-description block from the reasoning trail — it is already published verbatim as + # the PR description, so repeating it here is redundant noise. Skip a text part that is nothing + # but that block (would otherwise be an empty "šŸ’¬ " entry). + ((.part.text // "") + | gsub("BEGIN_PR_DESCRIPTION.*?END_PR_DESCRIPTION"; ""; "m") + | gsub("\\A[[:space:]]+|[[:space:]]+\\z"; "")) as $t | + if $t == "" then empty else "šŸ’¬ " + ($t | trunc(4000)) end else (.part.tool // "?") as $t | ((.part.state.title // (.part.state.input | tojson | trunc(160)) // "")) as $title | -- 2.54.0 From 81882ee3ec8112440cef5d4194d8c788437447f4 Mon Sep 17 00:00:00 2001 From: Felix Faerber Date: Sat, 4 Jul 2026 14:24:37 +0300 Subject: [PATCH 2/2] fix(publish): de-dup agent comments (no repeated PR desc, no doubled header) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Batches the remaining comment-noise cleanups on top of the activity-log fix: - Resume comment no longer re-posts the full PR description (## Summary/## Changes) — the PR body and diff already carry it; the comment just links the PR (the reasoning trail shows what the run did). - Strip a leading self-header the model sometimes emits ("šŸ¤– **@pm**" on its own line, sometimes twice) before we prepend our own, so headers aren't doubled. - Also drop the BEGIN_PR_DESCRIPTION block from the plain reply text, and simplify the activity block's summary (it repeated "šŸ¤– **@name** — activity log"). Co-Authored-By: Claude Opus 4.8 (1M context) --- .gitea/workflows/scripts/publish.sh | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/.gitea/workflows/scripts/publish.sh b/.gitea/workflows/scripts/publish.sh index bc80037..ba3eca8 100755 --- a/.gitea/workflows/scripts/publish.sh +++ b/.gitea/workflows/scripts/publish.sh @@ -18,14 +18,25 @@ hdr=(-H "Authorization: token $TOK" -H "Content-Type: application/json") post() { curl -sS -w 'comment -> HTTP %{http_code}\n' -X POST "${hdr[@]}" \ "$API/issues/$NUM/comments" -d "$(jq -nc --arg b "$1" '{body:$b}')"; } -# drop machine-readable markers (DELEGATE / CLOSE_ISSUE / the BEGIN_SUBTASKS..END_SUBTASKS block) +# drop machine-readable markers: DELEGATE / CLOSE_ISSUE, and the BEGIN_SUBTASKS..END_SUBTASKS and +# BEGIN_PR_DESCRIPTION..END_PR_DESCRIPTION blocks (the PR description is published separately). reply=$(awk ' /^[[:space:]]*BEGIN_SUBTASKS/{s=1} + /^[[:space:]]*BEGIN_PR_DESCRIPTION/{p=1} /^[[:space:]]*DELEGATE:[[:space:]]*@/{next} /^[[:space:]]*CLOSE_ISSUE[[:space:]]*$/{next} s{ if(/^[[:space:]]*END_SUBTASKS/){s=0}; next } + p{ if(/^[[:space:]]*END_PR_DESCRIPTION/){p=0}; next } {print} ' /tmp/agent_out.md 2>/dev/null) +# Strip a leading self-header the model sometimes emits ("šŸ¤– **@pm**" on its own line) so we don't +# double it when we prepend our own. Removes a leading run of such header lines and blank lines. +reply=$(printf '%s' "$reply" | awk ' + BEGIN{s=1} + s && /^[^A-Za-z0-9]*\*\*@[A-Za-z]+\*\*[[:space:]]*$/ {next} + s && /^[[:space:]]*$/ {next} + {s=0; print} +') [ -z "$reply" ] && reply="_(Made changes without a text summary — see the diff below.)_" # Prefer the agent's clean delimited PR description; fall back to the whole reply. prdesc=$(awk '/BEGIN_PR_DESCRIPTION/{f=1;next} /END_PR_DESCRIPTION/{f=0} f' /tmp/agent_out.md) @@ -133,7 +144,7 @@ activity="" if [ -s /tmp/activity_log.md ]; then entries=$(wc -l < /tmp/activity_log.md 2>/dev/null || echo 0) log=$(cat /tmp/activity_log.md) - activity=$(printf '\n\n---\nšŸ¤– **@%s** — activity log (%s entries):\n
\ntool calls & reasoning\n\n%s\n\n
' "$NAME" "$entries" "$log") + activity=$(printf '\n\n
\nšŸ”§ activity — %s tool calls & reasoning\n\n%s\n\n
' "$entries" "$log") fi # One PR per run: publish ONLY this run's own branch ($BRANCH), never sibling @@ -175,6 +186,7 @@ prpost() { if [ "$NEW" = "true" ]; then prpost "$prnum" "$(printf 'šŸ¤– **@%s** — āœ… PR ready for review — @ffaerber please review & merge:\n- %s%s' "$NAME" "$url" "$activity")" else - # Resume (comment is on a PR thread): include the write-up here too. - prpost "$prnum" "$(printf 'šŸ¤– **@%s** — updated branch/PR:\n- %s\n\n%s%s' "$NAME" "$url" "$prdesc" "$activity")" + # Resume: just link the PR — its body and the diff already carry the description, so we don't + # repeat the full write-up in the comment (the reasoning trail below shows what this run did). + prpost "$prnum" "$(printf 'šŸ¤– **@%s** — pushed an update to the PR:\n- %s%s' "$NAME" "$url" "$activity")" fi -- 2.54.0