LEVEL 4 · SYSTEMS

Durable Agent Jobs

Build a persistent local report queue with versioned leases, immutable input, idempotent output receipts and reproducible worker-process crash recovery.

4 stages~8 hoursGocore
Create jobs with stable identityClaim with a lease and versionFinish or reclaim expired workWrite and recover atomic snapshots
YOU END UP WITH

Build a persistent local report queue with versioned leases, immutable input, idempotent output receipts and reproducible worker-process crash recovery.

USEFUL FOR
  • Resume local report jobs after a worker crash
  • Observe and test the gap between an output effect and durable completion
LEARN FIRST
  • Go 1.22 or later on Linux or macOS
  • Python 3.10 or later for the grader
  • Go structs, pointers, errors and JSON files
  • Basic process lifecycle and filesystem operations
PROJECT OUTLINE

Durable Agent Jobs in 4 stages

Persist job states and reject stale worker completions.

  1. Create jobs with stable identity

    Accept a bounded identifier and start every job in queued state with version zero.

    starter · ~2 hours · Go

    Validate IDInitial stateZero versionNo side effect
  2. Claim with a lease and version

    Only queued work can be claimed.

    core · ~2 hours · Go

    Expected versionAttempt capLease arithmeticAtomic state mutation
  3. Finish or reclaim expired work

    Finish succeeds only for the current running version before its lease expires.

    core · ~2 hours · Go

    Lease boundaryRequeue expiredIncrement versionFence stale worker
  4. Write and recover atomic snapshots

    Compose validated snapshots with locked enqueue, durable claims and crash-safe local receipt reuse.

    core · ~2 hours · Go

    Validate snapshotWrite tempFlush and renameRecover records

All projects · Course catalog · Source on GitHub