fix(selfhost): require releaseIfValue when transient cache exposes claim() - #3164
Conversation
Ownership-token release fixed stale-holder blind del() (JSONbored#2129), but skipping release when releaseIfValue was absent pinned locks for 600s/1800s after normal work on misconfigured adapters (JSONbored#3153). - Boot: assertSelfhostTransientCacheOwnershipRelease() in server.ts - Runtime: fail open without calling claim() when releaseIfValue is missing - Tests: stale-holder regressions for both lock namespaces, boot guard, JSONbored#3153 path Co-authored-by: Cursor <cursoragent@cursor.com>
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
|
Warning 🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨 ⏸️ Gittensory review result - manual review recommendedReview updated: 2026-07-04 18:32:42 UTC
⏸️ Suggested Action - Manual Review
Review summary Nits — 5 non-blocking
Review context
Contributor next steps
Signal definitions
🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3164 +/- ##
==========================================
- Coverage 95.15% 95.15% -0.01%
==========================================
Files 268 268
Lines 29402 29406 +4
Branches 10715 10717 +2
==========================================
+ Hits 27978 27980 +2
- Misses 780 781 +1
- Partials 644 645 +1
🚀 New features to boost your workflow:
|
Summary
Follow-up to merged #3050: fixes the critical defect flagged when #3153 was closed — adapters with
claim()but noreleaseIfValue()pinned actuation locks for 600s and AI-review locks for 1800s after normal successful work.Problem
#3050 added ownership tokens + compare-and-delete release, but when
releaseIfValuewas absent the runtime skipped release and relied on TTL. Any cache adapter implementingclaim()without ownership-aware release blocked follow-up PR work for minutes after every successful pass.Root cause
claimTransientLock()acquired locks viaclaim()even when release could not safely run, leaving unreleasable keys until TTL expiry.Implementation
assertSelfhostTransientCacheOwnershipRelease()inserver.ts— rejectsclaim()withoutreleaseIfValueat startup.claimTransientLock()fails open without callingclaim()whenreleaseIfValueis missing — no exclusivity, but no unreleasable lock either.env.d.tsdocuments thatclaimandreleaseIfValuemust be implemented together.Testing performed
npm run typechecktest/unit/queue.test.tstest/unit/selfhost-redis-cache.test.ts(9 tests)Compatibility
createRedisCache) already implements both methods — no behavior change for deployed self-host.claimandreleaseIfValue, or omitclaim()entirely.Why this approach
Implements the exact remediation Gittensory suggested on #3153: reject misconfigured adapters at boot, and never acquire unreleasable locks at runtime.
Notes
Builds on #3050 (already merged). Supersedes closed #3153/#3161 which duplicated the merged base fix.