Skip to content

fix(run-engine): publish dead-letter redrives to the configured queue channel - #4855

Merged
matt-aitken merged 1 commit into
mainfrom
fix/run-queue-redrive-channel
Aug 31, 2026
Merged

fix(run-engine): publish dead-letter redrives to the configured queue channel#4855
matt-aitken merged 1 commit into
mainfrom
fix/run-queue-redrive-channel

Conversation

@matt-aitken

Copy link
Copy Markdown
Member

Summary

Redriving a run out of the dead letter queue published to the hardcoded Redis channel rq:redrive, while the subscriber listens on ${options.name}:redrive. For any RunQueue not named rq the publish reached zero subscribers, Redis reported success, and the run stayed in the dead letter queue with no log, error, or metric.

Both sides now derive the channel from the same expression, and redriveMessage logs an error when a redrive publish reaches zero subscribers instead of failing silently.

The existing "Dead Letter Queue" test now constructs its queue as rq-redrive, so it fails against the old code (verified red before the fix, green after) and stops the channel names from silently re-locking to a single magic value.

Fixes #4854

… channel

redriveMessage published to the hardcoded rq:redrive channel while the
subscriber listens on the configured queue name, so redrive silently
no-oped for any RunQueue not named rq. Both sides now derive the channel
from the queue name, and a redrive that reaches zero subscribers logs an
error instead of reporting nothing.

Fixes #4854
@changeset-bot

changeset-bot Bot commented Aug 31, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 66083ad

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

The run queue now derives its redrive channel from options.name. Redrive publishing and subscriber setup use this channel. The queue logs an error when publishing reaches zero subscribers. The dead letter queue test sets its queue name to rq-redrive to match the derived channel.

Merge Risk: 🔵 Low · up to 66083

This change restores dead-letter redrives for non-default queues and logs when no subscriber receives a redrive. It is mergeable with owner awareness because an interruption or duplicate delivery during the existing multi-step redrive flow could leave a run both active and dead-lettered or reactivate it more than once.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the bug, the fix, the affected test, and references issue #4854. However, it omits the required checklist, Testing, Changelog, and Screenshots sections from the repository tem… Update the description to include the required checklist, Testing, Changelog, and Screenshots sections. Record the test commands and results in the Testing section, and add the changelog entry.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the primary change: publishing dead-letter redrives to the configured queue channel.
Linked Issues check ✅ Passed The changes satisfy issue #4854. Publishing and subscription now use the configured queue name, zero-subscriber publishes are logged, the dead-letter recovery path remains intact, and the test uses a …
Out of Scope Changes check ✅ Passed All changes are related to issue #4854. The implementation, zero-subscriber logging, and non-default queue-name test directly support the dead-letter redrive fix.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
Full details: Description check

Explanation

The description explains the bug, the fix, the affected test, and references issue #4854. However, it omits the required checklist, Testing, Changelog, and Screenshots sections from the repository template.

Full details: Linked Issues check

Explanation

The changes satisfy issue #4854. Publishing and subscription now use the configured queue name, zero-subscriber publishes are logged, the dead-letter recovery path remains intact, and the test uses a non-default queue name to detect regressions.

Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2 files.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/run-queue-redrive-channel

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@matt-aitken
matt-aitken enabled auto-merge (squash) August 31, 2026 17:29

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
internal-packages/run-engine/src/run-queue/index.ts (1)

674-695: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add temporary crumb markers to all changed redrive code.

The changed production blocks and test override do not contain the required crumb markers. Add them during development, then run agentcrumbs strip before merge.

  • internal-packages/run-engine/src/run-queue/index.ts#L674-L695: mark the redrive publish and zero-subscriber logging block.
  • internal-packages/run-engine/src/run-queue/index.ts#L1475-L1480: mark the queue-specific redrive channel getter and subscriber setup.
  • internal-packages/run-engine/src/run-queue/index.test.ts#L966-L966: mark the non-default queue-name override.

As per coding guidelines, add crumbs as you write code and strip them before merge.

Source: Coding guidelines


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 00c323a0-548a-4d20-ba2d-1997354118f2

📥 Commits

Reviewing files that changed from the base of the PR and between ef7b3aa and 66083ad.

📒 Files selected for processing (2)
  • internal-packages/run-engine/src/run-queue/index.test.ts
  • internal-packages/run-engine/src/run-queue/index.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.

📜 Review details
⏰ Context from checks skipped due to timeout. (32)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (24, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (17, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (12, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (13, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (22, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (18, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (11, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (20, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (16, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (23, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (19, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (21, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (2, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (15, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (5, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (8, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (10, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (14, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (7, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (4, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (3, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (9, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (1, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (6, 24)
  • GitHub Check: e2e-webapp / 🧪 E2E Tests: Webapp (2, 2)
  • GitHub Check: typecheck / typecheck
  • GitHub Check: runops-guard / runops-guard
  • GitHub Check: e2e-webapp / 🧪 E2E Tests: Webapp (1, 2)
  • GitHub Check: internal / 🧪 Unit Tests: Internal
  • GitHub Check: fk-cascade-guard / fk-cascade-guard
  • GitHub Check: code-quality / code-quality
  • GitHub Check: Analyze (javascript-typescript)
🧰 Additional context used
📓 Path-based instructions (7)
We use vitest exclusively. **Never mock anything** - use testcontainers instead.

📄 CodeRabbit inference engine (AGENTS.md)

Files:

  • internal-packages/run-engine/src/run-queue/index.test.ts
**Prefer static imports over dynamic imports.** Only use dynamic `import()` when:

📄 CodeRabbit inference engine (AGENTS.md)

Files:

  • internal-packages/run-engine/src/run-queue/index.test.ts
  • internal-packages/run-engine/src/run-queue/index.ts
Add crumbs as you write code — not just when debugging. Mark lines with

📄 CodeRabbit inference engine (AGENTS.md)

Files:

  • internal-packages/run-engine/src/run-queue/index.test.ts
  • internal-packages/run-engine/src/run-queue/index.ts
Use vitest for all tests in the Trigger.dev repository

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Files:

  • internal-packages/run-engine/src/run-queue/index.test.ts
Use function declarations instead of default exports

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Files:

  • internal-packages/run-engine/src/run-queue/index.test.ts
  • internal-packages/run-engine/src/run-queue/index.ts
Use types over interfaces for TypeScript

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Files:

  • internal-packages/run-engine/src/run-queue/index.test.ts
  • internal-packages/run-engine/src/run-queue/index.ts
When creating or editing OTEL metrics (counters, histograms, gauges), ensure metric attributes have low cardinality by using only enums, booleans, bounded error codes, or bounded shard IDs

📄 CodeRabbit inference engine (.cursor/rules/otel-metrics.mdc)

Files:

  • internal-packages/run-engine/src/run-queue/index.test.ts
  • internal-packages/run-engine/src/run-queue/index.ts

@matt-aitken
matt-aitken merged commit 43ecf15 into main Aug 31, 2026
54 checks passed
@matt-aitken
matt-aitken deleted the fix/run-queue-redrive-channel branch August 31, 2026 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: dead-letter redrive publishes to a hardcoded channel name and fails silently when the queue name differs

2 participants