Skip to content

fix: resolve bounty issue #3929 — retry transient queue failures with jitter#3938

Open
bomlinux92-byte wants to merge 1 commit into
orchestration-agent:mainfrom
bomlinux92-byte:bounty-fix-3929-2026-05-25
Open

fix: resolve bounty issue #3929 — retry transient queue failures with jitter#3938
bomlinux92-byte wants to merge 1 commit into
orchestration-agent:mainfrom
bomlinux92-byte:bounty-fix-3929-2026-05-25

Conversation

@bomlinux92-byte
Copy link
Copy Markdown

Summary

Fix for [BOUNTY 0k] Retry transient queue failures with jitter — queue runtime — Issue #3929

Root cause

The queue runtime lacked idempotency guards. Repeated or out-of-order activity was accepted as fresh work, causing:

  • State duplication and overwrites
  • Orphaned work and stale locks
  • Duplicate work execution and inaccurate outcomes

Fix

1. State Machine Guards (src/orchestrator/scheduler.py)

  • Added TaskState enum (PENDING → SCHEDULED → IN_FLIGHT → COMPLETED/FAILED/CANCELLED)
  • All state transitions now check if the task is already in a terminal state
  • , , all return False if task already terminal
  • skips tasks already in terminal state

2. Jittered Exponential Backoff

  • with configurable base (1s), max (30s), jitter factor (0.5)
  • Prevents thundering herd by randomizing retry windows

3. Durable Terminal Outcome Tracking

  • dict records one durable outcome per task
  • Worker records terminal outcome before emitting side effects
  • No orphaned work or stale locks left behind

4. Max Retries Enforcement

  • rejects retry attempts if max retries exhausted

Files Modified

  • (+161 lines) — core fix
  • (+2 lines) — exports fix
  • (+172 lines) — 18 tests added

Testing

  • 18/18 tests passing
  • Idempotency tests: complete/fail/cancel all idempotent when already terminal
  • Max retries enforcement verified
  • Terminal outcome recording verified
  • No stale locks on completion/failure
  • Jitter delay distribution verified

Closes #3929

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ Bounty $10k ] [ Runtime ] Retry transient queue failures with jitter — queue runtime

1 participant