Repository navigation
Description
Summary
When a native batch send fails, the direct dispatcher records a failed attempt on every row in that batch. One message that the broker rejects (for example one that is too large) therefore burns attempts on all its neighbours, and recovery regroups the same rows on the next pass. Design §6.1 states that "a poison outbox row never blocks unrelated messages."
Evidence
src/Relayer.Outbox.PostgreSql/PostgreSqlDirectDispatcher.cs:238-246: on exception,for (i < live) RecordDispatchFailureAsync(_claims[i], error.Message, ...).src/Relayer.Outbox.SqlServer/SqlServerDirectDispatcher.cs:202-210: the same loop.
Whether each transport's batch send can report per-message failures was not checked.
Proposal
On a batch failure, retry the rows individually (or use the transport's per-message batch result where it has one) before recording an attempt, so only the failing row is counted.
Found by reading the code at 02fe06f; not reproduced at runtime unless stated.
Triage audit
Checked origin/main 3dea7d414b38e2e505b67a6d8aa9104dc1d57538; the reported behavior remains.
Remaining scope and acceptance criteria
- Reproduce a native batch containing a rejected row and unrelated valid rows; prove valid rows can complete without inheriting that rejection's poison outcome. Cover PostgreSQL, SQL Server and MySQL direct/recovery paths through existing shared contracts where possible.
- Inspect pinned native client source for per-message batch results first. Reuse them when available; any fallback must preserve native at-least-once semantics, bounded sends, cancellation and live claim fencing. An uncertain batch acceptance can duplicate messages and must be documented.
- Keep durable backoff (Outbox dispatch has no backoff: a short broker outage parks ordered keys and dead-letters unordered rows #646, with open PRs Persist PostgreSQL outbox backoff without poisoning broker outages #672/Retain SQL Server outbox sends with durable retry backoff #674/Persist MySQL outbox backoff without poisoning broker outages #676) distinct from failure isolation. Those PRs still assign a failed batch outcome to all its claimed rows; backoff alone does not satisfy this issue. Recheck their final merged policy before implementation; no prerequisite link is needed merely for touching related code.
- Preserve the successful batch fast path and document failure-isolation behavior. Add a benchmark only if the change materially alters steady-state per-message work under the repository rule.
Activity
thomhurst commentedon Nov 13, 2026
Audited current main and linked work; added actionable acceptance criteria and clarified the remaining scope in the issue body.
Fix Kafka offset ownership test imports after API separation (#647)
Use TUnit isolation for batch rejection queue (#647)
Isolate rejected outbox batch rows across stores (#647)
Use TUnit isolation for batch rejection queue (#647)
test: use renamed Service Bus options in batch isolation (#647)
Isolate rejected outbox batch rows across stores (#647)
Use TUnit isolation for batch rejection queue (#647)
test: use renamed Service Bus options in batch isolation (#647)
docs: keep batch isolation decision distinct after rebase (#647)
Isolate rejected outbox batch rows across stores (#647)
Use TUnit isolation for batch rejection queue (#647)
test: use renamed Service Bus options in batch isolation (#647)
docs: keep batch isolation decision distinct after rebase (#647)
Isolate rejected outbox batch rows across stores (#711)