Compare commits

...
Author SHA1 Message Date
Felix FaerberandClaude Opus 4.8 0a89309ff1 fix(activity-log): tool calls only — drop the agent's prose summary
The activity <details> was labelled 'tool calls & reasoning' but included the agent's final prose
summary ('Added the whoami service... Exposed via Traefik... Pushed to branch...'), which is just a
restatement of the PR description and not a tool call. Emit only tool_use events; relabel to
'N tool calls'. The what-changed narrative lives in the PR description; this section is the record of
actions taken.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-04 14:40:59 +03:00
ffaerber cb11a6b2d1 Merge pull request 'fix(activity-log): strip PR-description block from reasoning trail' (#49) from fix/activity-log-strip-prdesc into main 2026-07-04 13:25:30 +02:00
2 changed files with 11 additions and 19 deletions
+10 -18
View File
@@ -1,7 +1,9 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Build activity log (tool calls + reasoning) from the event stream into /tmp/activity_log.md. # Build the activity log — the list of TOOL CALLS the agent made — into /tmp/activity_log.md.
# Only dev agents (mode=pr) get an activity-log comment — comment-only roles (pm/qa) # Only dev agents (mode=pr) get an activity-log comment — comment-only roles (pm/qa) do no tool calls.
# do no tool calls, so a trail would be empty/noise. # NOTE: we deliberately DO NOT include the agent's prose text parts. That final "here's what I did"
# text is just a restatement of the PR description (already published as the PR body), not a tool
# call — so it was noise in a section titled "tool calls". The log is the record of ACTIONS taken.
# #
# Required env (provided by the workflow step): MODE # Required env (provided by the workflow step): MODE
set -u set -u
@@ -11,22 +13,12 @@ if [ "$MODE" != "pr" ]; then
fi fi
jq -r ' jq -r '
def trunc(n): if length > n then (.[0:n] + "…") else . end; def trunc(n): if length > n then (.[0:n] + "…") else . end;
select(.type=="tool_use" or .type=="text") | select(.type=="tool_use") |
if .type=="text" then (.part.tool // "?") as $t |
# Drop the PR-description block from the reasoning trail — it is already published verbatim as ((.part.state.title // (.part.state.input | tojson | trunc(160)) // "")) as $title |
# the PR description, so repeating it here is redundant noise. Skip a text part that is nothing "🔧 **" + $t + "**: `" + ($title | trunc(240)) + "`"
# 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 |
"🔧 **" + $t + "**: `" + ($title | trunc(240)) + "`"
end
' /tmp/events.jsonl > /tmp/activity_log.md 2>/dev/null || true ' /tmp/events.jsonl > /tmp/activity_log.md 2>/dev/null || true
n=$(wc -l < /tmp/activity_log.md 2>/dev/null || echo 0) n=$(wc -l < /tmp/activity_log.md 2>/dev/null || echo 0)
echo "activity log: $n entries" echo "activity log: $n tool calls"
[ "$n" -eq 0 ] && : > /tmp/activity_log.md [ "$n" -eq 0 ] && : > /tmp/activity_log.md
head -3 /tmp/activity_log.md head -3 /tmp/activity_log.md
+1 -1
View File
@@ -144,7 +144,7 @@ activity=""
if [ -s /tmp/activity_log.md ]; then if [ -s /tmp/activity_log.md ]; then
entries=$(wc -l < /tmp/activity_log.md 2>/dev/null || echo 0) entries=$(wc -l < /tmp/activity_log.md 2>/dev/null || echo 0)
log=$(cat /tmp/activity_log.md) log=$(cat /tmp/activity_log.md)
activity=$(printf '\n\n<details>\n<summary>🔧 activity — %s tool calls & reasoning</summary>\n\n%s\n\n</details>' "$entries" "$log") activity=$(printf '\n\n<details>\n<summary>🔧 activity — %s tool calls</summary>\n\n%s\n\n</details>' "$entries" "$log")
fi fi
# One PR per run: publish ONLY this run's own branch ($BRANCH), never sibling # One PR per run: publish ONLY this run's own branch ($BRANCH), never sibling