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 elects two leaders in the same term under a specific message ordering. Somewhere in the per-node ballot logic a safety rule is broken — find it and fix it so at most one leader is elected per term. The cluster, network simulation, and role machinery are provided; the defect has one site.

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 the current folder and starts the solve clock.

    promptly init stage-2-06-leader-election-debug
  3. Start the captured session

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

    promptly start stage-2-06-leader-election-debug
  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.

promptly play stage-2-06-leader-election-debug