FireMUD Delivery Status

PR data refreshed

PR #2829 review history

Rebuild 5B retention on durable replay V4 evidence

5B · schema, lifecycle, publication and retention

Review rounds

Three-number pills mean: found (raw) / accepted here (useful) / routed

Hosted CodeRabbit9 completed
2/1/02/2/02/2/02/2/04/2/0
CLI CodeRabbit28 completed
3/2/03/3/01/0/02/0/00/0/0
Subagent Review7 completed
1/1/0age n/a5/5/0age n/a1/1/0age n/a1/1/0age n/a0/0/0age n/a

Recorded review history

Finding-by-finding records are stored for 7 of 9 Hosted reviews and 25 of 28 CLI reviews. The round cards above still show every completed review.

Reviews and findings

  1. Subagent Review 1 CompletedModel not recorded
    Found: 3 Accepted: 2 Routed: 0
    1. V4 rows may not be readable by a pre-V4 Automation binary during rollback
      • Rejected The owning runtime-and-data contract explicitly requires coordinated Recreate and roll-forward-only V3/V4 deployment; binary rollback across this migration is not supported.
    2. Replay actorPrincipal need not match the authenticated admin account
      • Accepted The local gRPC correction requires a nonblank authenticated account and exact actorPrincipal equality, with missing and spoofed-actor tests; focused tests and full Automation check passed; publication pending.
    3. Replay re-enters DSL for a post-evaluation failure without retained child ledger
      • Accepted The local correction rejects post-evaluation and unknown stages with stage_evidence_unavailable while retaining dead-letter and failure evidence; focused service tests and full Automation check passed; publication pending.
  2. Subagent Review 2 CompletedModel not recorded
    Found: 3 Accepted: 1 Routed: 0
    1. Replay re-enters DSL for a post-evaluation failure without retained child ledger
      • Rejected Same accepted stage-evidence finding in independent contract pass general-2829-contract-e3cebaa.
    2. Replay actorPrincipal need not match the authenticated admin account
      • Rejected Same accepted actor-authentication finding in independent contract pass general-2829-contract-e3cebaa.
    3. Batch claims may commit before any per-item evaluation begins
      • Accepted Local correction selects candidates before claiming, then claims and processes each item in one transaction; focused tests and full Automation check passed. Savepoint rollback semantics are under final adjudication before publication.
  3. Subagent Review 3 CompletedModel not recorded
    Found: 1 Accepted: 1 Routed: 0
    1. Transient later plugin-authority read can strand a durably claimed item in EVALUATING
      • Accepted The late repository read now classifies transient failures as retryable authority_unavailable and nontransient evidence failure as terminal, with focused claim/process test proof; full service validation and publication pending.
  4. Subagent Review 4 CompletedModel not recorded
    Found: 5 Accepted: 5 Routed: 0
    1. Runtime response with empty error and matching state bypasses shared fence
      • Accepted Any error presence contradicts successful authority; local shared-fence correction and regression test are staged, with focused validation pending.
    2. Missing plugin status is persisted as terminal plugin_disabled
      • Accepted Null or unspecified authority is not a proven disabled lifecycle; a retryable authority-unavailable result and negative proof are required.
    3. Replayed pending work item can starve behind full Redis index batches without a new pointer
      • Accepted Replay claims a durable PENDING_EVALUATION row but neither enqueues its pointer after commit nor guarantees a durable scan under full index batches; focused queue-publication fix in progress.
    4. Plugin authority read failure aborts replay without durable bounded result
      • Accepted The uncaught plugin status repository/publication exception rolls back replay result and escapes the gRPC handler; retryable bounded mapping and proof pending.
    5. Terminal cleanup can delete an unlocked replay candidate before receipt insertion
      • Accepted Unreserved parent selection can race cleanup deletion and cause the result FK insert to roll back the request receipt; row-locking and race proof pending.
  5. Subagent Review 5 CompletedModel not recorded
    Found: 1 Accepted: 1 Routed: 0
    1. Dead-letter replay accepts deterministic non-retryable DSL failures
      • Accepted Stage and reason alone admit DSL_EVAL rows with definition_invalid or sandbox_error. The persisted audit outcome must prove a retryable failure class before re-entering evaluation; unknown or contradictory evidence remains dead-lettered.
  6. Subagent Review 6 CompletedModel not recorded
    Found: 1 Accepted: 1 Routed: 0
    1. Plugin fence failure after partial handoff fan-out is classified as replayable DSL evaluation
      • Accepted Post-evaluation plugin authority loss can follow accepted sibling handoffs yet persists the same DSL_EVAL retryable tuple as a safe pre-evaluation failure. Replay may re-enter DSL without a child ledger. Fix classification and prove rejection.
  7. Subagent Review 7 CompletedModel not recorded
    Found: 0 Accepted: 0 Routed: 0
    1. No findings recorded for this run
  8. Hosted Review 1 CompletedRuntime 7m 25s
    Found: 4 Accepted: 1/2/1 Routed: 0
    1. Apply age and hold checks to every sibling before deleting a child.Major

      The cleanup rule requires every associated handoff event to have a completed outcome, no active hold, and an observed_at value before the applicable cutoff. The current noIncompleteSibling condition checks only the outcome. It can delete an old child while retaining a newer or held sibling, which breaks the retained parent/child evidence bundle.

                               .and(siblings.WORK_ITEM_ID.eq(candidates.WORK_ITEM_ID))
      -                        .and(incompleteHandoffOutcome(siblings.HANDOFF_OUTCOME))));
      +                        .and(
      +                            incompleteHandoffOutcome(siblings.HANDOFF_OUTCOME)
      +                                .or(siblings.OBSERVED_AT.ge(cutoff))
      +                                .or(siblings.RETENTION_HOLD_UNTIL.gt(current)))));
      
      • Accepted Cleanup must preserve entire parent-child bundle until every sibling is old, complete and unheld; predicate currently checks only completion; pending local fix
    2. Keep this tracker entry focused on implementation status.Trivial

      Line 48 repeats expiry behavior and target-proof details already recorded in the Entity architecture documents. Keep the implementation status and links here, and leave the technical contract in its owning documents.

      Based on learnings, “In FireMUD implementation-tracking documentation, do not duplicate canonical technical contracts that are already defined by the owning ADRs or architecture contracts. Preserve those documents as the authoritative sources and use this documentation only to track implementation-specific status, decisions, or links to the canonical definitions.”

      • Accepted SF-2.1 tracker duplicates Entity technical retention contract; retain implementation status and owning links; pending local fix
    3. Describe the configured sweep delay accurately.Minor

      The runtime and API documents imply a 30-second cadence. ActorConditionExpiryJob uses fixedDelayString, so Spring starts the next invocation 30 seconds after the previous invocation completes; the sweep duration adds to the start-to-start interval. (docs.spring.io)

      • design/architecture/microservices/entity-management-service/runtime-and-data.md#L16-L16: Replace “runs every 30 seconds by default” with wording that states the 30-second delay begins after each run completes.
      • design/architecture/microservices/entity-management-service/runtime-and-data.md#L303-L303: Replace “default 30-second cadence” with the same fixed-delay description.
      • design/architecture/microservices/entity-management-service/api-contracts.md#L174-L174: Clarify that 30 seconds is the post-completion delay, not a guaranteed start-to-start interval.

      📍 Affects 2 files

      • design/architecture/microservices/entity-management-service/runtime-and-data.md#L16-L16 (this comment)
      • design/architecture/microservices/entity-management-service/runtime-and-data.md#L303-L303
      • design/architecture/microservices/entity-management-service/api-contracts.md#L174-L174
      • Accepted fixedDelayString is post-completion delay; correct Entity runtime/API wording at all three cited sites; pending local fix
    4. Do not treat a failed runtime lookup as an ordinary rejection. The failure is saved as a permanent receipt.Minor

      At lines 1319-1321, replayEligibilityReason catches every RuntimeException from getGameInstanceRuntimeState and returns script_pin_authority_unavailable. The service then saves this result with persistReplayResult and completes the request. Suppose Game Session has a short outage. Then an exact retry with the same controlPlaneRequestId returns the stored rejection and does not check again. The operator must send a new request ID to recover.

      The same problem affects the plugin lookup at lines 1349-1351.

      Choose one of these fixes:

      • Throw the exception so the transaction rolls back and the caller can retry.
      • Mark this reason as transient and do not complete the durable request.
      • Accepted Transient runtime/plugin lookup exception must not persist permanent replay rejection; rollback durable request for exact retry; pending local fix
  9. CLI Review 1 CompletedRuntime 3m 23s
    Found: 2 Accepted: 0/2/0 Routed: 0
    1. Minor

      Update the removed-endpoint test’s HttpRequest builder to send PATCH instead of GET, preserving its existing URL and authorization header so the test verifies the mutation route is no longer mapped.

      • Accepted Removed PATCH route test currently sends GET, so it does not prove mutation route removal; change request to PATCH and retain URI/auth; fix pending local while Hosted active.
    2. Minor

      In the terminal-fence branch of the execution flow, update the cancel calls to use “canceled” as the final outcome while preserving “stale_execution_fenced” as a reason where applicable; apply the same outcome correction to the handoff-fence cancellation path.

      • Accepted Two terminal fence cancellations persist finalOutcome=stale_execution_fenced instead of canonical canceled; preserve stale_execution_fenced as reason when applicable; fix pending local while Hosted active.
  10. CLI Review 2 CompletedRuntime 2m 50s
    Found: 4 Accepted: 0/1/3 Routed: 0
    1. Trivial

      Update clearsAuthorityUnavailableRetryStateAfterFenceRecovers to provide a valid script definition through the mocked ScriptDefinitionRepository used by fenceExecutionService, then assert that processing succeeds while clearing the retry state. Do not treat DEAD_LETTERED as evidence of recovered execution.

      • Accepted Accepted: provide a valid definition so the authority-recovery test proves successful processing instead of DEAD_LETTERED; #2829 test correction.
    2. Trivial

      Update replayPublishesQueuePointerOnlyAfterTransactionCommit to assert exactly one transaction synchronization is registered before invoking its afterCommit callback, and verify enqueueWorkItem is called exactly once; add the same synchronization-count assertion to the rollback test while preserving its existing behavior.

      • Accepted Accepted: assert exactly one transaction synchronization and one enqueue on commit, and one synchronization on rollback; focused #2829 proof correction.
    3. Trivial

      Rename the test method cancellationContinuesAcrossBoundedPagesUntilNoEligibleRowsRemain to describe continuing across a full page and stopping after a short page, and remove the unused empty-page result from the repository stub. Keep the two-query verification and cancellation assertions unchanged.

      • Accepted Accepted: align cancellation paging test name and stub with its actual full-page then short-page behavior; focused test correction owned by #2829.
    4. Minor

      Update the non-PENDING_EVALUATION eligibility condition in the repository query to include rows where NEXT_ELIGIBLE_AT is null, alongside rows whose timestamp is at or before eligibleAt. Apply the same change to both eligibility condition sites.

      • Accepted Accepted: include null next_eligible_at as immediately eligible in both non-pending status-query branches, consistent with repository retry eligibility semantics; add focused proof in #2829.
  11. CLI Review 3 CompletedRuntime 3m 24s
    Found: 5 Accepted: 1/1/3 Routed: 0
    1. Major

      Update selectReplayCandidates to use a repository locking query scoped by normalizedTenantId, such as findByIdAndTenantIdForUpdate, instead of locking by ID and filtering the tenant afterward. Keep the existing ID ordering and candidate collection behavior; do not broaden the change to authority-read sequencing.

      • Accepted Accepted: scope replay candidate row lock by normalized tenant and ID before filtering or processing; add cross-tenant locking proof in #2829.
    2. Trivial

      The combined retentionBlockedRows gauge does not distinguish dead-lettered rows for alerting. In cleanupTerminalWorkItems, expose the STATUS_DEAD_LETTERED blocked-row count as a separate metric and configure an alert threshold for it; keep the existing dead-letter cleanup disabled.

      • Accepted Accepted: expose dead-letter blocked retention rows separately and add an actionable alert threshold in the owning monitoring contract while retaining fail-closed cleanup.
    3. Trivial

      In doesNotScanOrDeleteDeadLettersForAgeOrRowCap, verify that cleanup never invokes the dead-letter age-based delete or any row-cap delete method that still exists. Remove the unused countByStatus stub unless it is needed to trigger the scenario.

      • Accepted Accepted: remove unused dead-letter count stub and assert no age or row-cap deletion calls; #2829 retention regression proof.
    4. Trivial

      Remove the duplicate setNextEligibleAt call in populate within ScriptWorkItemRepository, keeping the other assignment so the field is set once.

      • Accepted Accepted: remove duplicate next-eligible assignment from repository populate; keep the other assignment.
    5. Minor

      Remove the Instant.now() initializer from ScriptWorkItem.nextEligibleAt so it defaults to null; preserve the existing null-as-eligible behavior without changing the retry counters or related logic.

      • Accepted Accepted: default new work-item next-eligible timestamp to null, consistent with null-as-immediately-eligible repository semantics; verify initial claim behavior.
  12. Hosted Review 2 CompletedRuntime 8m 42s
    Found: 5 Accepted: 1/2/1 Routed: 0
    1. Do not page at P1 for every aged dead-letter row.Major

      countTerminalRowsBlockedByEvidence("DEAD_LETTERED", ...) counts every dead-letter row older than the watermark. deleteByStatusAndUpdatedAtBefore("DEAD_LETTERED", ...) always returns 0L, so the cleanup loop cannot reduce this count. Any retained aged dead-letter row can therefore keep the P1 alert active indefinitely.

      Alert on growth, or change this to a non-paging severity:

      Suggested growth-based alert

      -          expr: automation_retention_dead_letter_blocked_rows > 0
      +          expr: delta(automation_retention_dead_letter_blocked_rows[1h]) > 0
      
      • Rejected Duplicate of accepted CLI finding 2 in run.a0522d48b40f4b8c9981350dbb150f34; P3 alert fix is prepared locally and will be published after this Hosted review. No new obligation.
    2. Keep the cancellation page size synchronized.Trivial

      Both constants are currently 100, so no mismatch exists now. If either value changes independently, the service can stop after one repository page and leave matching rows in PENDING_EVALUATION.

      Expose the repository limit to the service, or return a has-more indicator from the repository.

      • Accepted Accepted: share the repository cancellation page limit with service loops so pagination cannot silently stop early after independent constant drift; add focused proof.
    3. Classify REQUIRES_NEW transaction-creation failures as retryable plugin authority unavailability.Major

      readCurrentPluginRuntimeState now runs through pluginFenceReadTransactionTemplate with PROPAGATION_REQUIRES_NEW. The outer processing transaction already holds one connection, so this read needs a second pooled connection.

      Under pool saturation, TransactionTemplate.execute fails in getTransaction with CannotCreateTransactionException. That type extends org.springframework.transaction.TransactionException, not jOOQ DataAccessException or Spring DataAccessException. The multi-catch at Line 1569 does not catch it.

      The exception then leaves processClaimedWorkItem and the processing transaction rolls back. claimThenProcessWorkItem records failedAfterClaim. The committed claim stays EVALUATING, and no recovery owner exists for that state. A transient pool-exhaustion event therefore strands work permanently. This is the failure class that the REQUIRES_NEW isolation was added to prevent.

      isRepositoryUnavailable already walks the cause chain. A Hikari SQLTransientConnectionException cause is classified correctly once the exception reaches it.

      🐛 Proposed fix

           final PluginRuntimeState state;
           try {
             state = readCurrentPluginRuntimeState(workItem).orElse(null);
      -    } catch (DataAccessException | org.springframework.dao.DataAccessException ex) {
      +    } catch (DataAccessException
      +        | org.springframework.dao.DataAccessException
      +        | org.springframework.transaction.TransactionException ex) {
             if (isRepositoryUnavailable(ex)) {
               return new PluginFenceValidation(REASON_AUTHORITY_UNAVAILABLE, true);
             }
             return new PluginFenceValidation("plugin_lifecycle_evidence_unavailable", false);
           }
      

      Add a unit case where the mocked PlatformTransactionManager.getTransaction for the read-only REQUIRES_NEW definition throws CannotCreateTransactionException with a SQLTransientConnectionException cause. Assert that the item returns to PENDING_EVALUATION with authority_unavailable.

      • Accepted Accepted: classify transient Spring transaction-creation failure in the isolated plugin authority read as retryable authority_unavailable, preserving pending work; add focused test.
    4. Preserve the application error envelope for unexpected replay failures.Minor

      replayDeadLetteredWorkItems catches only three exception types. If another RuntimeException escapes the replay service, execution stops before responseObserver.onNext and onCompleted. The caller receives a transport-level gRPC failure instead of ReplayDeadLetteredWorkItemsResponse.error.

      Map known retryable failures to an unavailable/retryable application error that tells the caller to retry with the same control_plane_request_id. Do not classify every RuntimeException as retryable.

      • Accepted Accepted: preserve ReplayDeadLetteredWorkItems application error envelope for runtime failures; distinguish known retryable failures from non-retryable ones and retain same-request-id retry guidance.
    5. Remove the stale "failure generation" gap from the cleanup description.Minor

      Line 39 says that the live schema "does not yet retain the recovery aggregate, failure generation/claim state, expected-child ledger, or evidence-retention horizons".

      V4 now persists script_work_items.failure_generation. claimDeadLetterForReplay fences on it, and replay results store it. The tracker (design/project-management/implementation-tracking/automation-and-scheduler-runtime.md Line 23 and Line 31) already says that work-item failureGeneration is persisted.

      Narrow this sentence to the gaps that remain, for example: "the recovery aggregate, aggregate-level generation-bound claim state, expected-child ledger, or evidence-retention horizons".

      As per path instructions: design/**/*.md: "Flag obsolete transitional guidance, conflicts between architecture docs…"

      • Accepted Accepted: remove obsolete claim that failure_generation is absent; clarify only aggregate-level generation-bound recovery claim and other remaining proof gaps.
  13. CLI Review 4 CompletedRuntime 3m 05s
    Found: 6 Accepted: 1/2/1 Routed: 0
    1. Minor

      Update claimDeadLetterForReplay to clear CANCEL_REASON when changing a dead-lettered row to PENDING_EVALUATION, so the replayed row does not retain a stale terminal reason.

      • Accepted Accepted: clear stale CANCEL_REASON atomically when claimDeadLetterForReplay resets the row to PENDING_EVALUATION; add focused proof.
    2. Trivial

      Move the Game Session and plugin status lookups used by replayEligibilityReason out of the transaction section where selectReplayCandidates holds row locks; fetch them for distinct scopes beforehand and reuse those results during eligibility checks. Preserve claimDeadLetterForReplay’s row_version and failure_generation compare-and-set checks when claiming rows.

      • Rejected Rejected: moving live Game Session/plugin authority reads before replay claim can make approval stale. Row-version/failure-generation CAS fences the work item, not external authority. Transient reads already roll back for safe retry; no lock-duration defect is shown.
    3. Trivial

      Update the cleanup description to state that it does not delete DEAD_LETTERED parents, while clarifying that ScriptWorkItemRepository.countTerminalRowsBlockedByEvidence counts aged dead-letter rows for the automation_retention_dead_letter_blocked_rows gauge only.

      • Accepted Accepted: clarify dead-letter parents are never deleted while aged rows are counted only for the distinct diagnostic gauge.
    4. Major

      Lower the severity label on AutomationDeadLetterRetentionBlocked from P1 to a non-paging level such as P3; keep its existing metric expression and alert behavior unchanged.

      • Accepted Accepted: P1 paging is disproportionate for intentionally fail-closed diagnostic retention; lower alert to P3, retaining expression and five-minute hold.
    5. Minor

      Bound the replacement polling in the cancelled-run branch that calls findMatchingRuntimeImagesRun: stop waiting after a short deadline or limited poll budget, then fail with a message identifying the cancelled run. Preserve the existing replacement handling and polling behavior within that bound.

      • Rejected Rejected: replacement polling is already bounded by outer smokeGatePolling deadline and fails at timeout. A shorter branch-only budget could reject a valid replacement run without an owner-defined SLA.
    6. Minor

      Update the live cleanup policy description and the runtime-and-data retention description to state that any retained script_dead_letter_replay_results row referencing a work item blocks parent deletion, regardless of age. Keep the existing cleanup eligibility rules unchanged.

      • Accepted Accepted: clarify config/runtime docs that any retained replay-result row blocks parent deletion regardless of age, matching noBlockingRetentionEvidence.
  14. CLI Review 5 CompletedRuntime 2m 42s
    Found: 3 Accepted: 0/1/1 Routed: 0
    1. Trivial

      Update deleteByIds so the handoff lock, SCRIPT_EVENT_AUDIT detach, and SCRIPT_HANDOFF_EVENTS delete are scoped by the tenant or parent relationship used by noBlockingRetentionEvidence, rather than WORK_ITEM_ID alone; keep all three operations consistent with the parent eligibility check.

      • Rejected Work-item id is a global primary key; both audit and handoff children have composite (tenant_id, work_item_id) foreign keys. No cross-tenant child can match a valid parent id, so extra scoping changes no behavior.
    2. Trivial

      Update authorityUnavailableRetryDeadLettersAtOutcomeLimitWithDurableEvidence to verify the audit record is saved with the stage, outcome, and reason required by the replay classifier. Preserve the existing work-item state assertions.

      • Accepted The outcome-limit test checks the work item but not the persisted audit stage/outcome/reason needed for replay classification; add focused assertions.
    3. Minor

      Update the AutomationDeadLetterRetentionBlocked alert so ordinary aged dead-letter rows do not cause a permanently firing P2 alert before recovery-aware cleanup exists. Choose one scoped fix: document the alert as expected steady state, or adjust its threshold or severity; preserve the existing metric and alert identity.

      • Accepted The P2 alert can remain active for ordinary aged dead letters while cleanup is deliberately fail-closed; clarify its expected steady-state diagnostic meaning without changing the metric or alert identity.
  15. CLI Review 6 CompletedRuntime 3m 36s
    Found: 2 Accepted: 0/2/0 Routed: 0
    1. Minor

      Update isRetryableSqlState to match only SQLSTATE 40001 and 40P01 for class-40 retry cases, replacing the broad prefix check while preserving the existing checks for other retryable states.

      • Accepted Class-40 SQLSTATE includes non-retryable transaction rollbacks; restrict this replay transient classifier to serialization failure 40001 and deadlock 40P01, preserving other accepted transient states.
    2. Minor

      Update requireReplayActor so an actorPrincipal that differs from the authenticated account throws AdminAuthorizationException instead of IllegalArgumentException, mapping the mismatch to PERMISSION_DENIED while preserving the existing message and other validation behavior.

      • Accepted Authenticated actor mismatch is an authorization failure, not malformed request input. Map through AdminAuthorizationException to PERMISSION_DENIED and update focused adapter proof.
  16. Hosted Review 3 CompletedRuntime 8m 05s
    Found: 2 Accepted: 0/1/0 Routed: 0
    1. Check that the connection pool can serve the extra plugin-fence connection for every worker.

      🚀 Performance & Scalability | 🔵 Trivial

      The processing transaction holds one pooled connection for the whole evaluation. Each pluginFenceReadTransactionTemplate.execute call with PROPAGATION_REQUIRES_NEW needs a second connection. During fan-out, this read runs once for each command. The executor path therefore needs about 2 × concurrent executor threads connections at peak.

      If executor concurrency reaches the Hikari pool size, every worker can hold one connection and wait for a second one. Each worker then waits for the full connectionTimeout before CannotCreateTransactionException puts the item on the retry path. This does not strand work, because the catch at Lines 1570-1572 handles it. It does cause throughput to fall sharply and produces false authority_unavailable retries under load.

      Size the pool to at least twice the executor concurrency, or cap executor concurrency against the pool size. Add a pool-pending-threads alert for the automation datasource.

      • Rejected Execution is invoked only by one fixed-delay scheduled job per JVM; no configured scheduler fan-out exists, and the default Hikari pool is 10. Each pod has its own pool. The hypothetical 2x worker saturation is not present.
    2. Do not hold replay row locks during authority reads.Minor

      replayDeadLetters locks up to 100 rows before calling replayEligibilityReason. Each distinct runtime scope can trigger a three-second Game Session RPC. A plugin item can also trigger up to two three-second Game Design RPCs through PluginRuntimeStateServiceImpl.getStatus. These deadlines prevent an indefinite wait, but different scopes and plugin items can still retain all row locks for many minutes.

      Use a flow that performs authority reads outside the FOR UPDATE section and preserves the row and authority-fence checks before claiming the item.

      • Accepted Replay locks up to 100 work items before bounded remote authority reads; distinct scopes can hold those locks for minutes. Move reads before row-lock acquisition while preserving current row/fence checks and durable idempotency.
  17. CLI Review 7 CompletedRuntime 2m 57s
    Found: 4 Accepted: 1/1/0 Routed: 0
    1. Trivial

      The script_work_items backfill and blocking index build can stall writes during the migration; batch the DEAD_LETTERED backfill and move idx_script_work_items_execution_fences into a separate Flyway migration with transaction execution disabled and a concurrent index build. Add a dead-letter volume alert to monitor growth now that age- and count-based deletion is removed.

      • Rejected V2 migration is deliberately quiesced with downtime/no old writers; this V4 backfill and index need not be online. Existing dead-letter blocked-row gauge and P2 diagnostic alert monitor retained growth.
    2. Major

      Update claimThenProcessWorkItem so a caught processing failure uses a separate transaction to durably transition the work item from EVALUATING to DEAD_LETTERED only if it is still EVALUATING, recording a non-replayable stage and reason. Preserve failedAfterClaim reporting, and retain any disposition failure as suppressed on the original exception.

      • Rejected Current EVALUATING claims have no owner/lease/descriptor recovery proof; architecture explicitly requires unresolved work and closed admission barrier. Dead-lettering after ambiguous processing rollback could erase live-effect uncertainty.
    3. Minor

      In the test around service.processPendingWorkItems(1), capture startedAt immediately before the call and completedAt immediately after it, then bound the nextEligibleAt assertion using those timestamps plus the expected 15-second delay instead of reading Instant.now() after processing.

      • Accepted The retry timestamp assertion samples now after processing, making the 15-second lower bound timing-sensitive. Bound it by start/end instants.
    4. Major

      Update deleteExpiredRetentionEvidence to exclude candidates whose parent has a retained receipt in SCRIPT_DEAD_LETTER_REPLAY_RESULTS. Add a notExists check matching the candidate’s tenant and WORK_ITEM_ID, or reuse the shared parent-eligibility predicate, so the parent and its handoff children remain retained together.

      • Accepted Independent handoff cleanup can delete eligible children while a retained replay result still holds the parent. Add tenant/work-item receipt exclusion and focused regression.
  18. CLI Review 8 CompletedRuntime 3m 31s
    Found: 2 Accepted: 0/1/0 Routed: 0
    1. Minor

      Add a compact constructor to ReplayItemResult that normalizes workItemId, outcome, rejectionReason, and failureReason from null to empty strings. Keep the existing overload constructors and failureGeneration behavior unchanged.

      • Accepted ReplayItemResult is a public service result record consumed by protobuf mapping; null fields would throw rather than normalize. Add compact constructor while retaining existing overloads and generation.
    2. Major

      Update claimThenProcessWorkItem so a RuntimeException after the claim commits cannot leave the work item stuck in EVALUATING: before fan-out begins, durably return it to PENDING_EVALUATION with backoff using a REQUIRES_NEW, row-version-fenced update; after fan-out begins, dead-letter it at TICK_HANDOFF. Preserve the existing failed-attempt result.

      • Rejected Duplicate of prior run.8f19f6b9 finding 3. Architecture explicitly leaves ambiguous EVALUATING claims unresolved without owner/lease/descriptor proof; retry/dead-letter after an exception could duplicate or erase effects.
  19. CLI Review 9 CompletedRuntime 3m 36s
    Found: 3 Accepted: 0/2/1 Routed: 0
    1. Trivial

      Add an overload of fenceExecutionService that accepts the definition repository, handoff service, automation queue service, game session client, and plugin runtime state repository alongside the existing work item and audit dependencies, and have it construct ScriptWorkItemExecutionServiceImpl. Replace the repeated direct constructor calls in the affected tests with this helper, preserving each test’s collaborators.

      • Accepted Repeated direct constructor setup obscures the fence collaborators in affected execution tests; add a focused helper overload without changing semantics.
    2. Minor

      Update the SQLSTATE retryability check in ScriptWorkItemExecutionServiceImpl to recognize only 40001 and 40P01 from the 40 class, replacing the broad startsWith("40") condition. Preserve the existing checks for SQLSTATE classes 08, 57014, and 55P03.

      • Accepted Execution retry classification currently treats all SQLSTATE class 40 values as transient; restrict to 40001 and 40P01 with focused proof.
    3. Minor

      Update the cleanup documentation to distinguish the independent ScriptHandoffEventRepository.deleteExpiredRetentionEvidence sweep from parent cleanup: it deletes handoff children in batches without requiring the parent to meet its age or status-specific cutoff. Align the corresponding cleanup descriptions in the related runtime and tracker documentation with this deletion boundary.

      • Accepted Independent handoff-child expiry sweep is implemented but omitted from cleanup documentation; align owning runtime and tracker descriptions.
  20. Hosted Review 4 CompletedRuntime 7m 15s
    Found: 2 Accepted: 0/1/1 Routed: 0
    1. Use one transient SQL-state classifier.Trivial

      isRepositoryUnavailable treats every 40xxx SQLSTATE as transient. AutomationControlPlaneSupport.isRetryableSqlState (Lines 96-104) accepts only 40001 and 40P01. mapsOnlyKnownRetryableSerializationSqlStates asserts that 40002 maps to INTERNAL.

      Because of this, a 40002 or 40003 from the plugin-state read goes down the authority-unavailable retry path. It then dead-letters with infrastructure_error/authority_unavailable, which replay accepts as retryable. The same SQLSTATE is classified as permanent on the control-plane path. Move the SQLSTATE rule into one shared helper and use it in both places.

      ♻️ Proposed change

               if (sqlState != null
                   && (sqlState.startsWith("08")
      -                || sqlState.startsWith("40")
      +                || sqlState.equals("40001")
      +                || sqlState.equals("40P01")
                       || sqlState.equals("57014")
                       || sqlState.equals("55P03"))) {
      
      • Accepted Valid shared-classifier improvement; the CLI batch already narrows class 40 locally, and the Hosted fix will reuse the canonical helper.
    2. Dead-letter an expired outage budget only after a fresh fence read also fails.Minor

      This check runs before validateCurrentExecutionFences. If authorityUnavailableSince is older than 10 minutes, the item is dead-lettered with authority_unavailable_exhausted. No current authority read happens first.

      Trigger: an item records one transient failure (authorityUnavailableCount = 1, nextEligibleAt = now + 30s). The scheduler is then down or backlogged for more than 10 minutes, for example during a pod restart or deploy. By the next claim, authority may be healthy. The item still dead-letters, and an operator must replay it.

      requeueAfterAuthorityUnavailable already enforces the same age bound (Lines 955-956) when a read fails. The pre-read check only adds dead letters for items whose authority has recovered. Remove it, or move it into the failure branch. If this is an intentional absolute bound, document that and update authorityUnavailableRetryDeadLettersWhenFirstOutcomeExceedsAgeBound to match.

      ♻️ Proposed change

           Instant now = Instant.now();
      -    if (authorityUnavailableRetryExpired(workItem, now)) {
      -      deadLetter(
      -          workItem,
      -          STAGE_ADMISSION,
      -          OUTCOME_AUTHORITY_UNAVAILABLE_EXHAUSTED,
      -          OUTCOME_AUTHORITY_UNAVAILABLE_EXHAUSTED,
      -          now);
      -      return false;
      -    }
           String fenceFailure = validateCurrentExecutionFences(workItem);
      
      • Accepted Valid: expired authority-unavailable budget must not dead-letter before a fresh fence read; retain the bound only on a newly failed read.
  21. CLI Review 10 CompletedRuntime 3m 46s
    Found: 2 Accepted: 0/0/0 Routed: 0
    1. Major

      Update claimThenProcessWorkItem so a processing failure after the claim is handled in a separate transaction: when no handoff child exists, move the work item to a terminal failure state with a dedicated reason before returning the failed attempt. Preserve the original exception if disposition also fails, and do not terminally fail a work item that already has a handoff child.

      • Rejected Unsafe: processing rollback can erase a local handoff child after a remote effect. No child does not prove terminal failure is safe. Accepted recovery design leaves EVALUATING unresolved until durable owner/stage/expected-child proof exists.
    2. Trivial

      Add tenant scoping to the handoff-event lock query in the retention flow around SCRIPT_HANDOFF_EVENTS, using the current tenant alongside WORK_ITEM_ID so locked child rows match the eligibility predicates. Keep the existing lock and fetch behavior unchanged.

      • Rejected Cleanup spans tenants; there is no current-tenant argument. script_work_items.id is a global PK and handoff (tenant_id, work_item_id) has a composite FK, so WORK_ITEM_ID can lock only the matching parent children.
  22. CLI Review 11 CompletedRuntime 3m 19s
    Found: 7 Accepted: 0/1/3 Routed: 0
    1. Trivial

      Update pluginFenceReadTransactionTemplate in ScriptWorkItemExecutionServiceImpl to avoid requiring a second pooled connection during a plugin-fence read inside the processing transaction. Preserve the read-only behavior and ensure fence reads do not block concurrent workers by exhausting the connection pool.

      • Rejected The REQUIRES_NEW read isolates PostgreSQL statement failures from the outer processing transaction. Current executor is one scheduled worker per JVM with default Hikari 10; no demonstrated pool exhaustion to justify breaking isolation.
    2. Minor

      Update requeueAfterAuthorityUnavailable to accept the failure stage and use it when recording exhausted authority failures; pass STAGE_DSL_EVAL from the post-evaluation handoff fence while preserving the appropriate stage at other call sites. Update OriginalFailureEvidence.isRetryableForEvaluationReplay so DSL_EVAL failures with authority_unavailable_exhausted remain replayable.

      • Accepted Partial: record the post-evaluation authority exhaustion at DSL_EVAL, with focused proof. Do not expand replay eligibility without durable evaluated-output/child proof.
    3. Trivial

      Move the candidate lookup and replayPreflightRejection checks out of the open replay transaction and run them in a separate read-only phase before replayRepository.insertOrGet. Preserve the current re-read and revalidation before mutations.

      • Accepted Replay preflight can hold the durable request transaction and connection across up to 100 authority RPCs. Separate nonmutating preflight from the short mutation transaction while preserving idempotency and revalidation.
    4. Trivial

      Rename rejectsOnLoadReplayEvenWhenReadinessBaseDiffersFromRetainedWorkItemBase to reflect that onLoad replay is rejected before readiness lookup, and remove the unused getProjection stub. Keep the never-called verification and remaining assertions unchanged.

      • Accepted The test name implies readiness-base comparison, but onLoad is rejected before readiness lookup. Rename and remove unused stub; retain never-called assertion.
    5. Major

      In claimThenProcessWorkItem, compensate when processing throws by releasing the claimed work item in a separate transaction back to PENDING_EVALUATION with a bounded nextEligibleAt. Fence the release on EVALUATING status and the claimed row version so it cannot overwrite a newer state; if release fails, preserve the processing exception and attach the release failure as suppressed.

      • Rejected Unsafe repeat of EVALUATING recovery proposal: processing rollback can erase local child evidence after a remote effect. Row-version CAS cannot prove no effect; durable owner/stage/child ledger is still required.
    6. Trivial

      Update ScriptDeadLetterReplayRepository.saveResult to accept and use the tenantId already known by insertOrGet, or add a tenant-scoped overload and route result inserts through it; remove the per-insert tenant lookup by requestId.

      • Accepted The caller already knows the tenant; pass it to result insertion to avoid one request-owner SELECT per result while retaining scoped identity checks.
    7. Trivial

      Update the handoff lock query in ScriptWorkItemRepository to scope its selection by both tenant and work-item ID, matching the eligibility and child-delete predicates. If work_item_id is guaranteed globally unique and that guarantee is enforced, retain the current filter and confirm that uniqueness instead.

      • Rejected Repeated tenant-lock suggestion. The sweep spans tenants; script_work_items.id is a global PK, and handoff (tenant_id, work_item_id) has a composite FK. Work-item ID already selects only its children.
  23. CLI Review 12 CompletedRuntime 3m 15s
    Found: 1 Accepted: 0/0/0 Routed: 0
    1. Trivial

      Update the handoff-child lock query in the retention flow to constrain SCRIPT_HANDOFF_EVENTS by tenant as well as WORK_ITEM_ID, correlating tenant through the parent or an equivalent existing source. Keep the lock scope aligned with the tenant boundary used by the later delete.

      • Rejected Repeated tenant-lock suggestion. The sweep spans tenants; script_work_items.id is a global PK and handoff (tenant_id, work_item_id) has a composite FK, so the work-item ID can lock only its children.
  24. Hosted Review 5 CompletedRuntime 9m 05s
    Found: 2 Accepted: 0/1/1 Routed: 0
    1. Bound the wait for a cancelled runtime-images run.Minor

      When the exact pull_request run is cancelled and no exact repository_dispatch replacement exists, this branch sleeps for 15 seconds and retries. It can repeat until the 25-minute polling deadline. The final error names only the missing runtime-images/full-smoke run, not the cancelled run. Add a cancellation-specific deadline and failure message, or guarantee that every cancellation creates the replacement dispatch.

      • Accepted The cancelled exact PR image run can wait until the generic 25-minute deadline with no dispatch replacement; add a shorter cancellation-specific bound and identify the cancelled run.
    2. Do not retry optimistic-lock failures without a bound.Trivial

      OptimisticLockingFailureException is a subtype of ConcurrencyFailureException, so this branch maps stale projection writes to UNAVAILABLE. Replay refreshes the rollout projection, whose versioned save can throw that exception. A persistent conflict can therefore make callers repeat the same request without a service-side retry bound.

      Exclude OptimisticLockingFailureException, or define and enforce a retry bound.

      +import org.springframework.dao.OptimisticLockingFailureException;
       import org.springframework.dao.RecoverableDataAccessException;
      @@
      -          || current instanceof ConcurrencyFailureException
      +          || (current instanceof ConcurrencyFailureException
      +              && !(current instanceof OptimisticLockingFailureException))
      
      • Accepted OptimisticLockingFailureException also matches TransientDataAccessException, so the broad retry classifier returns UNAVAILABLE. Exclude it before all broad transient checks and test the replay error mapping.
  25. CLI Review 13 CompletedRuntime 3m 06s
    Found: 2 Accepted: 0/1/0 Routed: 0
    1. Minor

      Update isRetryableForEvaluationReplay to accept authority_unavailable_exhausted outcome and reason at both ADMISSION and DSL_EVAL stages, while preserving the existing infrastructure_error and authority_unavailable matching for those stages.

      • Rejected DSL_EVAL outage exhaustion is after evaluation may have emitted side effects. No durable evaluated-output/child proof exists in this V4 boundary, so replay stays fail-closed. Only ADMISSION exhaustion is safely replayable.
    2. Minor

      Update the outer WHERE clause in deleteExpiredRetentionEvidence to recheck RETENTION_HOLD_UNTIL against current and preserve the OBSERVED_AT cutoff and nonblank HANDOFF_OUTCOME predicates. Keep the candidate subquery and batch limit intact so the delete revalidates eligibility against the current row version.

      • Accepted The candidate subquery can select an eligible row before a concurrent owner extends its hold; the DELETE target needs to recheck hold, cutoff, and nonblank outcome against the current row.
  26. CLI Review 14 CompletedRuntime 3m 20s
    Found: 3 Accepted: 0/0/1 Routed: 0
    1. Trivial

      Update deleteExpiredRetentionEvidence to serialize candidate-bundle deletion: lock the candidate bundles FOR UPDATE, then recheck sibling, parent, and replay-receipt eligibility before deleting. Keep the existing target-row retention predicates in place.

      • Accepted Statement-snapshot anti-joins can become stale before child deletion when sibling hold, retained replay receipt, or parent status changes concurrently; outer-row recheck only covers target fields. Preserve bundle eligibility with locking/recheck rather than candidate-only FOR UPDATE.
    2. Minor

      Update isRetryableForEvaluationReplay to accept authority_unavailable_exhausted outcomes with matching reasons for both ADMISSION and DSL_EVAL stages. Keep the existing infrastructure_error/authority_unavailable evidence rule consistent across those same pre-effect stages.

      • Rejected DSL_EVAL authority_unavailable_exhausted does not prove pre-effect failure: evaluation may have emitted children or external effects before the authority failure, and V4 lacks durable evaluated-output/child proof. Replay remains fail-closed; the ADMISSION-only exhausted rule is intentional.
    3. Major

      Update the RuntimeException catch around transactionTemplate.execute in the claimed-work-item flow to compensate for failed processing: use a REQUIRES_NEW transaction to CAS-reset the work item from EVALUATING to PENDING_EVALUATION, fenced by its claimed row version and setting a backoff next-eligible time. Preserve the original failure if the compensation also fails.

      • Rejected A committed EVALUATING claim after processing rollback is an explicit fail-closed V4 recovery gap. CAS reset to PENDING can rerun DSL after remote handoff and lacks owner lease, fence, or durable child reconciliation; the claimed compensation is unsafe.
  27. Hosted Review 6 CompletedRuntime 10m 58s
    Found: 2 Accepted: 0/0/2 Routed: 0
    1. Scope findResults by tenant.Trivial

      Every other method in this repository filters by tenant_id. findResults filters only by replay_request_id. The schema declares tenant-qualified keys so that owner scope stays explicit. Add a tenantId parameter and a TENANT_ID.eq(tenantId) predicate. Update the callers to pass the tenant.

      ♻️ Proposed change

      -  public List<ReplayItem> findResults(long requestId) {
      +  public List<ReplayItem> findResults(String tenantId, long requestId) {
           return dsl.selectFrom(SCRIPT_DEAD_LETTER_REPLAY_RESULTS)
      -        .where(SCRIPT_DEAD_LETTER_REPLAY_RESULTS.REPLAY_REQUEST_ID.eq(requestId))
      +        .where(
      +            SCRIPT_DEAD_LETTER_REPLAY_RESULTS.REPLAY_REQUEST_ID.eq(requestId)
      +                .and(SCRIPT_DEAD_LETTER_REPLAY_RESULTS.TENANT_ID.eq(tenantId)))
      
      • Accepted Tenant-qualified durable replay result reads should enforce the request owner in SQL, even though request IDs are globally unique; update all callers and regression proof.
    2. Tighten the replay-claim binding assertion so it checks the tenant fence.Trivial

      claimDeadLetterForReplay binds 11L and "tenant-1" in its WHERE clause. The assertion checks only "DEAD_LETTERED", 4, 3L. If the tenant predicate were removed, this test would still pass, and cross-tenant replay claims would go undetected. The tenant fence is the security-relevant part of this CAS. Assert it together with the ID.

      Proposed fix

           assertThat(bindings.get())
               .containsSubsequence("PENDING_EVALUATION", null, null, 0, 0, null)
      -        .contains("DEAD_LETTERED", 4, 3L);
      +        .containsSubsequence(11L, "tenant-1", "DEAD_LETTERED", 4, 3L);
      
      • Accepted The replay-claim SQL assertion misses the tenant predicate; checking ID and tenant together protects the cross-tenant CAS fence against regression.
  28. CLI Review 15 CompletedRuntime 4m 20s
    Found: 5 Accepted: 1/3/0 Routed: 0
    1. Minor

      In the bundle-locking flow, update the lock order so the existingParents query locks SCRIPT_WORK_ITEMS rows before the SCRIPT_HANDOFF_EVENTS sibling query; then correct the nearby comment to describe parent-first ordering. Keep the existing selection conditions and lock behavior unchanged.

      • Accepted The scheduled parent cleanup locks parents before child bundles; child-only cleanup currently reverses that order and can deadlock on the same bundle. Align the lock order parent-first, then sibling lock and fresh eligibility recheck.
    2. Minor

      Update the deleteExpiredRetentionEvidence description to state that the parent must exist and be terminal, and must not be DEAD_LETTERED; remove the claim that missing parents are permitted.

      • Accepted The updated sweep fails closed when parent is absent; tracker must no longer say missing parents are eligible.
    3. Major

      Add bounded recovery for failures in claimThenProcessWorkItem: after processing fails and its transaction rolls back, use a separate transaction to release the claim back to PENDING_EVALUATION with a next-eligible backoff. Implement the release as a row-version-fenced update that applies only to the claimed EVALUATING row, and preserve the original failure if recovery also fails.

      • Rejected A post-claim processing rollback intentionally leaves EVALUATING unresolved until a fenced recovery owner and durable evaluated-child ledger exist. CAS reset/backoff can rerun DSL after remote effects and is explicitly unsafe.
    4. Minor

      Update the description of ScriptHandoffEventRepository.deleteExpiredRetentionEvidence to state that each handoff’s parent must exist, be terminal, and not be DEAD_LETTERED; do not imply that orphaned children are eligible for deletion.

      • Accepted Runtime/data description must state that parent existence and terminal non-DEAD_LETTERED status are required after locking/recheck.
    5. Major

      Update the RuntimeException handler for ReplayDeadLetteredWorkItemsResponse so failures that prevent a domain result are returned through responseObserver.onError with a canonical non-OK gRPC status, rather than encoded as a response-level error; keep response-level errors for domain outcomes.

      • Accepted Canonical gRPC outcome contract requires non-OK transport status when an exception prevents producing the replay domain result; response-level error is implementation drift.
  29. Hosted Review 7 CompletedRuntime 10m 47s
    Found: 4 Accepted: 0/0/2 Routed: 0
    1. Scope complete by tenant.Trivial

      complete filters only by id and status. Every other method in this repository also filters by tenant_id. The schema declares uq_script_dead_letter_replay_request_tenant_id so that owner scope stays explicit. The current caller passes an ID returned by a tenant-scoped insertOrGet, so no cross-tenant write occurs today. Add a tenantId parameter and a TENANT_ID.eq(tenantId) predicate so that the completion CAS matches the tenant-qualified contract.

      ♻️ Proposed change

      -  public boolean complete(long requestId, long replayedCount, long rejectedCount, Instant now) {
      +  public boolean complete(
      +      String tenantId, long requestId, long replayedCount, long rejectedCount, Instant now) {
       ...
                           .eq(requestId)
      +                    .and(SCRIPT_DEAD_LETTER_REPLAY_REQUESTS.TENANT_ID.eq(tenantId))
                           .and(SCRIPT_DEAD_LETTER_REPLAY_REQUESTS.STATUS.eq("RUNNING")))
      
      • Accepted Accepted: the completion CAS should retain tenant-qualified ownership alongside request ID/status; add tenant parameter and focused SQL proof in this PR.
    2. Accept DSL_EVAL + authority_unavailable_exhausted as retryable replay evidence.Major

      The executor shares one outage budget across two fence checks. The first check runs at admission (STAGE_ADMISSION, Line 649 of ScriptWorkItemExecutionServiceImpl.java). The second runs after evaluation and before handoff (STAGE_DSL_EVAL, Line 847). If the tenth outcome or the ten-minute bound is reached at the second check, deadLetter records finalStage=DSL_EVAL with outcome and reason authority_unavailable_exhausted.

      isRetryableForEvaluationReplay accepts authority_unavailable_exhausted only when the stage is ADMISSION. So replayPreflightRejection returns stage_evidence_unavailable for that item. Automatic DEAD_LETTERED cleanup also fails closed. The item therefore has no recovery path.

      The failure has the same retryable class as the admission case. It occurs before beginAggregateFanout, so no handoff effect exists. Replay at DSL_EVAL is already allowed for infrastructure_error/authority_unavailable.

      🐛 Proposed fix

      -      return ("ADMISSION".equals(stage)
      -              && "authority_unavailable_exhausted".equals(outcome)
      -              && "authority_unavailable_exhausted".equals(reason))
      -          || (("ADMISSION".equals(stage) || "DSL_EVAL".equals(stage))
      -              && "infrastructure_error".equals(outcome)
      -              && "authority_unavailable".equals(reason));
      +      boolean evaluationStage = "ADMISSION".equals(stage) || "DSL_EVAL".equals(stage);
      +      return evaluationStage
      +          && (("authority_unavailable_exhausted".equals(outcome)
      +                  && "authority_unavailable_exhausted".equals(reason))
      +              || ("infrastructure_error".equals(outcome)
      +                  && "authority_unavailable".equals(reason)));
      

      Add a replay test for a DSL_EVAL authority_unavailable_exhausted dead letter.

      • Rejected DSL_EVAL failure follows evaluation. No handoff call does not prove safe DSL re-entry: the live path lacks a sealed input manifest, durable evaluated output/child ledger and owner fence. Fail-closed dead letter is intentional until recovery aggregate proof exists.
    3. Release both cleanup transactions together so the deadlock test actually overlaps them.Trivial

      The two futures are submitted without a start barrier. The first transaction can commit before the second one starts. In that case the test passes without proving parent-before-child lock ordering. Use the ready/start latch pattern from the other tests in this file.

      ♻️ Proposed fix

      +    CountDownLatch ready = new CountDownLatch(2);
      +    CountDownLatch start = new CountDownLatch(1);
           Future<Long> parentCleanup =
               executor.submit(
                   () ->
                       parentCleanupDsl.transactionResult(
      -                    configuration ->
      -                        new ScriptWorkItemRepository(configuration.dsl())
      -                            .deleteByStatusAndUpdatedAtBefore("HANDED_OFF", now)));
      +                    configuration -> {
      +                      ready.countDown();
      +                      await(start);
      +                      return new ScriptWorkItemRepository(configuration.dsl())
      +                          .deleteByStatusAndUpdatedAtBefore("HANDED_OFF", now);
      +                    }));
      

      Apply the same change to handoffCleanup. Then add assertThat(ready.await(5, TimeUnit.SECONDS)).isTrue(); start.countDown(); before the assertions.

      • Accepted Concurrent parent/child cleanup test can pass serially; coordinate both transaction starts with a barrier and assert no deadlock under overlap in focused PostgreSQL proof.
    4. Preserve the replay response error envelope.Major

      This RPC exposes ReplayDeadLetteredWorkItemsResponse.error, and commit a18646953 added runtime-error mapping to that field. The new onError paths change the established contract. Clients that inspect response.error instead receive a transport failure and cannot read the replay error or retry guidance.

      Return the error response as before, or update the public contract and every client in the same change.

      -      sendReplayTransportError(
      -          responseObserver,
      -          AutomationControlPlaneSupport.failedPrecondition(replayExceptionMessage(ex)));
      -      return;
      +      response =
      +          ReplayDeadLetteredWorkItemsResponse.newBuilder()
      +              .setError(
      +                  AutomationControlPlaneSupport.failedPrecondition(
      +                      replayExceptionMessage(ex)))
      +              .build();
      

      Apply the same response-envelope pattern to the IllegalArgumentException, AdminAuthorizationException, and RuntimeException branches, then send the response through the existing onNext/onCompleted path.

      • Rejected Canonical system-architecture-grpc requires non-OK status when pre-domain validation/authentication, unavailability or internal failure prevents a replay result. Response ErrorDetail is documented drift; the direct Replay RPC fix aligns with owner contract.
  30. CLI Review 16 CompletedRuntime 3m 23s
    Found: 1 Accepted: 0/1/0 Routed: 0
    1. Minor

      In processClaimedWorkItem, remove the authority-unavailable retry-state reset after the admission fence; otherwise intermittent handoff-fence failures restart the outage budget on every attempt. Preserve the reset after the handoff fence succeeds, and clear the retry timestamp and count in markTerminalSuccess so zero-command and dry-run success paths also end the budget.

      • Accepted Accepted: the early admission-fence reset erases the durable outage budget before the later handoff fence; preserve it until handoff-fence success and clear it on zero-command/dry-run terminal success. Fix pending local integration during active Hosted.
  31. CLI Review 17 CompletedRuntime 3m 36s
    Found: 3 Accepted: 0/0/1 Routed: 0
    1. Minor

      Update the plugin authority checks in the dead-letter replay flow so an empty status result or PLUGIN_STATE_UNSPECIFIED does not become a durable rejected-and-completed request. Make these transient cases escape via the same retryable exception path as the runtime authority read, preserving the ability to retry with the same request ID; locate the checks through getStatus and pluginState().

      • Rejected Empty scoped plugin row or unspecified persisted state is absent/incoherent current authority, not a transport read failure. It intentionally remains a durable fail-closed rejection; actual getStatus read exceptions already escape before request insertion for same-ID retry.
    2. Minor

      Update ScriptWorkItemServiceImpl.OriginalFailureEvidence.isRetryableForEvaluationReplay to accept DSL_EVAL as well as ADMISSION for authority_unavailable_exhausted failures, preserving the existing outcome and reason checks.

      • Rejected Repeated Hosted/CLI proposal: DSL_EVAL authority_unavailable_exhausted cannot safely re-enter evaluation without the target-state frozen input manifest and durable evaluated-output/child ledger; this PR must remain fail-closed.
    3. Trivial

      Parameterize rejectsReplayWhenSnapshotRowVersionOrFailureGenerationDriftsBeforeClaim with cases where only rowVersion changes, only failureGeneration changes, and both change. Set the current work item from each case’s values, and assert recovery_in_progress, the matching failure generation, and no replay claim for every case.

      • Accepted The existing drift test changes rowVersion and failureGeneration together; separate cases for each independently prove the intended stale-snapshot rejection and no replay claim.
  32. CLI Review 18 CompletedRuntime 3m 34s
    Found: 4 Accepted: 0/1/1 Routed: 1
    1. Minor

      In the cancellation-tracking flow around matching, clear cancelledRunId and cancelledRunObservedAt whenever the exact pull_request run is no longer completed with a cancelled conclusion. Keep the replacement lookup limited to cases where a cancelled run is actively being tracked, so a later cancellation of the same run ID starts a fresh observation window.

      • Accepted A PR run can be rerun under the same ID; stale cancelledRunObservedAt then shortens a later cancellation replacement window. Clear the tracked cancellation when the exact run is not completed/cancelled, with regression proof.
    2. Trivial

      Add a receipt-held-parent age or count signal distinct from the aggregate retention gauge, and record the missing receipt-retention horizon as an explicit ADR 0163 gap. Keep noBlockingRetentionEvidence fail-closed; use it to identify the unconditional replay-receipt hold being measured.

      • Accepted Receipt-held parents have no distinct count despite an unconditional retention hold. Add a non-authorizing count and focused proof; ADR 0163 should explicitly retain the missing receipt-horizon gap.
    3. Minor

      After validateCurrentExecutionFences(workItem) succeeds, clear the authority-unavailable retry state before calling validateCurrentPluginFence(workItem). This resets the outage age and count for subsequent independent authority failures.

      • Rejected Repeats the previously fixed early-reset defect. Runtime and plugin authority failures share the same bounded pre-handoff outage budget; clearing it between checks would erase prior attempts. It now clears only on durable terminal success.
    4. Major

      Update the claimThenProcessWorkItem failure path so a processing failure releases the committed claim in a separate REQUIRES_NEW transaction, returning the work item to PENDING_EVALUATION only if its rowVersion still matches the claimed version. Preserve the original exception as the failed attempt; if release fails, retain that failure as suppressed.

      Route · PR #2829 → PR #2839 RejectedCommitted EVALUATING claims can remain unresolved after processing rollback. Blanket REQUIRES_NEW release is unsafe after a possibly accepted handoff; #2839 owns the evaluated-descriptor/child-disposition recovery boundary and must triage this gap independently. View routed finding
  33. CLI Review 19 CompletedRuntime 3m 58s
    Found: 2 Accepted: 1/0/0 Routed: 1
    1. Major

      In the retryableFanoutFence branch, distinguish whether any command handoff was attempted: if none was attempted, route the item through the plugin-fence retry path at STAGE_DSL_EVAL; retain the STAGE_TICK_HANDOFF dead-letter path only after a handoff attempt.

      Route · PR #2829 → PR #2839 Accepted/FixedA no-attempt fanout fence still follows DSL evaluation without a frozen input manifest/descriptor ledger. Retrying or marking DSL_EVAL would allow unsafe operator replay; #2839 owns stage-aware post-evaluation recovery. View routed finding
    2. Major

      In the RuntimeException catch around transactionTemplate.execute in claimThenProcessWorkItem, record each failed-after-claim outcome with a counter for unresolved claims before returning WorkItemAttempt.failedAfterClaim. Ensure the metric is registered and monitored so failures that leave work items in EVALUATING are visible.

      • Accepted The committed EVALUATING claim can remain unresolved after processing rollback. Add a dedicated failure-after-claim counter with focused proof so this fail-closed gap is visible; do not release the claim.
  34. CLI Review 20 CompletedRuntime 4m 03s
    Found: 4 Accepted: 0/0/3 Routed: 1
    1. Trivial

      Update the comment in ScriptWorkItemExecutionServiceImplTest’s durable-scan stub to state that it returns both indexed and fallback, and that the claimPendingForEvaluation stub rejects indexed because it is no longer PENDING_EVALUATION while the sibling remains claimable.

      • Accepted The durable-scan stub returns both indexed and fallback rows; its comment incorrectly says it filters indexed. Correct the comment to explain the later claim stub rejects indexed as non-pending.
    2. Trivial

      Replace the always-firing AutomationDeadLetterRetentionBlocked alert on automation_retention_dead_letter_blocked_rows with a recording rule for dashboard use, since the metric represents an expected steady state. Update the corresponding contract check in observability-validator-contract.sh and the monitoring documentation to describe the recording rule rather than an alert.

      • Accepted The P2 alert fires continuously in the documented expected fail-closed steady state. Replace it with a non-paging recording rule and align the validator and monitoring docs.
    3. Major

      Update the recovery flow around claimThenProcessWorkItem so a processing failure cannot leave the committed EVALUATING claim blocking drain convergence indefinitely; add a bounded stale-claim recovery path that dead-letters stale rows with stage_evidence_unavailable, while retaining processingFailureAfterClaimCounter for visibility.

      Route · PR #2829 → PR #2839 RejectedA stale committed EVALUATING claim is a real recovery gap, but age-only dead-lettering cannot prove owner expiry or disposition of possibly accepted handoffs. #2839 must define the fenced recovery/descriptor evidence before drain convergence. View routed finding
    4. Trivial

      Update the stubs in the cleanup test so countTerminalRowsBlockedByEvidence and countTerminalRowsBlockedByReplayReceipts produce distinct totals on the first cleanup. Adjust the assertions for automation_retention_blocked_rows and automation_retention_replay_receipt_blocked_rows to verify each gauge reports its corresponding source total; preserve the dead-letter gauge assertion.

      • Accepted The aggregate and receipt gauges coincidentally both equal six in the current test. Distinct stub totals and assertions will detect swapped metric wiring.
  35. CLI Review 21 CompletedRuntime 3m 23s
    Found: 3 Accepted: 0/1/1 Routed: 0
    1. Trivial

      The public ScriptWorkItemServiceImpl constructor creates an unproxied transaction boundary, so replay operations may run without transaction atomicity. Make this constructor package-private and reserve it for tests, or require callers to inject ScriptDeadLetterReplayTransactionBoundary instead.

      • Accepted The Spring @Autowired path injects a managed boundary, but the public convenience overload silently constructs an unproxied boundary that loses replay transaction semantics. Narrow the overload to test scope and make non-package test construction explicit.
    2. Minor

      Update isRetryableForEvaluationReplay to accept the authority_unavailable_exhausted outcome and reason for both ADMISSION and DSL_EVAL stages, preserving the existing infrastructure_error handling.

      • Rejected Repeated unsafe DSL_EVAL replay expansion. The current work item lacks a sealed input manifest and evaluated-output/child ledger; authority_unavailable_exhausted at DSL_EVAL cannot safely re-enter evaluation.
    3. Minor

      Update the dataSource() bean in ReplayTransactionTestConfiguration to enable a unique embedded database name with EmbeddedDatabaseBuilder, while preserving the H2 database configuration.

      • Accepted The replay transaction test's default embedded H2 name can collide with another context. A generated unique name isolates this fixture without changing its database type.
  36. CLI Review 22 CompletedRuntime 4m 11s
    Found: 3 Accepted: 0/2/1 Routed: 0
    1. Minor

      Update the AS-1.5 production anchors to include V4__execution_replay_and_retention.sql and ScriptDeadLetterReplayRepository, which implement failureGeneration persistence and replay-result propagation. Add ScriptDeadLetterReplayRepositoryTest and the focused migration tests to the proof anchors, keeping the row’s implementation and validation claims aligned with these anchors.

      • Accepted Add V4 failure-generation/replay persistence and focused migration/repository proof anchors to AS-1.5 without expanding implementation claims.
    2. Minor

      Mark the mode-dependent epoch-filter statement in the GetAutomationDrainStatus Semantics list as Current projection mapping, keeping it distinct from the target mapping; do not change the target rules or status classifications in the owner documents.

      • Accepted Label existing mode-dependent drain epoch filter as current projection mapping; target-state owner rules remain unchanged.
    3. Trivial

      Replace the unqualified HANDOFF_RETENTION_HOLD_UNTIL field in ScriptWorkItemRepository with the generated, table-qualified SCRIPT_HANDOFF_EVENTS.RETENTION_HOLD_UNTIL field. Keep its existing usages unchanged.

      • Accepted Use generated table-qualified retention hold field; current unqualified SQL field is avoidable and generated TIMESTAMPTZ field exists.
  37. CLI Review 23 CompletedRuntime 4m 03s
    Found: 1 Accepted: 0/0/0 Routed: 0
    1. Minor

      Update isRetryableForEvaluationReplay to accept authority_unavailable_exhausted for both ADMISSION and DSL_EVAL stages when the outcome and reason match, preserving the existing ADMISSION behavior.

      • Rejected Repeated unsafe DSL_EVAL replay widening. Exhausted post-evaluation authority cannot restart DSL without the frozen inputs, descriptor and child recovery evidence required by ADR0107; ADMISSION replay remains supported.
  38. CLI Review 24 CompletedRuntime 3m 47s
    Found: 2 Accepted: 0/0/0 Routed: 0
    1. Major

      In the post-transactionTemplate.execute catch path, add bounded recovery in a new transaction before returning WorkItemAttempt.failedAfterClaim. Compare-and-set the claimed work item from EVALUATING at its claimed row version; requeue it with backoff if it has no handoff child, or mark it DEAD_LETTERED with infrastructure_error at TICK_HANDOFF if any child exists. Preserve the original processing exception if recovery fails.

      • Rejected Unsafe duplicate: processing rollback can erase child intent despite downstream acceptance. No child does not prove no handoff. ADR0107 requires frozen descriptor, child ledger and outcome reconciliation; retain ambiguous EVALUATING claims. Scoped #2839 proof is underway.
    2. Minor

      Update isRetryableForEvaluationReplay to accept authority_unavailable_exhausted outcomes with the matching reason for both ADMISSION and DSL_EVAL stages, so pre-handoff exhaustion remains eligible for evaluation replay.

      • Rejected Duplicate unsafe DSL_EVAL replay widening: ADR0107 requires original frozen inputs and exact graph, which this path cannot prove. Existing ADMISSION-only exhaustion eligibility remains fail-closed; stage-aware recovery is explicitly tracked.
  39. CLI Review 25 CompletedRuntime 3m 24s
    Found: 0 Accepted: 0/0/0 Routed: 0
    1. No findings recorded for this run

Routed Findings

0 Open1 Accepted/Fixed2 Rejected
  1. Route 1 · PR #2829 → PR #2839 Accepted/FixedMajorIn the retryableFanoutFence branch, distinguish whether any command handoff was attempted: if none was attempted, route the item through the plugin-fence retry path at STAGE_DSL_EV

    In the retryableFanoutFence branch, distinguish whether any command handoff was attempted: if none was attempted, route the item through the plugin-fence retry path at STAGE_DSL_EVAL; retain the STAGE_TICK_HANDOFF dead-letter path only after a handoff attempt.

    Outcome: Published ccd32091c retains post-DSL uncertainty as EVALUATING/HANDOFF_IN_FLIGHT; no blanket DSL retry. 251 executor/handoff tests pass, including fanout and finalization rollback plus sibling progress. Full ADR0107 recovery ledger remains explicit successor gap.

    Earlier routing and proof

    Earlier decisions

    • Accepted Partially accepted: post-evaluation fanout/child uncertainty must not restart DSL without a frozen descriptor and recovery ledger. Implement fail-closed retention instead of the suggested blanket DSL_EVAL retry; full stage-aware recovery remains a declared successor obligation.
    • Routed A no-attempt fanout fence still follows DSL evaluation without a frozen input manifest/descriptor ledger. Retrying or marking DSL_EVAL would allow unsafe operator replay; #2839 owns stage-aware post-evaluation recovery.
  2. Route 2 · PR #2829 → PR #2839 RejectedMajorUpdate the recovery flow around claimThenProcessWorkItem so a processing failure cannot leave the committed EVALUATING claim blocking drain convergence indefinitely; add a bounded

    Update the recovery flow around claimThenProcessWorkItem so a processing failure cannot leave the committed EVALUATING claim blocking drain convergence indefinitely; add a bounded stale-claim recovery path that dead-letters stale rows with stage_evidence_unavailable, while retaining processingFailureAfterClaimCounter for visibility.

    Outcome: A bounded age-based sweep cannot terminalize a stale EVALUATING claim without an expired owner CAS and definitive downstream disposition. No such owner/recovery evidence exists; retaining the claim fail-closed is required by ADR0107 and documented in the Automation tracker.

    Earlier routing and proof

    Earlier decisions

    • Rejected A bounded age-based sweep cannot terminalize a stale EVALUATING claim without an expired owner CAS and definitive downstream disposition. No such owner/recovery evidence exists; retaining the claim fail-closed is required by ADR0107 and documented in the Automation tracker.
    • Routed A stale committed EVALUATING claim is a real recovery gap, but age-only dead-lettering cannot prove owner expiry or disposition of possibly accepted handoffs. #2839 must define the fenced recovery/descriptor evidence before drain convergence.
  3. Route 3 · PR #2829 → PR #2839 RejectedMajorUpdate the `claimThenProcessWorkItem` failure path so a processing failure releases the committed claim in a separate `REQUIRES_NEW` transaction, returning the work item to `PENDIN

    Update the claimThenProcessWorkItem failure path so a processing failure releases the committed claim in a separate REQUIRES_NEW transaction, returning the work item to PENDING_EVALUATION only if its rowVersion still matches the claimed version. Preserve the original exception as the failed attempt; if release fails, retain that failure as suppressed.

    Outcome: Returning a committed EVALUATING claim to PENDING_EVALUATION is unsafe after an uncertain accepted handoff. ADR0107 requires durable evaluated descriptor, child dispositions and owner-fenced recovery; #2839 declares that gap and preserves the unresolved claim.

    Earlier routing and proof

    Earlier decisions

    • Rejected Returning a committed EVALUATING claim to PENDING_EVALUATION is unsafe after an uncertain accepted handoff. ADR0107 requires durable evaluated descriptor, child dispositions and owner-fenced recovery; #2839 declares that gap and preserves the unresolved claim.
    • Routed Committed EVALUATING claims can remain unresolved after processing rollback. Blanket REQUIRES_NEW release is unsafe after a possibly accepted handoff; #2839 owns the evaluated-descriptor/child-disposition recovery boundary and must triage this gap independently.

Unlinked items

no items unlinked