Skip to content

Pipeline RabbitMQ batch publishes through native confirms - #706

Merged
thomhurst merged 3 commits into
mainfrom
issue-641-batch-confirms
Nov 13, 2026
Merged

thomhurst merged 3 commits into
mainfrom
issue-641-batch-confirms

Conversation

@thomhurst

@thomhurst thomhurst commented Nov 13, 2026 •

Copy link
Copy Markdown
Owner

RabbitMQ batches previously waited for each publisher confirmation before sending the next message. They now lease one channel, admit native publishes in input order, and drain every admitted operation before releasing the channel or borrowed message storage, including on failures and cancellation.

Closes #641

  • Reuses RabbitMQ.Client 7.2.2 BasicPublishAsync and native confirm/mandatory-return/nack tracking, plus Relayer’s existing publisher pool, send completion pool, property/header conversion, tracing and metrics. No parallel confirmation tracker or broker feature is implemented. Inspected pinned source at 740faf07f04ade7d35d3539e20613c6ac6b9b46f: Channel.BasicPublish.cs releases the publish semaphore after transmission and before awaiting confirms; SessionBase.TransmitAsync serializes properties/body into owned frames before writing. Flow control can suspend before serialization, so each batch slot retains independent mutable properties until its native operation completes.
  • Pending awaiters and per-item property/header slots are retained per publisher at the batch high-water mark. Existing mixed destinations, native delay, per-publish telemetry and borrowed-memory ownership remain supported. The site documents partial success, cancellation, retained storage and the final batch contract.
  • Real-broker tests withhold confirms using a dedicated broker’s memory alarm to prove admission and drain ordering; additional cases cover return, nack, protocol-channel recovery, cancellation, property/header isolation and mixed immediate/delayed messages. Existing tests cover tracing and counters.

Validation: Release transport build on net10.0/net11.0; 68 focused RabbitMqSendTests, RabbitMqPublisherTests and RabbitMqConformanceTests cases passed across both frameworks. npm ci and npm run build passed. Tests/benchmarks ran before a conflict-free rebase over unrelated changes; no covered code changed afterward except an explanatory comment. The final documentation build ran after rebase. These broker regression tests were added alongside implementation rather than run as a separate red phase.

Filtered RabbitMqSendBenchmarks ShortRun with MemoryDiagnoser on local RabbitMQ 4.1.4 completed all six cases. Batch (100 messages, normalized per message): raw 20.47 μs / Relayer 13.56 μs; Single ratio 1.06 with broad uncertainty; DefaultJson ratio 0.91. These are diagnostic local results, not performance acceptance or approval of a trade-off. Batch allocation totals include the native client and consumer: raw 2216.15 B/message vs Relayer 2218.75 B/message (about 2.60 B difference, rounded to 2.16/2.17 KB in BDN). They do not establish Relayer-owned allocation overhead. A separate whole-process sampled GC profile shows native publish/confirm state machines as the largest owners and a batch-slot cache-constructor sample during growth; it includes startup, two stackless samples, and cannot prove exact zero steady-state allocation or attribute that small difference. The implementation reuses its own completion, property and awaiter storage after warmup; native/serializer allocations remain excluded by D18. No performance budget or trade-off is changed.

Validation logs, reports, parsed allocation-owner records, source and loaded validation binaries are archived outside the worktree at /Users/tom/git/Relayer-evidence/pr-706/ae2dc6b4821971609826d56fa90e9a6051433a63/, with sha256.json and provenance. Raw profile captures are discarded after summarizing them here, per the loop retention rule. No benchmark output is committed.

Review fix 4065d44: batch slots now directly retain their completion operations, removing shared-pool rent/return scans per batch item. The existing Relayer completion state machine and native confirm tracking are reused. Per-message cost: direct slot access and reset, 0 B of additional steady-state Relayer allocation; no performance trade-off. Extended the dedicated-broker regression to succeed again after cancellation/preparation failure. 44 focused cases passed across net10.0/net11.0, followed by both extended reuse cases; npm ci and documentation build passed.

The benchmark now parameterizes 100/10,000 items and reports per-batch totals. ShortRun completed 12 cases: raw/Relayer batch means were 1.412/1.327 ms at 100 and 113.344/105.310 ms at 10,000. These local diagnostic results have broad uncertainty and do not establish exact Relayer-owned allocations or performance acceptance. New logs, reports, sources and test binaries with verified SHA-256 inventory are retained at /Users/tom/git/Relayer-evidence/pr-706/pool-fix/ for head 4065d4491c50f4738fe4213ca8b7f87f1721f7e9.

Review fix 30b470b: removed eager 256-entry reservations from each slot’s header buffer dictionary, FIFO order storage and content-type cache; they grow only for encountered shapes. Independent mutable buffers remain required while native flow control can pause before serialization. Existing 12 publisher test cases and 2 new retention regression cases passed across both frameworks; the regression rejects 2 MB or more for 1,000 empty batch slots. npm ci and documentation build passed.

The affected RabbitMqSendBenchmarks ShortRun completed 12 cases against dedicated RabbitMQ 4.1.4. Raw/Relayer batch means: 1.820/1.676 ms (100 items), 104.781/113.497 ms (10,000 items). Broad uncertainty makes these diagnostic only; they do not establish performance acceptance or exact Relayer-owned allocation overhead. No performance budget or trade-off changes. Cache hits retain their existing path and 0 B after warmup. Verified SHA-256 inventory, logs, reports, source and loaded test/benchmark binaries are archived at /Users/tom/git/Relayer-evidence/pr-706/retention-fix/ for head 30b470bfeb4fb33d5f60c48284e9b0241bde290b.

@thomhurst thomhurst added the performance Run the advisory benchmark regression gate on this PR label Nov 13, 2026
@coderabbitai

coderabbitai Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5abb4c2a-3594-439d-9c12-f29c9ff4eec4
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@thomhurst

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-13T19:57:45.671700Z ab9f54a Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

Copy link
Copy Markdown

Reviewed the head of this PR against AGENTS.md. I found no blocking issues.

  • Native reuse: it reuses RabbitMQ.Client's BasicPublishAsync confirm, return and nack tracking. It adds no parallel confirm tracker. The PR description names the pinned-source evidence for this (D42).
  • Ownership: every admitted publish is drained before the leased channel is released. Finish runs only after the drain, including on failure and cancellation. _batchError ??= keeps the first error. Per-item RabbitMqBatchSlot properties are isolated, so flow-control suspension before serialization cannot corrupt a neighbour's properties.
  • Pooled state: _endpoint is nulled in GetResult, so Finish's _endpoint?.Telemetry cannot hit a stale endpoint. Borrowed publishers are not returned to the pool, and _batchSends is reset.
  • Per-message path: awaiters and slots are retained at the batch high-water mark, and there is no LINQ or capturing lambda per message. A per-slot SendTracing avoids sharing non-reentrant tracing state across in-flight publishes.
  • Tests and docs: real-broker tests cover admission order, return, nack, cancellation and property isolation. The docs page was updated.

Non-blocking: a batch with a very large item count retains that many slots and awaiters per publisher indefinitely. The docs already say retained storage is at the high-water mark, so this is acceptable.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 42ce935176

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@thomhurst

Copy link
Copy Markdown
Owner Author

@codex review

@github-actions

Copy link
Copy Markdown

Review of #706 (RabbitMQ pipelined batch publishing)

The approach is sound. It reuses native BasicPublishAsync confirm tracking, admits publishes in order, and drains every admitted operation before releasing the channel. Drain-on-failure and cancellation look correct, and the tests are thorough. I found one blocking issue.

Blocking: per-slot retention is unbounded in batch size and very heavy

RabbitMqPublisher.BatchSlot (RabbitMqPublisher.cs) creates a full RabbitMqBatchSlot per in-flight message, and each slot holds a complete RabbitMqPublisher. Every slot therefore eagerly allocates:

  • a Dictionary<(int,int),byte[]>(256)
  • a (int,int)[256] order array
  • a List<(byte[],string)>(256)
  • a RabbitMqHeaders dictionary and BasicProperties
  • its own always-empty _batchSlots list and _batchSends array
  • a RabbitMqSendOperation and a Dictionary<endpoint, SendTracing>, with one SendTracing per endpoint per slot

The benchmark added here uses BatchSize=10_000. Each slot costs on the order of 10-20 KB, so one channel retains roughly 100-200 MB. Slots are never trimmed, and PublisherCount defaults to 16, so one large batch on each channel multiplies that. The docs say retention is at the batch size high-water mark, but they don't say it is this large. One 100k-item batch can permanently pin gigabytes.

Suggested fix. Give the slot only what the native call needs to own: a BasicProperties, a small RabbitMqHeaders, and the operation. Keep a single header-buffer and content-type cache per leased publisher, which is safe because Prepare runs synchronously in admission order. Alternatively:

  • cap the retained slots and trim above the cap after the batch drains, or
  • bound in-flight admission (a window) so a 10k batch needs a window of slots rather than 10k. This also gives natural backpressure.

Either way, retention then tracks the in-flight window rather than the largest batch ever sent. Also document the retention bound.

Smaller points

  • BatchSends(count) resizes to the batch length, which has the same high-water retention issue. It is minor compared with the slots.
  • This change can move per-message cost, so it should carry the performance label. Keep the zero-allocation claim worded as not shown, as the PR text already does.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: 4065d4491c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@thomhurst

Copy link
Copy Markdown
Owner Author

Disposition of Claude’s retention finding: fixed the eager cache reservation in 30b470b. Header dictionaries, FIFO order storage and content-type lists now grow only with encountered shapes rather than reserving 256 entries per slot. A regression verifies that constructing 1,000 empty slots allocates less than 2 MB, rejecting the previous roughly 10–20 KB per-slot baseline. Existing FIFO eviction and warm steady-state allocation tests pass on net10.0/net11.0 (12 cases), as does the new regression on both targets (2 cases). npm ci and the documentation build passed.

Sharing header buffers across slots would be incorrect: native flow control may suspend BasicPublishAsync before serialization, and Prepare for later items would overwrite earlier values. The same applies to the mutable boxed delay. Independent storage preserves the existing ownership contract. No admission window or trimming is introduced: those would change concurrency or steady-state allocations. The remaining high-water retention is explicit in the docs, including guidance to split large inputs and the 256-entry per-slot cache bounds. The performance label is already present. No native feature is duplicated; existing RabbitMQ.Client confirmation tracking and Relayer conversion caches remain in use.

Per-message cache hits are unchanged and allocate 0 B; cache growth now occurs only as new shapes are encountered. The affected benchmark is running locally; its diagnostic results will be appended to the PR body when complete.

@codex review

@github-actions

Copy link
Copy Markdown

Review of #706

I read the diff against the repo conventions and found no actionable issues.

  • Ownership and draining. The batch leases one publisher and admits every native publish in input order. BatchDrain always waits for every admitted operation before Finish releases the channel or the borrowed message storage. That holds on synchronous throws, on cancellation between admissions, and on item failures, and the first error is kept in _batchError.
  • Per-slot state. Each RabbitMqBatchSlot has its own BasicProperties and header buffers, so a publish suspended by flow control cannot have its properties overwritten by the next admission. The _borrowed flag stops the per-slot operation from returning its slot publisher to the channel pool. _endpoint is nulled in GetResult, so the ?. in Finish cannot pick up a stale endpoint.
  • Reuse of native features. It uses BasicPublishAsync with the native confirm, mandatory-return and nack tracking, and adds no parallel tracker. The PR description records the inspection of the pinned client source.
  • Per-message path. Slot operations, awaiter arrays and tracing delegates are cached per publisher. The [] reset in Finish is Array.Empty, so it does not allocate.
  • Tests and docs. Real-broker tests cover admission and drain ordering, return, nack, cancellation, recovery and property isolation. The website page documents partial success and the retained storage.

Two non-blocking notes:

  • Retained slot storage grows with the batch high-water mark for each pooled publisher, so a very large batch keeps that memory for the life of the publisher. This is documented. A cap on retained slots may be worth tracking as a follow-up.
  • Cancellation is not observed while draining confirms. That is intentional so storage stays borrowed until the native calls finish, and it is documented.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: 30b470bfeb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@thomhurst

Copy link
Copy Markdown
Owner Author

Current-head review disposition for 30b470b: Claude CLEAR and Codex completed with no findings. The two Claude notes are non-blocking: high-water retention and drain cancellation are documented contracts; retaining slots avoids new steady-state allocation, and draining protects borrowed storage. No additional change is warranted in this PR.

Before promotion I rechecked every review surface and the resolved thread (no subsequent reviewer reply), and verified every archived file against the existing SHA-256 manifests: 702 original validation files, 496 pool-fix files, and 659 retention-fix files, all matching. The durable locations and measured heads are already in the PR body under /Users/tom/git/Relayer-evidence/pr-706/. No tests were rerun because the covered code has not changed.

@thomhurst

thomhurst commented Nov 13, 2026 •

Copy link
Copy Markdown
Owner Author

The earlier [locked] #348 blocker has cleared: #348 merged as a80ded6 after protected CI 43492619820 succeeded. Rebased #706 onto that actual test-host mitigation and pushed ab9f54a. The rebase was conflict-free; git range-diff confirms all three patches are identical. Release RabbitMQ transport build passes net10/net11 with zero warnings/errors; git diff --check passes. No unchanged CI retry or duplicate mitigation. This new base enables fresh protected validation; it does not retrospectively attribute the historical allocation-counter failure.

Read every conversation, REST review/inline surface and complete GraphQL thread list: previous findings remain dispositioned, the one thread is resolved without newer replies, and documented retention notes remain non-blocking. The previous reviews do not approve this new head. Claude reviews the push automatically; requesting Codex below. PR remains draft/unarmed pending both current-head reviews and the protected lifecycle.

Resolve routes checked: main now supplies the existing mitigation, but does not implement #641's RabbitMQ batch feature. This PR already has Closes #641; no replacement/superseding PR, finished parent or stale completed scope supplies that feature. #687 historical attribution remains separate; neither upstream response nor inaccessible historical Windows originals are prerequisites to evaluating this newly merged mitigation. No linked item mutation or additional lock was needed. No production code, docs, performance contract, equality assertion or parallelism change. No broker tests or benchmarks rerun for identical patches; prior evidence retains its measured heads. Full required CI follows reviewed promotion.

New build log and full source archive are retained outside the worktree at /Users/tom/git/Relayer-evidence/pr-706/gc-rebase/, with SHA256SUMS verified on read-back. No owned services. The former deferral is replaced by this pushed recovery.

@codex review

@thomhurst
thomhurst marked this pull request as draft November 13, 2026 17:55
@thomhurst
thomhurst force-pushed the issue-641-batch-confirms branch from 30b470b to 3012c7d Compare November 13, 2026 17:56
@thomhurst

thomhurst commented Nov 13, 2026 •

Copy link
Copy Markdown
Owner Author

Earlier-deferral Resolve audit: the old profiler run 43460895321 is terminal and its incomplete validation is superseded by later diagnostics, not repaired historical evidence. #705 is still open at a416eb8; acquiring pr-705 returned HELD by another worker, so I made no competing diagnostic changes. The latest complete standalone Linux callback/stack experiment on dotnet/runtime#134724 demonstrates counter-only excess on both supported runtimes; the upstream issue is still open with no maintainer correction. #687 is now explicitly on-hold for that upstream gate, not merely the old Redis blocker. Its native child/prerequisite lists are empty. This evidence does not identify this PR's historical failing allocation windows or authorize changing GC settings, exact assertions or performance budgets.

Took the fresh-base recovery route instead of repeating a deferral: required CI 43456457199 ran before six commits now on main. Converted this PR back to draft and rebased onto 367d4c3. All three patches are identical in git range-diff, with no conflicts. Pushed 3012c7d; this is a new reviewed head, not an unchanged CI rerun. The Release RabbitMQ transport build passes net10/net11 with zero warnings/errors. No broker tests or benchmarks rerun because the rebase changed no covered PR code; prior validation remains attributed to its original measured heads. Source archive, build log and resulting transport binaries are retained in /Users/tom/git/Relayer-evidence/pr-706/rebase-3012c7d/; all 20 archived hashes verified on read-back. The initial no-restore build found no assets in the fresh worktree; ordinary restore/build then succeeded.

Read REST reviews, inline comments, conversation comments and every GraphQL thread. Previous findings remain dispositioned, with no newer reviewer replies; three automated rounds and zero prior force-pushes are below budget. Previous approvals do not approve this rebased head. Current-head Claude will run automatically; requesting Codex below. Auto-merge remains disabled and required CI must pass through the protected lifecycle before merge. The advisory performance concern already has #716; no thresholds or trade-offs changed.

Other Resolve routes: main does not implement #641's pipelined batch changes, so neither #641 nor this PR can be closed as delivered. The body already has Closes #641. No replacement/superseding PR, finished native parent, stale completed acceptance or unpublished recovery supplies the missing correction. The reasonable reversible choice was fresh-base recovery; no speculative production/runtime fix or duplicate diagnostic/GC mitigation is warranted. No hosted run was started manually, no old run is pending, and no on-hold label was added to this PR. No product change beyond existing patches and no new docs impact. Releasing pr-706; pr-705 was not acquired, and no services were started.

@codex review

@github-actions

Copy link
Copy Markdown

Reviewed the head of #706 against AGENTS.md. I found no actionable issues.

  • Native reuse: the change builds on RabbitMQ.Client's own BasicPublishAsync confirm, return and nack tracking. It adds no parallel confirmation tracker, and the PR description names the pinned source it relied on.
  • Ownership and drain: a batch leases one channel, admits publishes in input order, and always drains every admitted awaiter before Finish releases the publisher. Failures and cancellation are recorded in _batchError and the drain continues. Awaiters are reset to default as they complete.
  • Stale state: _endpoint is null (or reset) for batch operations, so the RecordDuration call in Finish cannot record against a stale endpoint from an earlier pooled use. The _endpoint?. null guard is needed and correct.
  • Borrowed slots: each slot has its own BasicProperties and header storage, because flow control can suspend a publish before serialization. _borrowed stops slot operations from returning the leased publisher to the channel. _pool?.Return handles the slot operations that are not pooled.
  • Per-message cost: pooled operations, a retained awaiter array and retained slots at the high-water mark leave a steady-state cost of 0 B. There are no LINQ, closure or reflection uses on the path. The benchmark and the website documentation of partial success and retained storage are updated.
  • Tests: real-broker tests cover withheld confirms, return, nack, channel recovery, cancellation, property isolation and mixed delayed messages.

Non-blocking: retained per-slot caches grow with batch size per publisher. The docs already say so, so I would only revisit it if batch sizes become very large.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: 3012c7dfa2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@thomhurst

Copy link
Copy Markdown
Owner Author

Current-head Resolve recheck: the earlier pr-705 lock/profiler-run deferral is obsolete. This PR already took the fresh-base route in 3012c7d; Claude run 43477740731 is CLEAR for that full head, and the refreshed Codex summary is completed with no findings for the same head. Read REST reviews, inline comments, all conversation comments and the complete GraphQL thread list: the pool-scan finding remains fixed/resolved with no newer reply; documented retention is non-blocking and needs no further change.

#687 remains on-hold for the independently reported runtime counter discrepancy (dotnet/runtime#134724), rather than the completed 43460895321 experiment. That existing investigation does not establish a RabbitMQ defect or justify speculative production changes, equality relaxation, a competing diagnostic run or an unchanged CI rerun. Main does not deliver #641, the PR already has Closes #641, and no replacement, superseded PR, finished-parent or stale-scope route supplies this batch feature. The current actionable route is promotion of this newly reviewed rebased head and its required fresh CI, rather than deferral behind the old run. No linked implementation needs mutation to take that route.

Verified all archived SHA-256 entries on read-back before promotion: original 702, pool-fix 496, retention-fix 659 and rebase 20 files. Durable locations remain /Users/tom/git/Relayer-evidence/pr-706/{ae2dc6b4821971609826d56fa90e9a6051433a63,pool-fix,retention-fix,rebase-3012c7d}/. The measured heads and validation limits remain as recorded in the body and earlier rebase comment. No source change, new docs impact, local test rerun, performance trade-off or service started. Promoting through Enable-AutoMerge.ps1 -MarkReady; required CI must pass before merge.

@thomhurst
thomhurst marked this pull request as ready for review November 13, 2026 18:02
@thomhurst
thomhurst enabled auto-merge (squash) November 13, 2026 18:02
@thomhurst
thomhurst disabled auto-merge November 13, 2026 18:28
@thomhurst
thomhurst marked this pull request as draft November 13, 2026 18:28
@thomhurst
thomhurst force-pushed the issue-641-batch-confirms branch from 3012c7d to ab9f54a Compare November 13, 2026 19:48
@thomhurst

Copy link
Copy Markdown
Owner Author

@codex review

Please review current rebased head ab9f54a. The blocker resolution, unchanged patch comparison and successful two-framework build are recorded in the updated blocker disposition.

@github-actions

Copy link
Copy Markdown

Review of #706: pipelined RabbitMQ batch publishing

I found no actionable issues. I read the diff and the surrounding RabbitMqSendOperation state machine. I did not build the PR or run its tests.

Correctness

  • The batch path leases one publisher, admits every native BasicPublishAsync in order, then drains all admitted sends before Finish. The channel and the borrowed message storage are therefore not released while a send is still in flight.
  • A synchronous throw from SendBatchItemAsync (unsupported tombstone or ordering key, unknown destination) or cancellation between admissions is stored in _batchError. The loop still drains what was admitted, and the first error is reported.
  • Each batch slot has its own BasicProperties, headers and buffer cache. This is needed because RabbitMQ.Client releases its publish semaphore before it serializes properties, and the PR documents that.
  • Borrowed per-slot operations don't return the publisher to the channel, because _borrowed guards that write. They recompute the delay at publish time, so delayed and immediate messages can be mixed in one batch.
  • GetResult clears _endpoint, _connection and _publishers. The _endpoint?.Telemetry null check in Finish covers batch-level operations that never set an endpoint.

Performance and conventions

  • Reusing native confirm tracking instead of a parallel tracker follows the "wrap, don't replace" rule, and the PR description names the pinned-source evidence.
  • Pending awaiters, slots and tracing are retained per publisher at the batch high-water mark. The docs state this retention, and I have no objection to it.
  • Both existing and new RabbitMQ batch tests are in the PR, and there is a docs update, so documentation and test coverage look adequate.

Non-blocking suggestion

  • The retained arrays and slots grow with the largest batch ever sent. If batches can be very large, consider a cap on slot retention or chunking the batch into windows. That would bound memory without changing semantics.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: ab9f54a5d9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@thomhurst

Copy link
Copy Markdown
Owner Author

The quoted locked blocker no longer holds: #348 merged after run 43492619820 succeeded, and #706 already rebased onto that mitigation in ab9f54a. Both required reviewers now clear this full current head. Rechecked all conversation comments, REST reviews/inline comments and GraphQL threads: the pool-scan finding remains fixed and resolved with no later reply. Claude’s current retention suggestion is non-blocking and declined: retention is documented; adding a window changes concurrency and trimming adds allocations, requiring separate performance assessment rather than a disposition-only push.

Resolve routes: main supplies the mitigation but does not deliver #641’s batch feature; this PR already has Closes #641. No replacement, superseded PR, completed parent or stale scope closes the remaining feature. Historical #687 attribution is separate and does not gate evaluating the new mitigation. The reversible route is protected promotion and fresh CI, without duplicating #348 or retrying an unchanged failed run. No linked item needs mutation or another lock.

Read-back verified every archived SHA-256 entry: original 702, pool-fix 496, retention-fix 659, earlier rebase 20, current gc-rebase 2. Durable evidence remains /Users/tom/git/Relayer-evidence/pr-706/ at the measured heads named in the body and prior comments. Prior original-to-archive verification remains recorded; this unit independently verified archive integrity and does not claim recovery or rerun. No code/docs changes, tests/benchmarks rerun, trade-off, or services started. Promoting current reviewed head through Enable-AutoMerge.ps1 -MarkReady; required protected CI must pass before merge.

@thomhurst
thomhurst marked this pull request as ready for review November 13, 2026 19:55
@thomhurst
thomhurst enabled auto-merge (squash) November 13, 2026 19:56
@thomhurst
thomhurst merged commit deb69d7 into main Nov 13, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance Run the advisory benchmark regression gate on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RabbitMQ batch send awaits each publisher confirm in turn

1 participant