The Lease That Outlives Its Leader: Catching Double Zone Grants in AGV Swarms Before Failover Does

A crossing gets assigned to two vehicles at once when the coordinator's zone lease expires before the vehicle has actually stopped. Nobody writes that bug on purpose. It comes from two numbers that each look sensible on their own, kept in two repositories and approved by two different reviewers. Under normal traffic it never shows up, because a leader that never fails never reissues a lease.

Two correct files, one wrong system

In an agentic AGV stack the planner can be as clever as you like, proposing routes through MCP tools from inside a WebAssembly sandbox, but every move still depends on a deterministic reservation layer that grants exclusive leases on track segments and intersections. That layer lives in the fleet manager's deployment config, usually next to a promotion grace period that a newly elected leader honours before it reissues any lease it inherited from a dead predecessor. The vehicle side lives somewhere else entirely, in the onboard controller config: a comms loss watchdog that triggers a controlled stop when heartbeats from the coordinator go silent, plus a braking profile that depends on payload and speed. A reviewer reading the fleet chart sees a lease of 3000 ms and approves it, because three seconds is generous for a heartbeat every few hundred milliseconds. A different reviewer approves a firmware change that stretches the watchdog so loaded vehicles stop dropping out in a noisy RF corner of the warehouse, and that change also looks right.

How it fails

The coordinator crashes, a replica takes over, waits out its grace period, sees the lease on the crossing as expired, and grants it to the next vehicle in the queue, while the original holder is still rolling toward the crossing because its watchdog has not fired yet and its stopping distance under full load is longer than anyone assumed. The reservation table now says the crossing is safe. In reality two vehicles are entering it, and the only thing left between them is the onboard safety scanner, which is exactly the layer that driverless truck safety standards in the ISO 3691 family and functional safety norms like IEC 61508 expect to be your last line of defence, not your only one. Your postmortem will blame the scanner field configuration, or the failover, or the network, and the actual cause, the inequality between two files, will go unnamed. That is why the incident keeps coming back.

The check you can run today

Write the invariant down as a CI assertion that loads both configs, the fleet chart and the vehicle parameter set, and fails the build unless `vehicle.comms_loss_stop_ms + vehicle.worst_case_stop_ms + clock_skew_ms < fleet.zone_lease_ms`, and unless the promotion grace period is at least the lease length, where `worst_case_stop_ms` is computed from the heaviest rated payload at the highest permitted speed and not taken from the brochure figure. Wire it into both repositories so a change on either side runs the same check against the current head of the other. That cross trigger is what code review never gives you. Before that lands, you can audit the past: in your event store, join every zone grant event to the previous holder's last telemetry sample, and flag any grant issued while that previous holder still reported a nonzero speed. My estimate is that fleets with a few dozen vehicles that have been through at least one leader election will find a handful of these near misses in a quarter of logs. Each one is a double grant the scanner happened to absorb.

Use this decision rule: if the vehicle team cannot give you a stopping time you trust for every payload class, size the lease and grace period for the worst one, accept the throughput you lose at contended crossings (my estimate is a few percent, and it lands mostly during shift change peaks), and treat any later push to shorten the lease as a safety change that needs a signoff from both sides, not a performance tweak a single reviewer can merge.

Why not fence stale leases with an epoch number instead of relying on timing?

Do that as well: tag every grant with the leader term so vehicles reject commands from an older term. Fencing still only stops a vehicle that receives a message, though, and a vehicle that has lost contact with the coordinator keeps executing its last valid grant until its own watchdog fires. So the timing inequality remains the bound that matters during a failover.

Back to AVGAgentic · Domains

← Back to AVGAgentic
Engineering & Architecture Brief

The Lease That Outlives Its Leader: Catching Double Zone Grants in AGV Swarms Before Failover Does

A crossing gets assigned to two vehicles at once when the coordinator's zone lease expires before the vehicle has actually stopped. Nobody writes that bug on purpose. It comes from two numbers that each look sensible on their own, kept in two repositories and approved by two different reviewers. Under normal traffic it never shows up, because a leader that never fails never reissues a lease.

Two correct files, one wrong system

In an agentic AGV stack the planner can be as clever as you like, proposing routes through MCP tools from inside a WebAssembly sandbox, but every move still depends on a deterministic reservation layer that grants exclusive leases on track segments and intersections. That layer lives in the fleet manager's deployment config, usually next to a promotion grace period that a newly elected leader honours before it reissues any lease it inherited from a dead predecessor. The vehicle side lives somewhere else entirely, in the onboard controller config: a comms loss watchdog that triggers a controlled stop when heartbeats from the coordinator go silent, plus a braking profile that depends on payload and speed. A reviewer reading the fleet chart sees a lease of 3000 ms and approves it, because three seconds is generous for a heartbeat every few hundred milliseconds. A different reviewer approves a firmware change that stretches the watchdog so loaded vehicles stop dropping out in a noisy RF corner of the warehouse, and that change also looks right.

How it fails

The coordinator crashes, a replica takes over, waits out its grace period, sees the lease on the crossing as expired, and grants it to the next vehicle in the queue, while the original holder is still rolling toward the crossing because its watchdog has not fired yet and its stopping distance under full load is longer than anyone assumed. The reservation table now says the crossing is safe. In reality two vehicles are entering it, and the only thing left between them is the onboard safety scanner, which is exactly the layer that driverless truck safety standards in the ISO 3691 family and functional safety norms like IEC 61508 expect to be your last line of defence, not your only one. Your postmortem will blame the scanner field configuration, or the failover, or the network, and the actual cause, the inequality between two files, will go unnamed. That is why the incident keeps coming back.

The check you can run today

Write the invariant down as a CI assertion that loads both configs, the fleet chart and the vehicle parameter set, and fails the build unless `vehicle.comms_loss_stop_ms + vehicle.worst_case_stop_ms + clock_skew_ms < fleet.zone_lease_ms`, and unless the promotion grace period is at least the lease length, where `worst_case_stop_ms` is computed from the heaviest rated payload at the highest permitted speed and not taken from the brochure figure. Wire it into both repositories so a change on either side runs the same check against the current head of the other. That cross trigger is what code review never gives you. Before that lands, you can audit the past: in your event store, join every zone grant event to the previous holder's last telemetry sample, and flag any grant issued while that previous holder still reported a nonzero speed. My estimate is that fleets with a few dozen vehicles that have been through at least one leader election will find a handful of these near misses in a quarter of logs. Each one is a double grant the scanner happened to absorb.

Use this decision rule: if the vehicle team cannot give you a stopping time you trust for every payload class, size the lease and grace period for the worst one, accept the throughput you lose at contended crossings (my estimate is a few percent, and it lands mostly during shift change peaks), and treat any later push to shorten the lease as a safety change that needs a signoff from both sides, not a performance tweak a single reviewer can merge.

Technical FAQ: Why not fence stale leases with an epoch number instead of relying on timing?

Do that as well: tag every grant with the leader term so vehicles reject commands from an older term. Fencing still only stops a vehicle that receives a message, though, and a vehicle that has lost contact with the coordinator keeps executing its last valid grant until its own watchdog fires. So the timing inequality remains the bound that matters during a failover.

Related Architecture Specifications (AGENTIC): surveillanceagentic.com · conservationagentic.com · reliabilityagentic.com

More Technical Articles on avgagentic.com

Docking Precision Benchmarks of Heavy-Duty AVGs under High-Speed Payload Transfers →Energy-Optimal Route Selection for Battery-Constrained Industrial Vehicle Fleets →The Lease That Expires Before the Vehicle Stops →