openai / gpt-6.1-sol / xhigh / xhigh effort preferred over openai / gpt-6-astra / high / high effort · close win.
Primary judge: Sol 6.1, requested Low. Effective provider effort and internal attempts were not verified. A close win is still a scored preference; it does not establish a material defect.
Reviewed public evidence
Task goal
Design a durable webhook inbox for one PostgreSQL database and multiple workers. An authenticated source supplies eventID, accountID and payload; deliveries are duplicated and reordered. Persist acknowledgement before returning success, deduplicate by source/account/eventID, process with expiring leases and fencing, preserve per-account dependencies, bound retries and poison events, and recover crashes without claiming exactly-once external effects. Define state transitions, transaction boundaries, backpressure and acceptance failure cases.
Give one coherent design with explicit requirements, assumptions and alternatives, state/invariant/transaction details appropriate to the stated scope, and measurable pass/fail acceptance checks. Do not invent benchmark measurements, provider costs, source inspection, executed tests or objective passes. Every contributor must independently answer the complete identical question; there are no separate roles, files or tool evidence.
openai / gpt-6.1-sol / xhigh / xhigh effort answer
## Recommendation and scope
Use PostgreSQL as the authoritative receipt ledger, dependency scheduler, lease authority, and effect-intent store. Workers execute **at least once**; database fencing prevents stale workers from committing database changes. External effects require downstream idempotency or reconciliation—this design does **not** claim exactly-once external execution.
This is an independent, reasoning-only assessment based on the supplied requirements. No source inspection or tests were performed.
### Required assumptions
1. Authentication determines a stable `sourceID`; the request body cannot choose it. The source is authorized for the canonical `accountID`.
2. `(sourceID, accountID, eventID)` identifies one immutable event.
3. The source retries non-successful or uncertain deliveries, or provides an authoritative reconciliation API.
4. **Dependencies are knowable.** A versioned adapter must derive complete prerequisite event identities from the payload or a trusted domain contract. Arbitrarily reordered `eventID`, `accountID`, and opaque payload alone cannot reveal causal order. Serializing receipt order does not solve this.
5. All relevant database business mutations use the fenced transaction protocol.
6. PostgreSQL uses durable WAL commits. An asynchronous failover may lose acknowledged events; zero acknowledged-event loss across failover requires an appropriately configured synchronous replication/failover policy.
The design below supports per-account dependency graphs. A source sequence can be translated into predecessor dependencies when that source guarantees a complete sequence and a known starting point.
## 1. Persistent model and invariants
| Record | Essential contents |
|---|---|
| `inbox_event` | Composite event key; immutable payload/digest; adapter version; acceptance time; state; processing phase; attempts; next eligible time; processing deadline; lease epoch; error/outcome |
| `event_dependency` | Child key and prerequisite key, including prerequisites not yet received |
| `account_gate` | Canonical account; monotonically increasing epoch; current event; lease owner; lease expiration |
| `effect_intent` | Event key and effect number; immutable operation; stable idempotency key; confirmation/ambiguity state |
| Deduplication tombstone | Event key, payload digest, receipt and terminal outcome after payload removal |
Use a unique constraint on `(sourceID, accountID, eventID)`. Dependencies may cross source namespaces but must remain within the same canonical account. Validate those references against the domain contract.
**Invariants**
- There is at most one logical inbox event per deduplication key.
- A receipt is acknowledged only after its database transaction commits durably.
- An accepted event’s payload and dependency set never change silently.
- An event is eligible only when every prerequisite is `SUCCEEDED`.
- Each account has at most one current database lease.
- Every worker mutation validates the current event, owner, epoch, and lease under the account lock.
- `SUCCEEDED` means the defined processing obligations have completed—not merely that a worker started or that an external request was sent.
- Poisoning or blocking a prerequisite never counts as successful dependency satisfaction.
- Every automatic execution has a finite attempt and time budget.
One account-wide epoch fences all workers for that account. Separate accounts can execute concurrently.
## 2. Admission and acknowledgement transaction
Before opening the transaction:
- Authenticate and authorize the source/account.
- Enforce bounded event identifiers, payload size, schema complexity, and dependency count.
- Apply a documented payload canonicalization rule. Without one, differing payload bytes are a conflict.
- Extract dependencies using the selected, versioned adapter.
For an already accepted key, compare the immutable payload digest:
- Same content: return the durable receipt, including when the event is poisoned or completed.
- Different content: return a conflict, such as `409`; retain the original event and record the conflict. Never overwrite it.
For a new event, one short transaction:
1. Lock applicable capacity reservations and the account, using a consistent lock order.
2. Recheck the unique key to handle concurrent duplicate deliveries.
3. Enforce admission quotas.
4. Insert the event, dependency edges, receipt, and quota accounting.
5. Check the bounded account dependency graph for cycles. Persist any necessary quarantine decisions.
6. Commit.
Only then return `2xx`. That response means **durably received**, not successfully processed.
No network calls or handler execution occur inside this transaction. Notifications may wake workers after commit, but durable polling is the recovery mechanism.
**Admission failures**
- Authentication/authorization failure: `401`/`403`.
- Structurally invalid request: `400`/`422`; oversized request: `413`.
- Capacity exhausted: `429` or `503`, normally with `Retry-After`.
- Database unavailable, transaction failed, or commit outcome uncertain: no success acknowledgement.
If commit succeeds but the response is lost, redelivery finds the same receipt. Uncertainty is resolved by the unique key, not by inserting another event.
## 3. State machine and dependency handling
Use these processing states:
| State | Meaning and transitions |
|---|---|
| `WAITING` | Accepted; may await prerequisites. Eligible events can become `LEASED`. |
| `LEASED` | A worker owns the current execution attempt. Can become `SUCCEEDED`, `RETRY_WAIT`, or `POISON`. |
| `RETRY_WAIT` | Retryable failure or expired lease; becomes eligible after backoff, subject to dependencies and budgets. |
| `SUCCEEDED` | Required processing completed; terminal under normal operation. |
| `POISON` | Permanent failure, invalid dependency cycle, or exhausted execution budget. |
| `BLOCKED` | Cannot proceed because of a failed prerequisite or an unresolved dependency deadline. |
Persist a separate processing phase, such as `PREPARE` or `DISPATCH`, so retrying an external operation does not recreate its effect plan.
An event with missing prerequisites remains durable but ineligible. Later arrival of a prerequisite can make it eligible after that prerequisite succeeds. Independent ready events on the same account may proceed; descendants of a poison event may not.
Use bounded dependency counts and bounded unresolved graphs per account. Detect cycles under the account lock. A missing prerequisite exceeding its configured deadline becomes `BLOCKED` and generates an alert or reconciliation task; it is not assumed successful.
If the domain requires a strict account sequence, express it as a dependency chain. A missing or poisoned predecessor then blocks later events deliberately. Gap skipping requires authoritative, audited domain resolution.
## 4. Claim, heartbeat, completion, and recovery
### Claim transaction
Workers select eligible accounts with `FOR UPDATE SKIP LOCKED`, then:
1. Lock the account and candidate event.
2. Read database time **after acquiring the lock**.
3. If the previous lease expired, transition that attempt to retry or poison according to its budgets.
4. Verify prerequisites, retry time, attempt limit, and deadline.
5. Increment the account epoch.
6. Set the current event, owner, and lease expiration.
7. Mark the event `LEASED`, record the epoch, and increment its attempt count.
8. Commit.
Every granted lease—including one lost to a crash—consumes an attempt.
### Heartbeats
A heartbeat is a short transaction that locks the account and verifies the current event, owner, epoch, and an unexpired lease.
- Valid: extend the lease.
- Expired or superseded: reject the heartbeat. The worker must stop trying to mutate database state.
- Renewal cannot extend beyond a configured maximum attempt duration.
Use PostgreSQL time, not worker clocks. Avoid transaction-start timestamps for expiration checks in transactions that may have waited for locks.
### Completion
For database-only processing:
1. Compute outside the transaction where possible.
2. Lock the account and event.
3. Validate ownership, epoch, lease, and prerequisites.
4. Apply business mutations and mark `SUCCEEDED` in the **same transaction**.
5. Clear the account lease and commit.
The account lock serializes completion against takeover. If expiration passes while this short transaction holds the lock, a new owner must wait; expiration makes reclamation eligible, not permission to bypass the locked transaction. Enforce transaction and lock timeouts.
### Crash recovery
Polling workers or a reaper reclaim expired leases using the same account-lock protocol. Expiration invalidates the old attempt; the next grant receives a new epoch.
A resumed old worker cannot renew, fail, complete, or write business state with its previous token.
`SKIP LOCKED` improves concurrency; it does not itself provide fencing or fairness.
## 5. External effects without an exactly-once claim
For an event requiring external work:
1. Under its valid lease, commit an immutable `effect_intent` and any necessary staged local data.
2. Persist phase `DISPATCH`, retaining the event lease.
3. Make the external call **outside** the transaction.
4. In another fenced transaction, record confirmed outcomes.
5. Once all required effects are confirmed, atomically finalize local business state, mark `SUCCEEDED`, and release the account.
After a crash, another worker resumes the persisted phase and effect plan. There is no unfenced, independent outbox consumer: dispatch uses the same account lease protocol.
Use a stable idempotency key derived from event identity and effect number. It must **not** change with the lease epoch.
Where supported, also send the account epoch. A downstream fence must check and persist its highest observed epoch atomically with the mutation. Checking only at request start is insufficient.
**Important limits**
- Remote fencing does not revoke an old request merely because its PostgreSQL lease expired. It can reject stale mutations after a newer epoch is established downstream.
- Fencing alone does not deduplicate repeated effects.
- A timeout after sending a request means **unknown outcome**, not known failure.
- If the remote system supports durable idempotency or authoritative lookup, retry or reconcile the stable key.
- Without either capability, retries may duplicate effects. Ambiguous events must enter reconciliation/quarantine rather than being declared successful.
A dependent event waits for its prerequisite’s required external outcomes—not merely for creation of an outbox row.
## 6. Retry, poison, and retention policy
Configure finite limits:
- `K`: maximum automatic lease grants per event.
- `A`: maximum event processing age.
- `D`: maximum duration of one attempt.
- Capped exponential backoff with jitter.
- Maximum required effects and dependency count.
Classify failures:
- Temporary database/network/provider failure: retry within the budgets.
- Permanent handler or domain failure: poison immediately.
- Expired lease: retry or poison; the consumed attempt remains counted.
- Unknown external outcome: reconciliation-aware retry, then quarantine if unresolved.
- Missing or failed prerequisite: block, never bypass.
Keep error categories, attempt history, effect identities, and reconciliation information. Avoid sensitive payloads in logs.
Operator replay must be authenticated, audited, explicitly bounded, and fenced. It must reconcile previously attempted external effects before repeating them. Skipping an event cannot silently release its dependents.
**Deduplication retention is a correctness requirement.** If redeliveries can occur indefinitely, retain event keys, digests, and dependency outcomes indefinitely. Payloads can have a shorter retention policy. Finite key retention is safe only with a trustworthy redelivery horizon or source watermark. Unbounded identities imply eventual storage growth; backpressure cannot be eliminated by silently forgetting them.
## 7. Backpressure and operational bounds
Apply:
- Per-source request-rate limits.
- Per-account pending-event and byte limits.
- Global retained-storage admission limits, with WAL and maintenance headroom.
- Bounded worker concurrency, effect concurrency, payloads, and dependency graphs.
- Fair scheduling across ready accounts.
Capacity reservations for new events are charged atomically with insertion. An identical duplicate should receive its existing receipt without consuming additional quota, even when new admissions are paused, provided the database remains available.
Use a consistent lock order—capacity records, account, event—when a transaction touches all three. Transactions not touching capacity omit those locks.
Track:
- Intake rejection rate and database storage headroom.
- Ready-event age and dependency-wait age.
- Lease expirations and fenced-write rejections.
- Retries, poison events, and blocked descendants.
- External ambiguity and reconciliation backlog.
Do not promise acceptance during an unbounded outage or guaranteed delivery when the source stops retrying rejected requests.
## 8. Proposed pass/fail acceptance checks
These are **test specifications**, not executed results. Choose limits and timing bounds before testing.
| Check | Pass criterion |
|---|---|
| Concurrent duplicate intake | Many concurrent identical deliveries create exactly one event and one quota charge; acknowledged requests identify that receipt. |
| Identity conflict | Same key with changed payload cannot overwrite the original; conflict is returned and recorded. |
| Crash during admission | Crash before commit leaves no receipt. Crash after commit leaves a recoverable receipt; redelivery does not create another event. |
| Acknowledgement durability | Every successfully acknowledged test event survives restart within the declared durability/failover failure model. |
| Reordering | Deliver child before parent. No child business mutation or external dispatch occurs before parent success. |
| Missing dependency/cycle | Missing prerequisites reach the configured blocked policy; cycles are quarantined; neither releases descendants. |
| Account concurrency | Only one current lease exists per account; unrelated ready accounts progress under the declared workload. |
| Lease fencing | After expiration and takeover, old-worker heartbeat, completion, and business mutations all fail without changing business state. |
| Completion/reaper race | Expiration during completion cannot allow competing fenced database commits. |
| Renewal bounds | Heartbeats cannot extend an attempt past `D`. |
| Atomic database completion | Inject a failure between business writes and success update; both commit or both roll back. |
| Retry bounds | Repeated errors and crashes never exceed `K` grants or the configured age budget. |
| External uncertainty | Kill the worker after remote acceptance but before local confirmation. Recovery reuses the same effect identity and retains uncertainty until resolved. |
| Downstream contract | With supported idempotency, replay causes no additional logical effect within its declared retention period. With supported fencing, a lower epoch cannot mutate after a higher epoch is established. |
| Unsupported external guarantees | Non-idempotent, non-queryable ambiguous effects are quarantined or explicitly permit duplicates; they are never labeled exactly-once. |
| Backpressure | New admissions stop at configured limits without overshoot; existing duplicates add no quota charge; unrelated accounts are not monopolized by one backlog. |
| Long-delayed duplicate | After payload cleanup, retained identity still prevents reinsertion. Unsafe key deletion fails acceptance. |
| Recovery liveness | Under healthy database and worker availability, expired eligible work is reclaimed within the configured polling, scheduling, and bounded-lock-delay allowance. |
## Alternatives, missing evidence, and next action
**Alternatives**
- **Strict source sequence:** simpler than a dependency graph, but requires a reliable sequence contract and explicit gap handling.
- **Explicit dependency graph:** the recommended general model; permits independent events but needs complete dependency metadata.
- **One transaction per handler:** excellent for database-only effects, but must not include remote calls.
- **Receipt-order FIFO:** rejected as a substitute for causal ordering under reordered delivery.
**Missing evidence**
The source’s dependency contract, retry horizon, downstream idempotency/fencing capabilities, PostgreSQL failover policy, and required capacity/latency limits are unspecified. These determine whether the design can meet its ordering, durability, and external-effect guarantees.
**Confidence:** high in the database receipt and fencing design under the stated assumptions; semantic ordering and external-effect guarantees remain conditional on those contracts.
**Next useful action:** establish those contracts and numerical limits, then implement the transactions and run the acceptance matrix with crash and network fault injection.
openai / gpt-6-astra / high / high effort answer
## Recommendation and assumptions
Use a **transactional PostgreSQL inbox, one execution lane per account, and renewable leases with monotonically increasing fencing tokens**. A successful webhook response means “durably accepted,” not “processed.”
This is an independent design based only on the supplied requirements. No implementation was inspected and no tests were executed.
### Required contracts
1. **Authenticated identity:** derive `source` from authentication and verify that it may submit for `accountID`. Do not trust source identity supplied inside the payload.
2. **Stable event identity:** retries retain the same `(source, accountID, eventID)` and immutable event contents.
3. **Dependency information:** event IDs and arrival order alone cannot reveal dependencies. For this design, require an authoritative, contiguous **per-account sequence number** in the authenticated envelope or payload.
- Provision the account’s starting sequence explicitly; never assume the first arrival is the first event.
- If multiple sources affect the same account, they must share that sequencing authority. Independent source sequences cannot establish cross-source order.
- Without this additional contract, the system can serialize arrival order, but cannot truthfully guarantee preservation of source dependencies.
4. **Source retry behavior:** the source retries timeouts, retryable non-success responses, and ambiguous outcomes using the same identity.
5. **Durability scope:** acknowledge only after PostgreSQL reports a durable commit. Use logged tables and appropriate WAL/fsync settings. If success must survive primary loss and failover, synchronous replication and promotion policy must preserve acknowledged commits; asynchronous replication alone does not provide that guarantee.
6. **External effects:** downstream systems may support stable idempotency keys or fencing. Where they do not, ambiguous effects require reconciliation or explicitly accepted duplicate risk.
Sequence numbers impose stronger ordering than a dependency DAG, but make the correctness boundary straightforward.
## Durable records and invariants
### Records
**`account_lane`**
- Canonical account key.
- `completed_seq`: highest contiguously resolved sequence.
- Monotonic `fence`, never reset or reused.
- Optional active event, owner, lease expiry, and attempt deadline.
- Administrative hold and reason.
**`inbox_event`**
- Primary key: `(source, accountID, eventID)`.
- Unique constraint: `(account_lane, sequence)`.
- Immutable sequence, payload, and fingerprint of the defined immutable envelope.
- State: `pending`, `running`, `retry_wait`, `succeeded`, `quarantined`, or `skipped`.
- Attempt count, retry deadline, next eligibility time.
- Current attempt token, error classification, and timestamps.
**Supporting records**
- Attempt/audit records.
- Transactional capacity accounting.
- Optional effect-intent/outbox records, uniquely keyed by event identity and effect name.
Define the fingerprint precisely: either require identical bytes on retries or specify canonical encoding. Include sequence and all other semantically immutable metadata. A mismatching duplicate is an identity conflict, not a harmless retry.
### Invariants
1. At most one accepted event exists for each deduplication key.
2. At most one accepted event occupies each account sequence.
3. Only sequence `completed_seq + 1` can execute.
4. At most one **currently authorized** attempt exists per account. Expired workers may still physically run.
5. Every worker mutation requires the current event, owner, fence, and an unexpired lease.
6. Local business changes, event completion, and cursor advancement commit together.
7. Failure, expiry, and quarantine do not advance the cursor.
8. Attempts and processing time have finite configured budgets.
9. Quarantining an event does not silently declare its dependencies satisfied.
Use database constraints plus explicit row locks under `READ COMMITTED`; application checks alone are insufficient. Establish one lock order, for example capacity records → account lane → event. Worker transactions that do not need capacity records start at the account lane.
## State transitions
| From | To | Condition |
|---|---|---|
| Absent | `pending` | Valid admission commits |
| `pending` / `retry_wait` | `running` | Event is the account head, retry time has arrived, and budgets remain |
| `running` | `succeeded` | Current unexpired attempt commits successful processing |
| `running` | `retry_wait` | Current attempt records a retryable failure |
| Expired `running` | `retry_wait` | Recovery records lease expiry; another attempt remains allowed |
| `pending` / `retry_wait` / `running` | `quarantined` | Permanent failure, exhausted budget, or unresolved effect ambiguity |
| `quarantined` | `retry_wait` | Audited recovery grants a new bounded budget |
| `quarantined` | `skipped` | Explicit, authorized resolution establishes that continuing is valid |
`pending` also covers dependency-blocked events. Eligibility is derived from the account cursor; it need not be materialized in another state.
A missing sequence blocks later events. A gap timer raises an operational alert and may place the lane on hold; it never manufactures success for the missing event.
## Transaction boundaries
### 1. Receive and acknowledge
Before opening a transaction, authenticate, authorize, enforce request-size limits, and validate the envelope.
Inside one transaction:
1. Acquire the required capacity and account locks in the prescribed order.
2. Look up the deduplication key:
- Same immutable envelope: return the existing acceptance result without reserving capacity again.
- Different envelope: reject with an identity-conflict response.
3. Check sequence validity and uniqueness. A new identity cannot replace an already accepted or resolved sequence.
4. Verify capacity and the allowed sequence-gap window.
5. Insert the event and reserve its storage/work capacity.
6. Commit.
Return `202 Accepted` only after that commit succeeds. An exact duplicate may also receive `202`, even if processing later failed: acceptance and processing status are separate concepts.
If the connection fails during commit, the outcome may be unknown. Do not claim that admission failed atomically. Return a retryable error if possible; a same-key retry discovers the committed record or inserts it once.
A notification can wake workers after admission, but polling remains authoritative. Notifications are not durable work storage.
### 2. Claim an account head
In a short transaction:
1. Select an eligible account using `FOR UPDATE SKIP LOCKED`.
2. Lock its head event and recheck eligibility.
3. If an old attempt expired, record expiry and apply retry/exhaustion policy.
4. Increment the persistent account fence.
5. Increment the event attempt count.
6. Assign owner, attempt token, lease expiry, and an absolute attempt deadline.
7. Change the event to `running` and commit.
Perform processing outside the transaction. Do not hold database locks across network calls.
Use database wall-clock time, sampled after lock acquisition, for lease decisions. Transaction-start timestamps can become stale while waiting for locks.
The claim counts as an attempt even if the worker crashes before doing useful work. This conservatively bounds crash loops.
### 3. Renew
A short transaction locks the lane and event and verifies:
- Matching owner, event, and fence.
- State is `running`.
- The current lease has not expired.
- The absolute attempt deadline has not passed.
Extend the lease only up to that deadline. An already expired worker cannot revive its lease, even if nobody has reclaimed the event.
If renewal fails or its outcome is unknown, the worker stops initiating new effects. Already-issued external requests may still complete.
### 4. Commit successful local processing
Lock the lane and event, then validate ownership and expiry again.
In the same transaction:
- Apply PostgreSQL business mutations.
- Record any durable effect intentions.
- Mark the event `succeeded`.
- Advance `completed_seq` by exactly one.
- Clear active ownership.
A stale worker must roll back all those writes. Checking the token and then committing business changes in a separate transaction would defeat fencing.
For accounts whose next event depends on external completion, do **not** advance the cursor merely because an outbox entry exists. Advance only after the required external result is durably resolved.
### 5. Failure and recovery
A current worker can record failure and clear its lease transactionally:
- Transient failure: `retry_wait`, with capped exponential backoff and jitter.
- Permanent failure or exhausted budget: `quarantined`.
- Ambiguous non-idempotent external outcome: quarantine or reconciliation hold.
A reaper uses the same locks to reclaim expired attempts. Recovery must work without cooperation from the crashed worker. Apply backoff to crash recovery too, so repeated worker deaths cannot produce a hot reclaim loop.
Enforce a maximum claim count, absolute processing deadline, and per-attempt runtime ceiling. An independent sweep can quarantine expired pending work, including events that never became runnable.
## External effects and fencing limits
A PostgreSQL fence protects PostgreSQL state only when every relevant write validates it transactionally. It cannot retract an external request.
For each logical external effect:
1. Persist an immutable intent before sending.
2. Use a stable idempotency key derived from event identity and effect name—not from attempt number.
3. Retry or query that same logical operation after an ambiguous outcome.
4. Record the confirmed outcome durably.
5. Unblock dependent account work only when the dependency’s completion condition is satisfied.
Where supported, pass the account fence downstream. The downstream must atomically reject obsolete fences. Fencing and idempotency solve different problems: fencing limits obsolete attempts; idempotency prevents repetition of one logical operation.
The key failure window remains:
> The downstream performs an effect; the worker crashes before PostgreSQL records success.
An outbox preserves the intent but does not close this window. Without downstream idempotency, a transactional integration, or reliable reconciliation, automatic retries can duplicate effects. Holding an account avoids unsafe progression but sacrifices availability.
Multiple external effects within an event need separate durable effect identities and reconciliation rules.
## Poison events, ordering, and operations
Quarantine stores the original immutable event and diagnostic history. It blocks dependent successors but must not block unrelated accounts.
Operators may:
- Correct the processing implementation and grant a bounded replay budget.
- Reconcile an ambiguous external operation.
- Apply an audited compensating resolution.
- Skip only when domain rules explicitly permit successors to proceed.
Skipping is a business decision, not a retry policy. Update the event and account cursor atomically, with an audit record. Preserve the original payload rather than overwriting accepted evidence.
Expose queue depth/bytes, oldest unresolved age, sequence gaps, head-of-line blocking, retry counts, lease expiries, quarantine counts, and per-account processing lag. Schedule accounts fairly so one busy or failing account cannot monopolize workers.
## Backpressure and retention
Configure hard limits for:
- Request and payload size.
- Global and per-account unresolved events and bytes.
- Accepted sequence distance ahead of the cursor.
- Concurrent attempts and downstream calls.
- Database connections.
- Retry/recovery budgets and retained history.
Admission reservations must be transactional; independently sampled queue counts can oversubscribe capacity. A simple global capacity row is correct but may contend. If necessary, replace it with bounded reservation allocations whose sum cannot exceed the global budget.
Reserve storage headroom for WAL, indexes, maintenance, and operational writes; logical payload-byte quotas alone do not bound physical disk usage.
Suggested admission responses:
| Condition | Response |
|---|---|
| Unauthenticated / unauthorized | `401` / `403` |
| Malformed or missing required ordering metadata | `400` or `422` |
| Payload too large | `413` |
| Identity or sequence conflict | `409` |
| Account/rate/backlog limit reached | `429`, with retry guidance |
| Database unavailable or global capacity exhausted | `503` |
| Durably accepted or matching accepted duplicate | `202` |
Exact duplicates should remain acknowledgeable when new admission is throttled, provided their durable receipt can be verified.
Retain compact deduplication tombstones after deleting bulky completed payloads. Permanent deduplication requires permanent identity retention. With finite storage, this eventually requires adding capacity or refusing new events. A bounded retention horizon is an alternative only with an explicit source replay/expiry contract; deleting receipts and admitting arbitrary old identities loses deduplication.
## Proposed measurable acceptance checks
These are pass/fail criteria, not executed results.
| Check | Pass condition |
|---|---|
| Concurrent duplicate admission | Concurrent identical submissions produce exactly one durable event and one capacity reservation |
| Conflicting duplicate | Changed immutable contents under the same key receive conflict; original contents remain unchanged |
| Sequence collision | Two identities targeting one account sequence cannot both be accepted |
| Commit/response crash window | Killing the receiver after commit but before response still permits a retry to find exactly one accepted event |
| Durability | Every observed success remains present after crashes/failovers covered by the declared durability policy |
| Reordering | Deliver sequences `3, 1, 2`; execution follows `1, 2, 3`, with no execution of `3` before its predecessors resolve |
| Missing predecessor | With sequence `2` absent, later sequences never execute and the configured gap alert fires |
| Competing claims | Under simultaneous claims, at most one valid lease exists per account; independent accounts can proceed |
| Lease fencing | Pause worker A past expiry, reclaim with B, then resume A: all A’s completion, renewal, and local business writes are rejected |
| Crash recovery | A crashed attempt is recovered within the configured lease/reaper timing bound; renewal cannot exceed the attempt ceiling |
| Retry bound | Persistent failures produce no more than the configured number of automatic claims and then quarantine |
| Poison isolation | Quarantined head blocks its successors while healthy accounts continue within the configured scheduling target |
| Local atomicity | Injected failure cannot leave business writes committed without matching event completion and cursor advancement |
| External ambiguity | An effect accepted before a worker crash is retried with the same idempotency key, or held for reconciliation when safe retry is unavailable |
| Capacity race | Concurrent new admissions never exceed transactional event/byte limits; matching duplicates consume no additional reservation |
| Retention | A replay inside the promised deduplication horizon cannot create another event; the expiry policy is explicitly exercised |
| Lost notifications | Dropping every wake-up notification still results in polling-based processing |
## Alternatives and remaining decisions
- **Explicit dependency DAG:** allows independent events within an account, but requires cycle detection, missing-dependency policy, and more complex claiming.
- **Arrival-order serialization:** works with the three supplied fields alone, but cannot preserve unknown source ordering.
- **Whole-account database lock during processing:** simpler for short database-only work; unsuitable for network-bound work and does not fence external effects.
- **Finite receipt retention:** reduces storage requirements by weakening the deduplication contract explicitly.
Confidence is high in the transactional and fencing approach. End-to-end ordering depends on authoritative dependency metadata; safe external retries depend on downstream capabilities.
**Next action:** agree on the sequencing contract, acknowledged-failure durability scope, downstream idempotency/reconciliation behavior, and numerical capacity/retry/retention limits. Then implement the transactions and execute the fault-injection checks above.
Primary judge's stated reason
A slightly reduces ambiguity for an implementer connecting effect dispatch to lease recovery, supporting a forced, weak preference. Both substantially satisfy the complete assignment under their stated dependency contracts; this is not an established material quality difference, and an independent review could reasonably reject the preference.
This reason is the judge's assessment. No independent factual-defect finding is asserted by this record.
Battle wave: 1fb32bda-9041-4f2e-818c-0fd4669031e2. Pair: brp1_6676c7ddcf0a529a7f97b84bc58f887fb3c61a76f7129d1e2c790fc359393ebd. A separate independent review is required before calling a concern a verified factual defect. Judge disagreement is not recorded here.