feat(coord,board): flag mailboxes no session has ever read (WP1d detection half)

coord-count.sh gains a fourth TSV column: "-" when a mailbox has .origin
(a real session has read it via SessionStart), otherwise the age in whole
days of the oldest pending message. .origin is only written by
coord-inbox.sh's non---repo path, so its absence means the mailbox is
never reached by normal injection — a genuine dead letter, not merely
slow. board.sh's --brief surfaces mailboxes past the 3-day threshold as
a new "ALDRI LEST" section, mirroring the existing orphan-mailbox
listing. This is WP1d's detection half only (per .claude's coord
bestilling 2026-08-14); the action half (report-to-sender / retract) is
unapproved design, not built here.

coord-selftest.sh: 191 -> 197 checks. board-selftest.sh: 175 -> 178
checks (net +3; section 16 adds 3 new fixtures on top of the existing
175 baseline, some pre-existing counts shift with the trailing column).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0194eV8b6BXNv6aKLovP8TP6
This commit is contained in:
Kjell Tore Guttormsen 2026-08-14 21:52:47 +02:00
commit 19c0c1010b
6 changed files with 211 additions and 18 deletions

View file

@ -357,7 +357,8 @@ RECORDS="${TMPDIR:-/tmp}/board.$$"
UNBLOCKS="${TMPDIR:-/tmp}/board-unblocks.$$"
OWED="${TMPDIR:-/tmp}/board-owed.$$"
ALLMAIL="${TMPDIR:-/tmp}/board-allmail.$$"
trap '/bin/rm -f "$RECORDS" "$UNBLOCKS" "$OWED" "$ALLMAIL" 2>/dev/null' EXIT
DEADLETTERS="${TMPDIR:-/tmp}/board-deadletters.$$"
trap '/bin/rm -f "$RECORDS" "$UNBLOCKS" "$OWED" "$ALLMAIL" "$DEADLETTERS" 2>/dev/null' EXIT
# --- Owed lookup (name -> messages that actually owe a reply) --------------
# `inbox` (field 6 of RECORDS) is raw pending-file count and stays that way -
@ -383,6 +384,20 @@ if { [ "$BRIEF" -eq 1 ] || [ "$PLAN" -eq 1 ]; } && [ -f "$SELFDIR/coord-count.sh
| awk -F"$ow_tab" -v OFS='|' '{print $1, $3}' > "$OWED"
fi
# --- Dead-letter lookup (name -> age in days), --brief only ----------------
# coord-count.sh's fourth column (WP1d, .claude 2026-08-14) reports the age in
# days of the oldest pending message in a mailbox with no .origin - a mailbox
# no session has EVER read via the normal SessionStart path. "-" (has .origin,
# or age unreadable) is filtered out here; only mailboxes actually past the
# 3-day threshold reach $DEADLETTERS, so brief_deadletters() below never has to
# re-parse the raw column or re-apply the threshold itself.
: > "$DEADLETTERS"
if [ "$BRIEF" -eq 1 ] && [ -f "$SELFDIR/coord-count.sh" ]; then
dl_tab="$(printf '\t')"
bash "$SELFDIR/coord-count.sh" 2>/dev/null \
| awk -F"$dl_tab" -v OFS='|' '$4 != "-" && $4+0 >= 3 {print $1, $4}' > "$DEADLETTERS"
fi
# --- All-mail lookup (name -> pending, owed), --inbox-plan only ------------
# --inbox-plan's whole population is "every name coord-count.sh reports", so
# unlike $OWED (which only needs the debt column) this keeps BOTH integers -
@ -516,6 +531,22 @@ brief_orphans() {
echo "(CLAUDE_COORD_REPO) eller et checkout utenfor scan-roten."
}
# WP1d detection half (.claude, 2026-08-14): $DEADLETTERS already carries only
# the mailboxes past the 3-day threshold, pre-filtered - this function only
# renders. A mailbox here has NO .origin, meaning no session has ever read it
# via the normal per-repo injection; the message sits there regardless of
# whether it also happens to have a repo in the scan tree (dead-letter-repo,
# claimed-repo in board-selftest.sh section 16 both do). The action half
# (report to sender / retract) is unapproved design and is not built here.
brief_deadletters() {
[ -s "$DEADLETTERS" ] || return 0
echo ""
echo "ALDRI LEST - postkasser uten .origin med post eldre enn 3 dogn:"
awk -F'|' '{printf " %-32s %s dogn\n", $1, $2}' "$DEADLETTERS"
echo "Ingen sesjon har noensinne kjort coord-inbox for disse - posten blir"
echo "aldri injisert av den vanlige SessionStart-veien."
}
brief() {
# OWED, not raw pending (field 6): this briefing is titled "repo som skylder
# et svar" (repos that owe a reply), and a pending message that declared
@ -554,6 +585,7 @@ brief() {
printf '%s\n' "$fyi_only" | sed 's/^/ /'
fi
brief_orphans
brief_deadletters
echo ""
echo "MERK: INN teller hva ANDRE venter paa fra deg. Hva et repo venter PAA"
echo "staar kun i dets egen board-linje (blocked-on) - postkassen har ikke"
@ -581,6 +613,7 @@ brief() {
printf '%s repo skylder svar, %s meldinger totalt.\n' "$n_owe" "$tot_msg"
brief_orphans
brief_deadletters
echo ""
echo "MERK: INN teller hva ANDRE venter paa fra deg. Hva et repo venter PAA"
echo "staar kun i dets egen board-linje (blocked-on) - postkassen har ikke"