v1.87.0 ·
Finished work stayed claimed
Finishing an instance never let go of its claim.
recordCompletion in packages/cli/src/commands/transition.ts is the only writer of status: complete, and it did not touch the claim store. The claim file under the git common directory stayed behind. I reproduced it twice on CLI 1.77.0: aidlc claim, then aidlc transition from deployment to complete, leaves the file, and a following aidlc release removes it.
Two readers then trusted the leftover. The session-start hook reports every claim recorded from this checkout, stale or not, so each new session was told a finished instance was claimed here. One such claim misled sessions for eleven days. And aidlc status --prune and the doctor's prune-registry migration only dropped claims whose worktree no longer existed. A claim taken in the primary checkout has no worktree path, so prune answered "nothing to prune" with the file sitting right there.
What changed
The aidlc transition that completes an instance now removes the claim, records the release against the session that held it, and says so in one line. The release command already did the right thing, and finishing just never called it, so both now share one release step in packages/cli/src/commands/claim.ts. If the lock cannot be removed at that moment, the instance still finishes and a warning says so. The finished record matters more, and a stray lock can be cleaned up later.
Claims an older version already left behind now count as orphaned. aidlc status warns about a claim on a completed instance, aidlc status --prune and aidlc doctor remove it, and the session-start hook leaves it out. status --prune also says why it released each claim.
One rule that needed care
A claim is stale when its instance is finished, but finished according to the checkout the claim was taken in, not the one running the cleanup. Two checkouts of one repository can disagree. The main one may say an instance is done while a second has reopened it and is working on it. Reading the wrong one would delete a lock someone is using, which is worse than leaving a stale one for another day. So a second checkout that reopened an instance keeps its claim even while the main checkout says it is complete.
It is a patch. No command, flag or file format changed. Completion prints one new line when it releases a claim. packages/cli/test/completed-claim-left-behind.test.ts adds 17 tests.