-
Notifications
You must be signed in to change notification settings - Fork 119
Locks from killed runs are never reclaimed, permanently blocking a feature from review #168
Copy link
Copy link
Closed
Labels
P1Urgent regression or broken agent/channel workflow affecting real users now.Urgent regression or broken agent/channel workflow affecting real users now.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:otherThis issue has meaningful maintainer-visible impact outside the owned taxonomy.This issue has meaningful maintainer-visible impact outside the owned taxonomy.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Description
Metadata
Metadata
Assignees
Labels
P1Urgent regression or broken agent/channel workflow affecting real users now.Urgent regression or broken agent/channel workflow affecting real users now.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:otherThis issue has meaningful maintainer-visible impact outside the owned taxonomy.This issue has meaningful maintainer-visible impact outside the owned taxonomy.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Type
Fields
Priority
None yet
Summary
A
clawpatch reviewthat dies without unwinding (SIGKILL, terminal closed, CI job cancelled, OOM) leaves its per-feature lock file behind. Nothing ever reclaims it. Every later run that selects that feature fails withfeature locked: <id>, and becausereviewCommandtreats the claim failure as fatal, the whole run exits 7 — even when every other feature reviewed cleanly.The lock file records the information needed to detect this and does not use it:
{ "lockedByRunId": "20260728T051054-7e273e", "lockedAt": "2026-07-28T05:12:08.397Z", "hostname": "some-host.local", "pid": 29345 }What we hit
A review of 12 features reviewed 11 and then failed:
The holder was a run killed earlier that day. Inspecting the lock directory found five stale locks, the oldest two weeks old; all five
pids were dead, and all five recorded the local hostname. The eleven successful reviews were still charged for, and the one feature that mattered most for that branch was the one blocked.Why
clean-locksis not the answerclean-locksexists, butcleanLocksCommand(app.js:232-249) clears every lock unconditionally — no liveness check, no age check:So it cannot be run automatically or from a wrapper: doing so while another review is in flight would steal that run's locks and let two processes review the same feature concurrently. It is only safe when the operator knows nothing else is running — which means recovery from a crashed run is a manual step that the user has to first diagnose from an
exit 7.Suggested fix
Treat a lock as stale when it is provably not held, using what the lock already records:
hostnamematches the current host andpidis not alive → reclaim it automatically when claiming.That makes the common single-machine case self-healing without weakening the cross-machine guarantee. A
lockedAt-based TTL would be a reasonable secondary backstop for the cross-host case, ideally configurable.Two smaller improvements that would help independently:
clean-locksa safe mode —--stale-only, applying the liveness rule above, so it can be run automatically by wrappers and CI.Reproduction
clawpatch reviewon a repo with several features.kill -9the process while a feature is claimed.clawpatch reviewagain — it fails withfeature locked: <id>and exit 7, indefinitely, untilclean-locksis run manually.Environment
clawpatch 0.7.1 (latest at time of filing), macOS, node global install.