Plan: Audit Batched Claims — One Commit per Batch for the Audit Subscriber (#2765)

Status

Done (2026-11-12) — all four units merged; the audit subscriber batches at 16 by default after the 2026-11-12 re-measurement (#2765).

Context

  • The cap. craig-security’s audit subscriber binds #: every fleet event passes one serial consumer running one transaction and one COMMIT per envelope (inbox.rs handle_idempotently, subscriber.rs run_session in craig-mq), so commit latency bounds its throughput. The sink once fell 67 s behind (#2699); cargo xtask diag inbox-latency ran 1289 envelopes/s at baseline and 8–60/s once WAL load stretched commit p50 to 88 ms. That is susceptibility, not the incident’s cause (#2699 keeps it). Batching amortizes the commit; U4 measures the gain through the real subscriber, and the measurement decides the default.

  • What it re-decides. ADR-062’s "one transaction per attempt", for an opted-in subscriber (U1, before U2; #2765 AC1); other subscribe_idempotent consumers keep their behaviour and SQL. Binding input: #2765’s constraints and criteria, with one amendment (D6: a failed batch is arbitrated locally, not requeued); its created_at is audit_log.timestamp. Prerequisite #2770 gives the single path the resync D4 reuses. On approval U1–U3 become child issues of a new epic (Plan::AUDIT-BATCHED-CLAIMS) holding #2765 as U4.

Design

D1. The opt-in API (craig-mq)

  • crates/craig-mq/src/inbox_batch.rs (new, re-exported at the crate root):

    • BatchPolicy::new(max_envelopes: u16) → Result<BatchPolicy, BatchPolicyError> (thiserror) refuses 0 and anything above PREFETCH (16, subscriber.rs:56, raised to pub(crate)).

    • BatchInbox<'a, E> { pool, publisher, policy, is_statement_timeout: fn(&E) → bool }. The classifier recognises the batch’s 2 s cap in a handler error (E carries no SQLSTATE); craig-security’s downcasts anyhow::Error to sqlx::Error and tests 57014.

    • pub async fn handle_batch(inbox: &BatchInbox<'_, E>, consumer_queue, envelopes: Vec<EventEnvelope>, handler: H) → BatchReport<E>: one BatchVerdict per input, in input order: Committed(Committed<E>), Deferred(DeferReason), Carried or Arbitrate (the batch failed, D6). finish_committed(inbox, consumer_queue, Committed<E>) → Result<(), InboxError<E>> runs one delivery’s post-commit work and returns what handle_idempotently would have, so it settles exactly as today. A counted failure carries the text invoke_handler rendered before the commit.

  • Subscriber::subscribe_idempotent_batched(&self, inbox: BatchInbox<'_, E>, queue_name, routing_keys, shutdown, heartbeat, handler); handler bound, queue declaration and settle label as subscribe_idempotent’s. The doc states the handler obligations: `now() is the batch’s start, so per-event times use clock_timestamp() (D8); a handler sets no SET LOCAL (it would persist into later envelopes) and takes no savepoint (D3’s subtransaction cap).

D2. The round (session side, new crates/craig-mq/src/subscriber_batch.rs)

run_batch_session replaces run_session for a batched subscription, in a supervise_batched loop mirroring supervise_regular; the session helpers it shares (next_delivery, the settle helpers, run_contained_handler, SessionEnd, ReceiveClock) become pub(crate). One round:

  1. Collect: wait with next_delivery unless carried deliveries are held, then take those, the one waited for and the buffered ones (consumer.next().now_or_never()), up to K; undecodable bodies and consumer errors as today.

  2. Partition: a redelivered delivery goes solo, never into a batch; the rest are candidates in arrival order.

  3. Batch: the candidates run through handle_batch in one contain boundary (#1203) ending at the confirmed commit.

  4. Settle: ack every committed delivery that needs no post-commit work (multiple: false) and beat; then, in arrival order, each one that does: finish_committed inside its own contain, settle as today, beat.

  5. Arbitrate: when the batch failed, its admitted and deferred deliveries join the solo list, still unacked.

  6. Solo: the solo list (redelivered, deferred, arbitrated) runs through run_contained_handler over handle_idempotently, beating after each and checking shutdown between; carried deliveries lead the next round.

D3. Lock-hold budget and admission

A batch holds every claimed row’s lock until its COMMIT, so the batch must fit ADR-062’s bound (adr-062:81-84): a duplicate waits under the 30 s default statement_timeout (craig-db statement_timeout_ms). The constants live in inbox_batch.rs; compile-time asserts pin the reserve’s sum, a positive cutoff and BATCH_HOLD_BUDGET < 30 s.

Constant Value Bounds

CLAIM_LOCK_TIMEOUT

50 ms

lock_timeout of claim-phase statements: the wait on another transaction’s row

CLAIM_STATEMENT_TIMEOUT

1 s

each claim-phase statement (the INSERT, the FOR UPDATE)

BATCH_STATEMENT_TIMEOUT

2 s

each restamp-, handler- and completion-phase statement

BATCH_HANDLER_DEADLINE

5 s

one handler future (expiry defers the envelope uncounted, D4)

ENVELOPE_RESERVE

15 s

worst path 13 s: claim 1 s + FOR UPDATE 1 s + restamp 2 s + handler 5 s + a dropped statement’s drain 2 s + one completion statement 2 s; 2 s for the savepoint and SET round trips

COMMIT_RESERVE

1 s

the commit phase’s statement_timeout and lock_timeout (deferred triggers, constraints)

ROUND_TRIP_SLACK

1 s

each statement’s client-side timeout is its server timeout plus this; expiry aborts the batch

BATCH_HOLD_BUDGET

21 s

first claim statement to the end of `COMMIT’s interruptible work

ADMIT_CUTOFF

5 s

BATCH_HOLD_BUDGET − ENVELOPE_RESERVE − COMMIT_RESERVE

Admission is a pure fn admit(hold: Duration, admitted: usize, policy: BatchPolicy) → Admission, called before each claim: it flushes with Count once K are admitted, with Budget when hold > ADMIT_CUTOFF, and otherwise admits; hold runs on tokio’s clock from the first claim statement, so the first envelope is always admitted. Running out of candidates is Drained; a flushed remainder is Carried.

The bound is conditional. Every interruptible wait is bounded (server and client timeouts per statement, the handler deadline, resync): an envelope admitted at hold ≤ 5 s ends its worst path by 18 s, the commit phase’s interruptible work by 19 s. The WAL flush inside COMMIT (a critical section) and a transport stall the server has not noticed are not interruptible; the single path shares both, so ADR-062’s 21 s is equally conditional (U1 says so). Beyond the bound a duplicate’s claim fails at its 30 s timeout, uncounted, takes today’s first-strike requeue and dedups once the commit lands; a client COMMIT timeout leaves the outcome uncertain (D6): no client timer undoes a commit in progress. #2765 AC4 is read against this bound. Two subtransactions per envelope (32 at K = 16) stay under PostgreSQL’s 64-entry per-backend cache, which caps K.

D4. One envelope inside the batch, and the commit phase

Each phase sets both timeouts itself, before its savepoint (SET LOCAL outlives RELEASE and is restored by a rollback to an earlier savepoint), so no phase inherits another’s; a phase’s fixed-text statements share one sqlx::raw_sql round trip. Reused from inbox.rs, raised to pub(crate): AttemptCtx, Conflict, classify_conflict, count_failed_attempt, log_failed_attempt, surface_terminal, handle_collision, StageClock, resync (from #2770), and invoke_handler, which gains a deadline: Duration parameter.

  1. Claim. SET LOCAL lock_timeout = '50ms'; SET LOCAL statement_timeout = '1s'; SAVEPOINT claim, the claim INSERT … ON CONFLICT (envelope_id) DO NOTHING (received_at and attempt_started_at from one clock_timestamp()), then classify_conflict (FOR UPDATE) on a conflict. SQLSTATE 55P03, 40P01, 57014 or Conflict::Vanished: roll back to and release claim, Deferred (D5). AlreadyDone is provisionally deduplicated, TerminalUnsurfaced terminal, Collision a collision (canonical row locked, untouched), each releasing claim; a fresh claim or a Retry goes on holding claim.

  2. Handler. SET LOCAL statement_timeout = '2s'; SET LOCAL lock_timeout = DEFAULT; on Retry the attempt_started_at = clock_timestamp() restamp; SAVEPOINT attempt; invoke_handler(…, BATCH_HANDLER_DEADLINE).

  3. Completion. Success: release attempt, processed_at = clock_timestamp(), release claim. Handler error or tier-1 panic: count_failed_attempt, release both; the count commits with the batch. A batch-budget expiry (the 5 s deadline, a batch statement’s 57014, a handler error is_statement_timeout accepts) rolls back to and releases claim: Deferred(BatchBudget), uncounted; its solo run gets today’s budgets, where a deadline still counts.

  4. Resync. A deadline that drops the handler mid-statement leaves that statement’s result owed: sqlx drains it before the next statement and returns its error (sqlx-postgres 0.8.6 connection/mod.rs:85-98). Before any rollback, resync pings until the connection is idle: a database error is the dropped statement’s own and is absorbed; an I/O error or its 3 s bound aborts the batch. Only then ROLLBACK TO SAVEPOINT, whose failure aborts it.

  5. Commit phase. SET LOCAL statement_timeout = '1s'; SET LOCAL lock_timeout = '1s', then COMMIT, so no envelope’s leftover settings govern deferred work.

Any other error (an unlisted SQLSTATE in the claim savepoint, a statement outside a savepoint, the connection, a client round-trip timeout) aborts the batch (D6). A second copy of an envelope id is Deferred(DuplicateId) before its claim.

D5. Deferred claims

DeferReason is a closed set: Contended (55P03, 40P01), ClaimTimeout (57014), Vanished, DuplicateId, BatchBudget. A deferred delivery has no accounting in the batch. It runs solo after settlement through handle_idempotently, whose claim waits under the 30 s default, by then only on the foreign holder. Two batches cross-claiming each other’s rows both defer within 50 ms, below the 1 s deadlock_timeout default, so neither is a deadlock victim; both commit and the solo runs dedup.

D6. Commit, settlement and arbitration

  • Committed. Outcomes stay provisional until COMMIT returns Ok. Settlement is per delivery (D2 step 4): plain acks first, then each delivery’s post-commit work (surface_terminal from the durable row, handle_collision), settle, beat. A stalled DLX confirm (CONFIRM_TIMEOUT, 10 s) delays only later surfacing deliveries, never the heartbeat (the liveness threshold is 120 s). A Failed delivery climbs its own 2-strike ladder, never its siblings'. A settlement failure tears the session down (#1197); the unsettled redeliver into dedup.

  • Failed. A statement error that aborted the transaction, a lost connection, a client timeout, any COMMIT error (uncertain: the server may have committed) or a tier-2 panic before the commit makes every admitted and deferred verdict Arbitrate. The session keeps those deliveries unacked and runs each solo (D2 step 6): its claim arbitrates (a commit that landed dedups; a rolled-back one runs again), and its own outcome takes today’s strike ladder. No nack, strike or marker touches a sibling, and nothing session-local can be lost: no delivery leaves this consumer, so the guarantee holds across consumers and versions. The failed batch’s connection is closed, not returned. This amends #2765’s constraint "left for inbox arbitration (requeue)": arbitration runs here, through the inbox claim.

  • Panics. Before the commit: the batch fails, as above. In a delivery’s post-commit work: its effects are durable; the delivery is nacked with requeue and its redelivery dedups. Nothing renders E after the commit.

D7. Failure semantics

Case Inside the batch Batch committed Batch failed

Handler Ok

stamped processed

ack

solo here, runs again

Handler error, tier-1 panic

rolled back to attempt; counted

its own 2-strike ladder

solo here

Handler deadline, 2 s statement cap

resync, rolled back to claim; uncounted

solo after settlement

solo here

The count reaches 5

counted

terminal surface, then ack or requeue-durable

solo here

Row already processed or failed

locked

ack (dedup)

solo here, dedup

Row at the cap, unsurfaced

locked

terminal surface, then ack or requeue-durable

solo here

Identity collision

canonical row locked, untouched

ledger row and surface; nack without requeue

solo here

Contended or timed-out claim, vanished row, second copy

rolled back to claim

solo after settlement

solo here

redelivered set

not admitted

solo

solo

Flushed by count or budget

not claimed

leads the next round

leads the next round

Panic in post-commit work

durable

nack with requeue; redelivery dedups

—

Crash or session loss

rolled back if uncommitted

redelivered solo; dedup

redelivered solo; runs again

D8. Per-envelope times and the detection guarantee

  • craig-mq (batch SQL only). received_at, attempt_started_at and processed_at take clock_timestamp(); failed_at keeps now() in its own post-commit statement. The single path’s SQL is unchanged.

  • craig-security. store::audit::insert_audit_entry writes timestamp = clock_timestamp() and store::archive::insert_ledger_row archived_at = clock_timestamp(): the detection windows' own clock, and solo runs reuse handle_idempotently as is.

  • Detection. A threshold rule counts rows stamped within window_minutes (W) before each scan; scans run every I seconds and skip missed ticks (detection.rs:76-79). A row stamped at T is visible at its commit, T + d, so a cluster is guaranteed to fire only when its span ≤ W − I − d: some scan then holds every row in its window. Today d is the rest of the row’s attempt (milliseconds); batched, it is the rest of its batch: milliseconds when handlers are fast, at most 19 s of interruptible work, longer only under a WAL stall, as today. Sampling already misses clusters wider than W − I; batching narrows the guarantee by d. U4 documents it and tests both sides; exact sliding-window detection, independent of scan alignment and commit lag, is #2771.

D9. Observability and the transaction-count oracle

  • Per envelope, StageClock charges claim, handler, complete, surface, total; acquire and commit are batch stages (0 in its inbox attempt timings event, emitted with the confirmed outcome).

  • New metrics::inbox_batch (otel and stub twins): craig_mq_inbox_transactions_total{queue, mode} (batch / single, +1 per successful attempt-transaction BEGIN), craig_mq_inbox_batches_total{queue, outcome} (committed / arbitrated), …batch_envelopes{queue}, …_batch_seconds{queue, stage} (acquire, hold, commit), …_batch{flushes,deferrals}_total{queue, reason}; the settle labels gain nack_requeue. The oracle sums the transaction counter for a test’s unique queue through its own OTel → Prometheus bridge (the metrics.rs precedent), never timestamps or xmin.

D10. Pool and deployment

CRAIG_SECURITY__AUDIT_BATCH_MAX (1–16) is a field of craig-security’s own settings struct, validated at boot; 1 subscribes through subscribe_idempotent. Its default is 16 only if U4’s comparison meets its target, else 1. The 3-connection consumer pool (EVENTS_CONSUMER_POOL_CONNS, lib.rs:464) is unchanged: the batch holds one connection until COMMIT; post-commit work and solo runs take one at a time. No migration, no deployment barrier: a single-path replica and a batch contend as any two claimers (D3, D5).

Scope

Order: #2770 → U1 → U2 → U3 → U4, each with its canonical doc page and a CHANGELOG.adoc == Unreleased entry. This page’s MR adds its nav entry; U2’s MR sets Status In progress.

U1 — docs(adr): amend ADR-062 for an opted-in batched inbox (weight 2, P2-medium, docs/abc-u1-adr-062-batch-amendment, after plan approval)

  • Docs: ADR-062 gains § "#2765 — an opted-in subscriber commits a batch per transaction": the re-decision for subscribe_idempotent_batched callers; D3’s conditional bound, stated for both paths (the WAL flush and unnoticed transport stalls are outside it); local arbitration of a failed batch; D4–D8 in summary; and the rejected alternatives: synchronous_commit = off (a crash after the ack loses acked audit rows), and parallel consumers (group commit does share WAL flushes, but they add connections and lock holders, give up ordering and leave the gain to commit tuning, where a batch amortizes explicitly).

  • Gate: merges before U2 starts. Code / Tests: none. CHANGELOG: === Changed.

U2 — feat(mq): run a batch of inbox attempts in one transaction (weight 8, P2-medium, feat/abc-u2-inbox-batch, after U1, #2770)

  • Code: inbox_batch.rs (D1’s types, D3’s constants and admit, D4–D6’s database side, finish_committed); in inbox.rs the visibility raises, the deadline parameter and the single counter; metrics::inbox_batch.

  • Tests (crates/craig-mq/tests/inbox_batch.rs, a scratch database per test; inbox_tx.rs’s helpers move unchanged to `tests/common/inbox.rs):

    • Functional: 8 envelopes commit claims, effects and stamps in one transaction (oracle = 1), stamps distinct and ordered; a processed id dedups; a second copy defers; an anyhow-wrapped 57014 defers uncounted through the classifier while a genuine anyhow error counts.

    • Fault injection: a handler error and a tier-1 panic count while siblings commit; the deadline and pg_sleep(3) under the 2 s cap defer uncounted; drain overlap: a handler starting pg_sleep(3) at 4.9 s is dropped, resync absorbs the drained error, it defers and later siblings commit on the same transaction; a poisoned COMMIT, a terminated backend (fault/pg_terminate.rs) and a pre-commit tier-2 panic each give Arbitrate for all, nothing persisted; at the cap with the DLX unroutable, finish_committed returns SurfaceFailed, failed_at NULL.

    • Commit phase: a trailing dedup or deferred envelope with 0.5 s of deferred-trigger work commits; with 2 s the commit phase cancels into Arbitrate, whichever envelope is last. Concurrency: cross-claiming batches both defer, each effect lands once; a foreign claim defers its envelope within 50 ms (+ 200 ms tolerance), siblings commit.

    • Invariant (AC4), crates/craig-mq/tests/invariants/: 16 envelopes sleeping 2 s flush with 3 admitted while a duplicate claimer of the first waits under the interruptible bound and dedups; a commit-phase stall cancels within the bound and the waiter dedups or processes after arbitration; a transport stall (toxiproxy via fault/pg_transport.rs, #[ignore = "requires devstack"]) hits the client COMMIT timeout and arbitration dedups or processes; a proptest keeps any simulated interruptible hold ≤ BATCH_HOLD_BUDGET.

    • Recovery: after each abort the same pool’s next batch commits. Unit: BatchPolicy refuses 0 and 17.

  • Docs: shared-crates.adoc § craig-mq. CHANGELOG: === Added.

  • Erratum (2026-10-26): finish_committed returns InboxError<RenderedError> (the pre-commit text), and BatchReport and Committed carry no E, so nothing renders E after the commit (D6).

  • Erratum (2026-10-26): a failed batch’s transaction is dropped, not its connection closed; sqlx’s rollback-on-drop and release ping decide reuse, as on the single path (D6 corrected).

  • Erratum (2026-10-26): a handler that reaches BATCH_HANDLER_DEADLINE leaves the hold past ADMIT_CUTOFF, so the envelopes after it are Carried; the drain-overlap and deadline tests assert that the sibling claimed before it commits on the same transaction.

  • Erratum (2026-10-26): the commit phase also runs SET CONSTRAINTS ALL IMMEDIATE — PostgreSQL disables statement_timeout before commit processing, so deferred constraint work at COMMIT would otherwise be unbounded (D4 commit phase corrected; the single path’s same gap is #2775).

U3 — feat(mq): opt a subscription into batched inbox claims (weight 5, P2-medium, feat/abc-u3-batched-subscription, after U2)

  • Code: subscribe_idempotent_batched, supervise_batched, subscriber_batch.rs (D2, D6), the helper raises, SettleOutcome::NackRequeue, and fault-injection hooks (the arm_stage_fault precedent): arm_batch_settle_fault ends the session after the commit with nothing settled; arm_finish_panic panics in one delivery’s post-commit work.

  • Tests (crates/craig-mq/tests/inbox_batch_subscriber.rs, a scratch vhost and database per test; a burst is made deliverable at once by subscribing, cancelling, publishing, resubscribing):

    • Functional: 64 envelopes yield 64 effects, each once, in fewer than 64 transactions.

    • Arbitration: a poisoned COMMIT runs every delivery solo on the same consumer, none nacked, error_count 0, and with a second batched and a subscribe_idempotent consumer on the queue no member reaches either; a tier-2 panicking envelope’s batch arbitrates and its own solo run climbs its own ladder.

    • Fault injection: a failing envelope climbs its own ladder while each sibling runs once; 15 at-cap envelopes with stalled confirms (toxiproxy, fault/mq_transport.rs) and a healthy sibling: the sibling is acked first, heartbeat gaps stay under 120 s; arm_finish_panic leaves durable effects and the redelivery dedups; the settle fault rebuilds the session into dedup; a redelivered delivery never joins a batch; each carried delivery settles once.

    • Recovery / shutdown: transport_faults.rs and subscriber_shutdown.rs gain the batched legs. Unit: the labels.

  • Docs: shared-crates.adoc § craig-mq. CHANGELOG: === Added.

  • Erratum (2026-10-26): the stalled-confirms test uses 3 at-cap envelopes (15 × the 10 s confirm timeout exceeds the test runner’s 120 s kill); per-delivery beats are asserted directly.

  • Erratum (2026-10-26): a post-commit panic’s redelivery re-claims the durable row — a processed one dedups, a counted failure retries, a terminal or collision row re-runs its surface or record (D6/D7 corrected);

U4 — fix(security): batch the audit subscriber’s inbox claims so one commit carries many envelopes (#2765; weight 5, P2-medium, fix/abc-u4-audit-batch, after U3)

  • Code: the AUDIT_BATCH_MAX setting (D10); a pub(crate) subscribe_audit picking the batched or single subscription, called by spawn_audit_subscriber and the C14 audit rig in lib.rs’s test module; D8’s two inserts; the probe (`services/craig-security/examples/inbox_latency_probe/) gains --path single|batched and --batch-max K, driving a published burst through the real audit subscriber on a scratch vhost.

  • Tests (that test module, on a scratch vhost):

    • Burst (AC2): 64 distinct test.audit_probe envelopes delivered at once yield exactly 64 audit rows and 64 processed claims with error_count 0, in fewer than 64 transactions.

    • Times (AC5): timestamps distinct, increasing in attempt_started_at order, each ≥ its claim’s; two handle_inbound_event calls in one transaction, pg_sleep(0.01) apart, store distinct timestamps.

    • Detection: with a threshold-2 rule, a row inserted earlier and a row whose batch commit a slow sibling delays by d, a scan after the commit fires when the rows' span ≤ W − I − d, and the documented miss holds when the older row leaves the window before the commit.

    • Setting: 0 and 17 refuse boot; 1 selects the single path. The C14 disconnect legs run batched, unchanged. AC6: craig-cases' tests/api/ive_determination.rs and person_identifiers.rs and craig-composition’s tests/api/act_events.rs stay unedited.

  • Measurement (the default’s gate): cargo xtask diag inbox-latency --path batched --batch-max 16 against --batch-max 1, phase A (baseline) and B (WAL load), three runs of 2000 envelopes each: throughput, drain time, audit lag p50/p99, batch occupancy, deferrals, arbitrations, commit p50/p99. Default 16 when phase B drains ≥ 3× faster and phase A runs ≥ 0.9×; otherwise default 1, the MR says Relates to #2765, and the figures go on #2765 and an erratum.

  • Docs: data-model-security.adoc (the timestamps; the detection guarantee at window_minutes), configuration-reference.adoc. CHANGELOG: === Changed; Ops note: no migration or barrier, the setting, metrics.

  • Close-out: Status Done (<date>) — !<U4>, git mv into plans/archive/, the nav entry, an archive row, cargo xtask plan-lint --done.

  • Erratum (2026-10-26): subscribe_audit and the timeout classifier are #[doc(hidden)] pub, not pub(crate), so the inbox-latency probe (an example) drives the real subscriber.

  • Erratum (2026-10-26): CRAIG_SECURITY__AUDIT_BATCH_MAX is read directly from the environment at boot by a pure, typed parse_audit_batch_max (the DETECTION_INTERVAL_SECS precedent, without its silent default), not a settings-struct field: craig-security has no settings of its own outside the shared ServiceSettings; this supersedes D10’s settings-struct wording.

  • Erratum (2026-10-26): the comparison missed its target — under phase B, K = 16 (--path batched --batch-max 16) drained 2.83× faster than K = 1 (--path single), median of three 1832 ms against 5182 ms for 2000 envelopes, where 3× was required; phase A ran 1.99× (1133 ms against 2259 ms) — so the default is 1, the MR relates to #2765 rather than closing it, and the figures go on #2765.

  • Erratum (2026-10-26): the detection guarantee is strict (span < W − I − d) and I is the effective interval between completed scans (a skipped tick lengthens it); the tests prove an interior fire and an expiry miss, not the literal boundary (D8 qualified).

  • Erratum (2026-11-12): the default is 16. The maintainer ruled (2026-11-06) that the default be re-judged under sustained WAL pressure; re-measured with three runs per cell, K = 16 drained 5.62× faster than K = 1 under WAL load and 2.28× at baseline over 20,000 envelopes (medians 21272 ms against 119653 ms, and 9155 ms against 20908 ms), which meets the 3× and 0.9× target. Over the 2,000 envelopes this unit names, a run that mostly ends before the load’s checkpoint starts, it measured 1.84× and 2.28×; the maintainer judged the default on the longer cell. Figures are on #2765.

Out of scope

  • Other consumers (each opts in by its own issue); parallel sessions; a larger PREFETCH; the DLQ subscriber; #2699’s cause and WAL settings; the single path beyond #2770; exact detection (#2771); #1214.

Risks

  • Tighter bounds. A statement over 2 s or a handler over 5 s defers and re-runs solo on today’s budgets.

  • Shutdown mid-arbitration. Unsettled deliveries redeliver with redelivered set, as today’s prefetched ones do; a later failure dead-letters one strike early, and admin replay recovers.

  • Commit-only gain. Batching amortizes the commit fsync, not WAL-insert waits; U4’s measurement decides the default.

Review log

Round Vendor Resolved model Verdict

1

Anthropic

Claude Opus 5.5 (fresh subagent)

no-ship (1 blocker: the statement-timeout classifier; folded)

2

OpenAI / Codex (maintainer-run)

GPT Astra per the maintainer

no-ship (10 findings; folded)

Edit this page · latest