Skip to content

Commit 3a98e03

Browse files
committed
Merge remote-tracking branch 'origin/main' into claude/ci-margin-correction-a1007c
2 parents ee8c887 + 599f9e2 commit 3a98e03

1 file changed

Lines changed: 33 additions & 5 deletions

File tree

scripts/coord/claim.ps1

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,10 @@
2424
refuses to look; what they buy is that the collision becomes visible BEFORE the work, not after.
2525
2626
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.
2931
3032
.EXAMPLE
3133
pwsh -NoProfile -File scripts\coord\claim.ps1 -Take 105 -Note "corepoint xml importer"
@@ -79,11 +81,37 @@ function Show-List {
7981
$c = Get-Content $f.FullName -Raw | ConvertFrom-Json
8082
$held = ($c.worktree -replace '\\', '/').TrimEnd('/')
8183
$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.
8291
$age = ""
8392
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+
}
87115
Write-Host (" {0,-34} {1}" -f $c.key, $c.note)
88116
Write-Host (" held by {0} [{1}]{2}{3}" -f $held, $c.branch, $mine, $age)
89117
}

0 commit comments

Comments
 (0)