Repository navigation
Execute batch handlers with durable per-message outcomes - #99
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Keep it up! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
672dee9 to
51ae60f
Compare
|
@codex review Rebased onto current main and resolved the pipeline conflicts. Batch composition explicitly rejects single-message telemetry/settlement callbacks; the two new regression cases failed before the guard. With the separate #102 fix temporarily applied for validation, Release build, all 448 tests, Native AOT smoke and website build pass. The patch is not in this PR; #102 / #103 still blocks standalone compilation on main. Evidence and the validation limitation are recorded in the PR body. The previous Claude run produced no head-bound verdict despite a green job (tracked by #65); this new draft push starts a fresh review cycle. |
|
Review of 51ae60f. I read the batch dispatcher, execution, receive executor and the PR description. I did not build or run tests. Build and Test is skipped because the PR is a draft, and main already has the duplicate SemanticConventionsVersion constants (#102/#103), so the head can't compile until that merges. That break is not caused by this PR. The pooled state, per-attempt scope and Interlocked state rental follow the zero-allocation rules, and tracing allocations only occur when a listener is attached. Startup validation, executor count caps and the post-receive cancellation check are sound. Blocking: a partial failure with buffered sends can stall a poison message. In BatchExecution.ProcessAsync, when failed < count and the send buffer is non-empty, the code throws InvalidOperationException out of the whole receive call. Nothing in the batch is settled and no failed item reaches _failures.HandleAsync (retry, redelivery or dead-letter), although the handler's side effects have already run. Scenario: a handler sends a follow-up message per item and one item deterministically fails. Every delivery throws, the batch is redelivered, and the same item fails again. The poison item never dead-letters and the good items are re-processed forever. That breaks the AGENTS.md default that poison messages are dead-lettered rather than stalling a consumer. D28 documents this, but documenting it does not remove the stall. Suggested approach: let the partial-failure case still reach the normal failure path. Either flush the buffered sends and retry or dead-letter only the failed items (at-least-once, duplicates tolerated by design), or, if sends cannot be attributed, treat the whole attempt as failed: discard the buffer and route every item through retry and dead-letter, so the retry budget bounds the attempts. Both end in a settled batch after a bounded number of attempts, unlike the current throw. If you keep the throw, add a test showing a bounded outcome for this scenario and state the unbounded-redelivery risk in D28 and the docs. Minor, non-blocking: BatchDispatcher passes state.Batch, which wraps pooled storage, so a handler that retains the Batch past its return sees cleared items. Document in the Batch docs that it is only valid for the duration of the call. Everything else is consistent with D1, D18 and D28. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 51ae60f1f4
ℹ️ 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".
51ae60f to
e630d38
Compare
|
Review of PR #99 (batch handler composition). I read Correctness
Performance
Non-blocking notes
I found no actionable issues. |
|
@codex review Fixed the blocking findings in e630d38, rebased onto main including #103:
Release build, all 454 tests, Windows x64 Native AOT publish/smoke and website build pass without patches. All 12 BenchmarkDotNet ShortRun cases match the direct baseline allocations. PR body records limitations and the hash-verified durable evidence archive. Fresh reviews requested for this draft head. |
|
Disposition of the non-blocking notes in the current-head Claude review:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e630d38651
ℹ️ 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".
|
@codex review Fixed the delivery cancellation finding in e278c57. Batch execution checks every active context token before dispatch, including retry invocations, and after async scope disposal before flushing sends or handling failures. Checks reuse existing loops and add 0 B. Three deterministic regressions fail on the previous head and pass with the fix: successful handler cancellation, cancellation during asynchronous disposal, and cancellation between attempts. They use a distinct delivery token and the default batch-call token, verify no cancelled-attempt sends, and verify context reuse. The full Release suite passes all 457 tests; Release build, Windows x64 Native AOT smoke and website build pass. The updated PR body records the hash-verified evidence archive and separates current validation from earlier benchmark measurements. Fresh review requested for this draft head. |
Review of PR #99 (batch receive/handler pipeline)I read the core change in Correctness
Performance
Tests and docs
I found no actionable issues. |
|
Codex Review: Didn't find any major issues. You're on a roll. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
@codex review Disposition of the notes in Claude's latest review:
All 461 Release tests, the clean Release build, Windows x64 Native AOT smoke (now exercising UTF-8 batch links), website build, 18 BenchmarkDotNet Dry cases and 18 ShortRun cases pass. Composed and direct dispatch allocations match for text and UTF-8 headers. The PR body records the limitations and hash-verified archive, including the before-source snapshot and regression patch. The incremental diff was reviewed with code-simplifier. The PR remains a draft; both reviewers must review this new head before promotion. |
|
Review of ac12c34 (batch handler composition). I read Prior findings
Correctness
Performance
Tests and docs
I found no actionable issues. |
|
Single-unit audit: Claude's current-head review is CLEAR for ac12c34. Both review threads are resolved, with no later reviewer replies, and all prior review findings have dispositions. Four automated review rounds and two force-pushes are below the rework limits. Codex's current-head review summary is still running. The request at #99 (comment) is less than 15 minutes old and has only an eyes reaction, so no duplicate request was posted. The PR remains a draft until Codex returns a positive verdict for this head; promotion and auto-merge are not yet allowed. No code changes or new validation were needed in this audit. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ac12c3432a
ℹ️ 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".
|
@codex review |
Review of #99: batch handler executionI read What looks right
Non-blocking suggestion:
Minor note: a failure inside No blocking correctness issues found. The earlier Codex review also found none. |
|
Codex Review: Didn't find any major issues. Swish! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
Disposition of Claude's current-head review:
The blocking Codex in-flight cancellation finding is fixed in da14c83 and dispositioned on its thread. Fresh Codex review was requested for this draft head; Claude has already returned CLEAR for this head. The PR body records current validation and the durable evidence archive. |
|
Promoted and armed auto-merge for da14c83 with scripts/Enable-AutoMerge.ps1 -Pr 99 -MarkReady. Claude returned CLEAR and Codex completed without findings for this exact head. Every review surface has been checked, all findings have dispositions, and all three review threads are resolved. All 1224 current evidence files were reverified against their originals before promotion. Ready CI is now the remaining merge gate. This single unit stops here and releases pr-99. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: da14c8302f
ℹ️ 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".
| await _failures.HandleAsync(context, error, action).ConfigureAwait(false); | ||
| } | ||
| else await _failure(context, error, action).ConfigureAwait(false); | ||
| } | ||
| count = pending; |
There was a problem hiding this comment.
Recheck cancellation after awaited failure handling
If cancellation occurs while the last item's failure delegate is awaited, the delegate can return normally and this loop exits with pending == 0, allowing ProcessBatchAsync to report success without checking either token again. This also affects executable failure handling when callers supply only the batch-call token, because FailurePipeline.HandleAsync observes the context's delivery token instead. The pre-dispatch and pre-flush guards do not cover this stage. Check cancellation after awaited failure work and before successful completion so cancelled batches cannot publish settlement decisions.
Useful? React with 👍 / 👎.
| public IEnumerator<BatchItem<TMessage>> GetEnumerator() | ||
| { | ||
| for (var i = 0; i < Count; i++) yield return Items[i]; | ||
| } |
There was a problem hiding this comment.
Reuse the batch-items enumerator instead of allocating it
When a handler enumerates batch.Items with foreach, this iterator creates a new heap object on every invocation, including after the dispatcher storage is warmed. At batch size one this becomes a steady-state per-message pipeline allocation. The new allocation tests and benchmarks use indexed loops, so they miss this public collection path. Provide reusable enumeration storage compatible with the borrowed handler-call lifetime and cover enumeration in the allocation regression test.
AGENTS.md reference: AGENTS.md:L29-L30
Useful? React with 👍 / 👎.
Batch receive now invokes generated batch handlers with the consumer's declared size, wait and concurrency. Each attempt has one async DI scope. Results reach native settlement only after durable work, scope disposal and successful direct-send flush. Failed items normally enter retry, redelivery or dead-letter handling individually; handler exceptions fail the invocation.
Direct sends use one buffer per attempt. A partial failure with buffered sends discards that buffer and routes every item through the normal failure policy, so a poison item reaches bounded retry/dead-letter handling instead of failing the receive call forever. Otherwise successful items can retry or dead-letter too. Explicit per-message durable outbox transactions support independent outcomes with outgoing messages. D28 and the user guides document this boundary and the borrowed lifetime of Batch, its items and contexts.
Native receive execution is selected once from cached endpoint capabilities and an available executor, capped by both count declarations and native byte limits. Otherwise the core accumulates individual receives to a fixed partial-batch deadline. Missing executors fail startup with transport/source/consumer context. Single-message middleware, telemetry and settlement callbacks are rejected in batch composition; adapters record endpoint metrics and settle around the completed call. The in-memory hosted adapter still explicitly rejects batch-handler composition. This PR supplies the core transport-author seam without changing native adapters.
Batch process spans link creation contexts and use only the ambient parent. Sampling inputs reuse precomputed tags, boxed counts and pooled link storage, including when a listener drops the span. #13 tracks shared-source integration.
Current validation on
da14c8302fe3108b761f76f274c8d0422bcc6d85:npm ci --no-auditand the website production build pass.[MemoryDiagnoser]buffered-send coverage passes all six Dry and six ShortRun cases at batch sizes 1/10/100 with shared or distinct delivery tokens. All allocate 400 B per batch, the existing DI baseline. ShortRun times are about 0.96 us, 6.37 us and 60�68 us per batch; a representative default-job size-1 case measures 1.137 us and 400 B. Timing is noisy and diagnostic only; these cases do not establish native-client throughput overhead (Benchmark suite with a CI regression gate #19). Initial benchmark attempts failed in the new fixture's synchronous cleanup; the committed fixture usesDisposeAsync, and the successful runs are in the*-fixedand ShortRun reports.Current raw logs/reports, before/after source snapshots, the regression patch, loaded test/benchmark binaries, generated benchmark harnesses and Native AOT executable are archived at
C:/git/Relayer-evidence/pr-99/da14c8302fe3108b761f76f274c8d0422bcc6d85/. All 1224 inventory files were verified against their originals with SHA-256;inventory.jsonSHA-256 isACFC94704EA73F8F55191A30DA194BFC2CF21CC6303030725B7D08E962111738. Standard 7-day evidence retention applies. Earlier evidence remains tied to its measured SHA.Earlier UTF-8 tracing validation on
ac12c3432a435f80ff03e0703ecd8b820d9ea4b1:MessageCreationContextparser. Native UTF-8 traceparent values no longer allocate an intermediate header string; text headers and native W3C parsing use the same established code. UTF-8 tracestate decoding retains the existing documented allocation boundary.npm ci --no-auditand the website production build pass.Earlier raw logs/reports, before/after source snapshots, the regression patch, loaded test/benchmark binaries, generated benchmark harnesses and Native AOT executable are archived at
C:/git/Relayer-evidence/pr-99/ac12c3432a435f80ff03e0703ecd8b820d9ea4b1/. All 1043 inventory files were verified against their originals with SHA-256;inventory.jsonSHA-256 is57F48A9E16F1EBB211B7FAA095A0437A2A418FBD430CE6E865EE059306241AF8. Standard 7-day evidence retention applies. Earlier evidence below remains tied to its measured SHA.Earlier cancellation validation on
e278c57e4d6687e7184c613244c77326d843642c:npm ci --no-auditand the website production build passed.Earlier logs, reports, source snapshot, loaded test binaries and Native AOT executable are archived at
C:/git/Relayer-evidence/pr-99/e278c57e4d6687e7184c613244c77326d843642c/. All 618 inventory files were verified against their originals with SHA-256;inventory.jsonSHA-256 is647C07D942FEB52DC30E9D9A3C7F92CB576BFE634D50128FF0EC73A7DB6B020A. Standard 7-day evidence retention applies.Earlier validation on
e630d38651ed3a70e8c5e847dacbbb15021b67b1, rebased onto main including #103, with no temporary patches:npm ci --no-auditand the website production build passed.Performance: successful dispatch adds no allocations beyond the measured scope/framework baseline. Tracing removes 200 B per batch of sampling preparation. Whole-attempt failure promotion adds one error-path linear pass and one shared exception only for partial failures with buffered sends. Existing single-message receive adds constant-time batch-mode checks, 0 B. Final diff reviewed for reuse, correctness and efficiency with code-simplifier. No native broker adapter behavior changes require a broker test in this core-seam PR.
Raw test/build/benchmark logs and reports, committed source snapshot, loaded test/benchmark binaries, generated benchmark harness and Native AOT executable are archived outside removable worktrees at
C:/git/Relayer-evidence/pr-99/e630d38651ed3a70e8c5e847dacbbb15021b67b1/. All 860 inventory files were SHA-256 verified;inventory.jsonSHA-256 is169A3CBE56FCFF7F3D87ADBCF33F5F1D2473270E16A84A24CE2D95C26CF018BE. Standard 7-day evidence retention applies. Earlier measurements remain tied to their earlier SHA directories.Closes #11