S02 · Distributed Chaos · L-06

Leader Election Debug

Difficulty
medium
Type
debugging
Session
Standard
Stack
Python python3.11
Domain
Distributed
Est. solve
~30 min

01 · The task

A Raft-style cluster occasionally crowns two leaders in the same term when messages arrive in an awkward order — exactly the safety property it is meant to guarantee. The cluster, transport, and role transitions are all provided and mostly correct; find what lets the second leader slip through and close the gap so a term can only ever have one.

02 · Constraints

  • One file

    Edit a single file to land the fix.

  • Simulated network

    Runs against a deterministic, simulated network.

03 · Skills exercised

consensusGetting distributed nodes to agree on a single value despite failures.state-machineModeling protocol behavior as explicit states and transitions.leader-electionElecting exactly one leader per term in a distributed protocol.

How to playDaemon

The whole level runs through the local promptly daemon — it pulls the workspace, captures your token usage, tests locally, and submits the ranked run.

  1. Pair this machine

    One-time — approve the code under your devices.

    promptly pair
  2. Pull the workspace

    Downloads the starter kit into leader/ and starts the solve clock — cd in before the next step.

    promptly init leader
  3. Start the captured session

    Then drive your AI tool — the daemon meters every prompt and token live.

    promptly start
  4. Submit for ranked grading

    Runs the full hidden suite and ends the attempt.

    promptly submit

Or combine steps 02–03 into one commandShortcut

promptly play pulls the workspace, launches the daemon, and starts the captured session in a single step — the same as running init then start. Then cd leader and drive your harness.

promptly play leader