Files
fleet/scripts
CatoandClaude Opus 5 e94c70381d fix(stranded-work): distinguish abandoned from stranded (#56)
The report counted dirty files and their age, which cannot tell a session
mid-work from a worktree abandoned a fortnight ago. Both come out as "N
uncommitted, oldest 15d".

What made that concrete: seven orangecat worktrees each reported "9
uncommitted, oldest 15d". Identical counts, because the diff was identical —
one identity sweep (maonakamoto -> bitbaum) left uncommitted in every worktree
it was run in. Main had not only made that rename, it had moved past it to a
different org path, so treating those as work to rescue would have REVERTED
main. All seven sat 202-215 commits behind. The live worktrees that same day
sat at 0-2.

So scan_repo measures the distance to the default branch and decide() prints it
when it crosses a threshold (STRANDED_BEHIND, default 50 — the fleet's data has
a wide empty gap between 2 and 99). Today that splits a flat 30-line list into
13 directories to delete and 17 pieces of work to finish, which are different
actions.

The marker annotates and never filters: nothing is dropped and the exit status
is unchanged, because a branch left alone for a fortnight can still hold the
only copy of something. It only lets a reader tell the two apart — which is the
difference between a report that gets acted on and one that gets muted, and
this script's own header explains why that is the whole game.

A sentinel is never rendered as a distance. An unreachable default branch
reports -1 and a caller written before this column sends no field at all;
neither is zero, and calling either one "up to date" is exactly the failure the
column exists to prevent. Six-column rows still decide correctly.

30 tests pass (24 existing, 6 new), and four mutations confirm the new ones
catch what they claim: a sentinel rendered as a distance, the marker filtering
instead of annotating, the threshold hardcoded, and a current worktree marked
abandoned. A fifth mutation was dropped as equivalent code — swapping the -n
guard for ${behind:-0} changes nothing for any positive threshold, so it proved
nothing; that guard prevents a silent shell error, not a wrong verdict.


Claude-Session: https://claude.ai/code/session_01TE8oRvuwExm6GXkQVW3Jf9

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-12 08:55:11 -07:00
..