|
24 | 24 | refuses to look; what they buy is that the collision becomes visible BEFORE the work, not after. |
25 | 25 |
|
26 | 26 | Releasing is manual and claims do NOT expire: an abandoned claim is a stale note, whereas an |
27 | | - auto-expiring one silently re-opens the race it exists to prevent. `-List` flags anything older than |
28 | | - 12h so stale ones are obvious. |
| 27 | + auto-expiring one silently re-opens the race it exists to prevent. `-List` reports each holder's |
| 28 | + LIVENESS -- worktree gone, or hours since its last commit -- not the claim's age. Age was the |
| 29 | + original signal and it was actively misleading: a 21h claim whose holder had committed two minutes |
| 30 | + earlier was labelled STALE and recommended for release. |
29 | 31 |
|
30 | 32 | .EXAMPLE |
31 | 33 | pwsh -NoProfile -File scripts\coord\claim.ps1 -Take 105 -Note "corepoint xml importer" |
@@ -79,11 +81,37 @@ function Show-List { |
79 | 81 | $c = Get-Content $f.FullName -Raw | ConvertFrom-Json |
80 | 82 | $held = ($c.worktree -replace '\\', '/').TrimEnd('/') |
81 | 83 | $mine = if ($held -ieq $me) { " <-- THIS worktree" } else { "" } |
| 84 | + # LIVENESS, not age. This used to print "[STALE ~Nh -- release it if that session is gone]" once |
| 85 | + # a claim was 12h old, which measures how long the WORK has run and says nothing about whether |
| 86 | + # anyone is still doing it. Measured 2026-07-31: a claim reported STALE ~21h whose holder had |
| 87 | + # committed TWO MINUTES earlier. Releasing on that advice frees the key for a second session to |
| 88 | + # start building what someone is mid-flight on -- the exact duplicate-build this registry exists |
| 89 | + # to prevent, arrived at by following the tool's own recommendation. A long claim is the normal |
| 90 | + # shape of long work; report what the HOLDER is doing and let the operator decide. |
82 | 91 | $age = "" |
83 | 92 | try { |
84 | | - $hrs = ((Get-Date) - [datetime]::Parse($c.claimed)).TotalHours |
85 | | - if ($hrs -ge 12) { $age = " [STALE ~$([int]$hrs)h -- release it if that session is gone]" } |
86 | | - } catch { } |
| 93 | + $hrs = [int]((Get-Date) - [datetime]::Parse($c.claimed)).TotalHours |
| 94 | + if (-not (Test-Path $held)) { |
| 95 | + # The only state that is genuinely safe to act on without asking anyone. |
| 96 | + $age = " [HOLDER GONE -- worktree no longer exists; release with -Force]" |
| 97 | + } |
| 98 | + else { |
| 99 | + $ct = & git -C $held log -1 --format=%ct 2>$null |
| 100 | + if ($ct) { |
| 101 | + $quiet = [int]((Get-Date) - [System.DateTimeOffset]::FromUnixTimeSeconds([long]$ct).LocalDateTime).TotalHours |
| 102 | + $age = " [held ${hrs}h; holder last committed ${quiet}h ago]" |
| 103 | + if ($quiet -ge 12) { $age += " -- QUIET, confirm with the holder before releasing" } |
| 104 | + } |
| 105 | + else { |
| 106 | + $age = " [held ${hrs}h; holder liveness UNKNOWN -- confirm before releasing]" |
| 107 | + } |
| 108 | + } |
| 109 | + } catch { |
| 110 | + # Say so. An empty annotation reads as "nothing notable about this claim", which is the same |
| 111 | + # silent-instrument failure the age signal had: accurate about what it measured, mute about |
| 112 | + # what it could not. A claim whose liveness could not be determined must not look routine. |
| 113 | + $age = " [liveness check FAILED -- treat as unknown, confirm before releasing]" |
| 114 | + } |
87 | 115 | Write-Host (" {0,-34} {1}" -f $c.key, $c.note) |
88 | 116 | Write-Host (" held by {0} [{1}]{2}{3}" -f $held, $c.branch, $mine, $age) |
89 | 117 | } |
|
0 commit comments