Repository navigation
integrate(subscriber): BEGIN rollback guard and queued-dispatch orphan recovery - #59
echoomegaprime wants to merge 3 commits into
Conversation
…ution starts (#49604) finish_dispatch() marked a dispatch FAILED when its last attempt errored (for example subscriber_worker_claim_denied) with the run's reservation still BOUND, but never transitioned the run. The run stayed QUEUED forever, the metered run was never compensated, and every "queue idle" check (swarm re-certification, etc.) stayed blocked. On FORGE seven runs (2026-10-09..10-30) were stuck exactly this way. - New _terminalize_unstarted_run(): QUEUED -> INFRASTRUCTURE_FAILURE, run_outcome INFRA_FAILED, BOUND reservation RELEASED, meter compensated with the same 'dispatch-crash' key as lease-expiry exhaustion, so a run is never compensated twice. - finish_dispatch(): use it for an error on the last attempt with a BOUND reservation (QUEUED run). Retries, completion and the RELEASED-reservation path are unchanged. - _recover_expired_dispatches() (run on every claim_dispatch): reconcile runs already orphaned by the old code (dispatch FAILED, reservation BOUND, run QUEUED) with reason dispatch_failed_run_orphaned and an audit event. Idempotent: terminalized runs no longer match. - The existing lease-expiry exhaustion block is unchanged. Tests: 4 new (tests/test_dispatch_orphaned_runs.py); the 7 subscriber and dispatch test modules pass 107/107; 6/6 mutants killed. A read-only dry run of the reconciler selection on the live FORGE DB matches exactly the 7 orphans and nothing else. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01C4YSVhYLwZidNF5snQ4eec
|
Duplicate-safety reconciliation (2026-11-12): This guarded PR #59 was prepared from PR #41 before rediscovering the existing canonical combined draft PR #49 ( |
Purpose
Guarded integration candidate combining the two reviewed but unmerged CertForge subscriber repairs, without production deployment. Source baseline is PR #41 exact head
3adb7e0c4931a61254a6786cf40bc53416f29aa7; the only additional source change is PR #40'sconnection.in_transactionguard in_migrate_legacy_platform_tables, plus its exact regression-test file.Source provenance and verification
src/echo_certification_forge/subscriber.pyblob3bba7a4f28a0cdeb4a37c83f6da5512b016e70a0was read, the unique legacy rollback hunk was replaced, and the entire file was read back byte-for-byte.tests/test_subscriber_migration_rollback.pyblob1fa2d41b8de5cd010aabe465eb901274509011d0was copied without modification and read back byte-for-byte.Safety
Draft and unmerged; no service restart, schema migration, queue reconciliation, metering change, grant, or certification bypass. Never treat past standalone PR tests as combined exact-head success. Coordinate rollout with release owner; don't merge PR #40/#41 separately into an incompatible sequence after this candidate without reconciling.
Related: #40 #41; Build Tracker issue #38.