Agent Application DevelopmentAccount
Knowledge catalogChoose core direction and segmented content
Practice 31AdvancedSystem designAbout 15 minutes

Corresponding knowledge: Lease takeover and fencing stale workers

Two Workers resume an Agent task at the same time. How to use lease and Fencing Token to prevent the old Worker from writing?

The lease is responsible for taking over, the monotonically increasing token is responsible for rejecting expired writes, and the business side effects must still be independently constrained.

WorkerleaseFencing TokenConcurrency control

Knowledge content check2026-10-03 · Check the source of the original question2026-10-02

Knowledge unit directory

LEARN · PRACTICE · REFLECT

Knowledge exercises·Independent answers

My notes and review ↗

Principles and Solutions have been collapsed. Explain the core mechanism, boundaries and verification methods in your own words, and then compare them.

Answers and personal notes

Each modified commit will be kept as an independent history. Your level of mastery is up to you to evaluate yourself against the standards.

Explain in your own words first

The core principles, analysis, Q&A and migration cases have been closed. When you are ready, unfold it and compare it with the content to find any omissions.

Hands-on verificationComplete on demand · Suggestions15 minutes

Give old workers pause and resume timing, marking which writes should be rejected.

Expand acceptance requirements and checkpoints
  • The new owner has a higher generation
  • Storage side execution condition check
  • You cannot rely solely on the client to determine the lease

Key inspections

  • Can reproduce the problem of old Worker resurrection after lease expiration
  • Ability to design atomic claims, renewals and conditional submissions
  • Checks that make it clear that fencing must be performed by the resource writer
  • Ability to distinguish between task preemption and side effects idempotency