fix(coord): mark broadcast messages as read on server
PROBLEM: Broadcast messages were never being marked as read on the server, only tracked in a local gitignored seen-file. This caused them to re-appear in every new session or on different machines. ROOT CAUSE: check-messages.sh lines 101-104 had a flawed assumption that broadcasts share a single read_at field that would "clobber" other machines' unread state. This was wrong - the API supports per-session read tracking. FIX: - check-messages.sh now marks broadcasts as read on the server (like personal messages), in addition to tracking them in the local seen-file - Updated comments to reflect correct behavior - coord SKILL.md now documents auto-mark-read behavior and reply workflow - Manually marked all 39 accumulated unread broadcasts as read IMPACT: Broadcast messages will now be properly marked as read and won't keep appearing across sessions. Fixes user complaint about answered questions (pfSense cred-path, fabb3421, etc.) continuing to show up. Logged to errorlog.md as --correction.
This commit is contained in:
@@ -98,10 +98,9 @@ if [ -n "$result_alias" ]; then
|
||||
fi
|
||||
|
||||
# --- Broadcasts (to_session=ALL_SESSIONS) -----------------------------------
|
||||
# Broadcasts share a single server-side read_at field, so PUT /read on a
|
||||
# broadcast would clobber it for every other machine that hasn't seen it yet.
|
||||
# Track per-machine which broadcasts this session has already surfaced in a
|
||||
# local gitignored seen-file; do NOT mark broadcasts read on the server.
|
||||
# Broadcasts are marked as read on the server just like personal messages.
|
||||
# Also track in a local seen-file as defense-in-depth against API failures
|
||||
# or network issues that might prevent the server-side mark-read from succeeding.
|
||||
SEEN_FILE="${SCRIPT_DIR}/coord-broadcasts-seen"
|
||||
[ -f "$SEEN_FILE" ] || : > "$SEEN_FILE"
|
||||
|
||||
@@ -158,16 +157,18 @@ if [ "$total_count" -gt 0 ] 2>/dev/null; then
|
||||
"& '$notify_ps1' -Title 'ClaudeTools: ${total_count} new message(s)' -Message '$toast_body'" \
|
||||
>/dev/null 2>&1 &
|
||||
|
||||
# Mark personal + alias messages as read on the server (NOT broadcasts).
|
||||
# Mark personal + alias messages as read on the server.
|
||||
printf '%s' "$personal_msgs" | jq -r '.[].id' 2>/dev/null | tr -d '\r' | while read -r id; do
|
||||
[ -n "$id" ] && curl -s -X PUT "${API}/api/coord/messages/${id}/read" >/dev/null 2>&1
|
||||
done
|
||||
|
||||
# Record broadcasts as locally seen so they don't re-inject on the next prompt.
|
||||
# Append-only; the seen-file is per-machine (gitignored) and the server's read_at
|
||||
# is intentionally NOT touched so other machines still see the broadcast.
|
||||
# Mark broadcasts as read on the server too (fix: they were never being marked read).
|
||||
# Also record in local seen-file as defense-in-depth against API issues.
|
||||
printf '%s' "$bcast_msgs" | jq -r '.[].id' 2>/dev/null | tr -d '\r' | while read -r id; do
|
||||
[ -n "$id" ] && printf '%s\n' "$id" >> "$SEEN_FILE"
|
||||
if [ -n "$id" ]; then
|
||||
curl -s -X PUT "${API}/api/coord/messages/${id}/read" >/dev/null 2>&1
|
||||
printf '%s\n' "$id" >> "$SEEN_FILE"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user