Fix Bot Mention Trigger Silently Discarded by Queue Worker Due to Raw Event Name Mismatch
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 67/100
- Tipo de issue
- Bug
- Clareza
- Claramente especificada
- Status de atividade
- Ativa
- Stack de tecnologia
- github, node.js, typescript
- Domínio
- backend-api-design, devops
Direção de pesquisa
Read packages/core/src/review/resolve-job.ts and trace how it loads webhook_deliveries; compare that path with normalization in packages/provider-github/src/webhook.ts and delivery creation in packages/api/src/routes/webhook.ts. Start with the tests around resolveQueuedJob and add coverage for an issue_comment delivery and a closed pull_request delivery. Done means mention reviews and PR-close label cleanup run, existing auto-triggered reviews still work, and the listed typecheck, test, and lint commands pass.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Summary
Mention-triggered reviews (e.g. @codra review posted as a PR comment) are silently dropped before they ever reach the review worker. The pipeline queues the message, but the worker discards it immediately because it checks for a normalized event name that was never stored.
Root Cause
The webhook handler in packages/api/src/routes/webhook.ts reads the raw GitHub header x-github-event (value: "issue_comment") and stores it in the webhook_deliveries table as-is.
When the queue worker calls resolveQueuedJob in packages/core/src/review/resolve-job.ts, it loads the delivery and checks:
if (eventName !== "change_request" && eventName !== "comment") {
logger.info(`Queue message ignored: unsupported webhook event ${eventName}`);
return null;
}
Since delivery.event_name is "issue_comment" (raw GitHub header), not "comment" (the normalized name), the check fails and the message is thrown away. Mention-triggered reviews never execute.
The same mismatch applies to pull_request to change_request for PR-close label cleanup. Any job that takes the fallback path through the delivery lookup (without an inline jobId or payload on the queue message) can be affected.
Affected Files
packages/api/src/routes/webhook.ts- stores raweventNamein delivery and passes it raw to the queue message (L274-278)packages/core/src/review/resolve-job.ts- checks normalized names against raw stored names (L42-50)packages/provider-github/src/webhook.ts-normalizeGitHubWebhookcorrectly maps"issue_comment"to"comment", but is never called on the worker path
Proposed Fix
In resolveQueuedJob, after loading the delivery record, normalize eventName before checking:
// After loading delivery:
const normalized = env.webhooks.normalizePayload(delivery.event_name, delivery.payload);
if (normalized) {
eventName = normalized.eventName; // "comment" or "change_request"
payload = normalized.payload;
} else {
eventName = delivery.event_name;
payload = delivery.payload as WebhookPayload;
}
Alternatively (and more robustly), store the normalized event name in webhook_deliveries at insertion time in the webhook route, so the queue always receives the canonical name regardless of which path it takes.
Done When
-
@codra reviewcomments on a PR trigger a review job correctly - PR-close label cleanup runs for
pull_requestclosed events - Existing auto-triggered PR reviews (
opened,synchronize, etc.) continue to work - Tests cover the mention trigger path end-to-end through
resolveQueuedJob - Any backend changes work in both Cloudflare Workers and Node/Docker
-
npm run typecheck,npm test, andnpm run lintall pass
Before Closing
-
npm run typecheck,npm test, andnpm run lintall pass - Any backend changes work in both Cloudflare Workers and Node/Docker
- Tests cover the changed behavior in each affected runtime
- Linguagem predominante
- TypeScript
- Estrelas
- 125
- Forks
- 23
- Merge médio
- 2d 13h
- PRs com merge (30d)
- 12
Preparar o ambiente
- Inclui um Dockerfile ou arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de devarshishimpi/codra
-
bug good first issue
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 84/100
devarshishimpi/codra#178 ·
Mantenedores costumam responder em até 1 dia
-
bug good first issue
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
devarshishimpi/codra#176 ·
Mantenedores costumam responder em até 1 dia
-
enhancement good first issue
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 48/100
devarshishimpi/codra#186 ·
Mantenedores costumam responder em até 1 dia
-
enhancement good first issue
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 55/100
devarshishimpi/codra#185 ·
Mantenedores costumam responder em até 1 dia
-
enhancement good first issue
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 58/100
devarshishimpi/codra#184 ·
Mantenedores costumam responder em até 1 dia
Todas as issues de devarshishimpi/codra
Issues semelhantes
-
Dificuldade 1/5 1-3 horas Facilidade para iniciantes 83/100
gofish-graphics/gofish-graphics#1384 ·
Mantenedores costumam responder em até 1 dia
-
adapter bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 83/100
Olanetsoft/agent-lookout#353 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
vicharanashala/vibe#1542 ·
Mantenedores costumam responder em até 1 dia
-
bug chore P2 size:XS
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 77/100
josephfung/curia#2666 ·
Mantenedores costumam responder em até 1 dia
-
area: batch
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
inabagumi/shinju-date#7294 ·
Mantenedores costumam responder em até 1 dia