Skip to content

Claude Opus 5.5 (effort default (no --effort flag) · thinking on) on Consistent-hash ring with weighted virtual nodes and zone-aware replica placement

AClaude Opus 5.5default · thinking on · Claude Code 2.1.299 (headless -p) · cloud · 2026-10-20 · by @bobsiopener

Trust 80%Fully autonomoussuccess · first try
Estimated cost
$0.17
Wall time
34s
Human step-ins
0
Outcome
Pass

Compare with other models on this task →

Summary

Exact prompt

# Consistent-hash ring with weights and zone-aware replicas `ring.py` places cache keys on storage nodes. The draft uses the wrong hash, ignores weights and zones, and is slow. Rewrite it (Python 3 stdlib only) so that `Ring(nodes, vnodes=64)`, `Ring.owner(key)`, `Ring.replicas(key, n)` and `moves(old_ring, new_ring, keys)` behave exactly as below. ## Hashing 1. `H(s)` = the first 8 bytes of SHA-256 of the UTF-8 encoding of `s`, read as a big-endian unsigned integer. 2. `nodes` maps a node name to a dict with optional `weight` (number, default 1) and `zone` (string, default = the node's own name). `vnodes` must be an int >= 1, else `ValueError`; a negative weight is a `ValueError`. 3. A node gets `k = floor(vnodes * weight + 0.5)` virtual points, but at least 1 if weight > 0. A node with weight 0 gets none and does not exist for the ring. Point i (0 <= i < k) of node `name` is at position `H(f"{name}#{i}")`. 4. The ring is all points sorted by (position, node name, i). ## Lookups 5. `owner(key)`: the node of the first point whose position is **>= H(key)**; if none, wrap around to the first point. An empty ring raises `LookupError`. 6. `replicas(key, n)`: start at the point `owner` would use and walk the ring clockwise (wrapping) over every point once. Look at each **distinct** node the first time it is met: if its zone is not yet used by a chosen node, choose it; otherwise remember it as skipped. Stop as soon as n nodes are chosen. If the walk ends with fewer than n chosen, append skipped nodes in the order they were first met until there are n (or none are left). `n < 1` gives `[]`. The owner is always first. 7. `moves(old, new, keys)`: for every key in `keys` whose owner differs, count the pair `(old_owner, new_owner)`; return a dict of these counts with keys in sorted order. 8. **Speed:** with 60 nodes at vnodes=128, building the ring, 60,000 `owner` calls and 10,000 `replicas(key, 3)` calls must take under 10 seconds in total on our shared test box. ## Scoring Hidden check groups (partial credit = fraction passed; all must pass): `hash_and_points` (1, 3, 4: owners for 2,000 keys on small rings), `weights_rounding` (3: e.g. weight 0.5/0.0078/0, exact owners), `wraparound_and_errors` (2, 5), `replicas_zones` (6), `replicas_fallback` (6: fewer zones than n, n larger than node count), `moves_counts` (7: adding, removing, reweighting a node), `speed` (8).

Exact owners for thousands of keys require the stated hash, point naming, rounding of weights (minimum one point) and >= with wraparound; the replica walk with zone skipping and ordered fallback, plus a speed check that rules out linear scans. Original benchmark task written for usecaserank.com (not based on a specific public post). Headless, offline run on a reproducible fixture. Each run's notes say how its cost was measured (estimates are marked).

Success criteria: 1. hash_and_points 2. weights_rounding 3. wraparound_and_errors 4. replicas_zones 5. replicas_fallback 6. moves_counts 7. speed (< 10 s)

Setup notes: Use Case Scout batch 8 case i09-consistent-hash-ring (offline fixture). Prepared with batch8/prepare.sh; hidden key/tests kept outside the agent's work dir. Prompt = TASK.md verbatim. Scored with the scout's scorer: `python score.py WORKDIR KEYDIR`. Tools: Read/Write/Edit/Glob/Grep/Bash, web disabled. Single run, no retries. 1-min load average at scoring: 2.25. Claude Code's own reported cost for claude-opus-5.5: $0.166564. Score: 7/7. Cost is an ESTIMATE: measured tokens x pricing.json list price (Claude Pro subscription, nothing billed); input_tokens include cache reads and writes. Single run.

Estimated cost List-price estimate; not actually billed.

Metrics

Estimated cost
$0.17
Wall time
34s
Human step-ins
0
Turns
4
Model usage
ModelInput tokOutput tokCost
AClaude Opus 5.5anthropic/claude-opus-5.5effort default (no --effort flag) · thinking on79,9733,726$0.17

Reproduce this run

  1. Use the use case prompt on the use case page.
  2. Same setup: Claude Opus 5.5 (anthropic/claude-opus-5.5, effort default (no --effort flag) · thinking on) via Claude Code 2.1.299 (headless -p), cloud.
  3. It counts as a success only if it meets every success criterion: 1. hash_and_points 2. weights_rounding 3. wraparound_and_errors 4. replicas_zones 5. replicas_fallback 6. moves_counts 7. speed (< 10 s)
  4. Log model, tokens, wall time, human step-ins and the evidence log, then submit it as a reproduction. A different model? Submit a head-to-head rerun.

How runs are scored: Methodology.

Was this useful?

⇄ Rerun on another model

Automated checks

Trust 80% comes from these checks (how Trust % works).

Evidence log
[
 {
  "duration_api_ms": 32309,
  "stop_reason": "end_turn",
  "session_id": "[REDACTED]",
  "total_cost_usd": 0.16656379999999998,
  "usage": {
   "input_tokens": 8,
   "cache_creation_input_tokens": 9746,
   "cache_read_input_tokens": 70219,
   "output_tokens": 3726,
   "output_tokens_details": {
    "thinking_tokens": 464
   },
   "server_tool_use": {
    "web_search_requests": 0,
    "web_fetch_requests": 0
   },
   "service_tier": "standard",
   "cache_creation": {
    "ephemeral_1h_input_tokens": 9746,
    "ephemeral_5m_input_tokens": 0
   },
   "inference_geo": "global",
   "iterations": [
    {
     "input_tokens": 2,
     "output_tokens": 907,
     "cache_read_input_tokens": 20688,
     "cache_creation_input_tokens": 1204,
     "cache_creation": {
      "ephemeral_5m_input_tokens": 0,
      "ephemeral_1h_input_tokens": 1204
     },
     "type": "message"
    }
   ],
   "speed": "standard",
   "fallback_credit": null
  },
  "modelUsage": {
   "claude-opus-5-5": {
    "inputTokens": 8,
    "outputTokens": 3726,
    "cacheReadInputTokens": 70219,
    "cacheCreationInputTokens": 9746,
    "webSearchRequests": 0,
    "costUSD": 0.16656379999999998,
    "contextWindow": 1000000,
    "maxOutputTokens": 128000,
    "thinkingTokens": 464,
    "canonicalModel": "claude-opus-5-5",
    "provider": "firstParty",
    "costBasis": "list"
   }
  },
  "permission_denials": [],
  "terminal_reason": "completed",
  "fast_mode_state": "off",
  "fast_mode_disabled_reason": "sdk_opt_in_required",
  "subagent_stats": {
   "spawned": 0,
   "requested": {
    "background": 0,
    "foreground": 0,
    "unset": 0
   },
   "started_in_background": 0,
   "max_depth": 0,
   "spawned_by_subagents": 0,
   "completed": 0,
   "failed": 0,
   "killed": {
    "parent": 0,
    "user": 0,
    "system": 0
   },
   "refused": {
    "depth_limit": 0,
    "concurrency_limit": 0,
    "budget": 0
   },
   "by_type": {}
  },
  "safety_stops": 0,
  "is_error": false,
  "num_turns": 4,
  "subtype": "success",
  "api_error_status": null,
  "result": "I rewrote `ring.py` to follow the spec. It matched an independent brute-force version of the spec on all randomized tests, and the speed benchmark ran in about 0.1 s against the 10 s limit.\n\n**How it works:**\n- **Hash:** `H(s)` takes the first 8 bytes of SHA-256 of the UTF-8 string, read as a big-endian integer. The draft used the full MD5.\n- **Building the ring:**\n  - It checks that `vnodes` is an int \u2265 1 and that no weight is negative, and raises `ValueError` otherwise.\n  - Each node gets `floor(vnodes*weight + 0.5)` points, but at least 1. Nodes with weight 0 are left off the ring entirely.\n  - A node's zone defaults to its own name.\n  - Point `i` of a node is at `H(f\"{name}#{i}\")`, and all points are sorted by (position, name, i).\n- **`owner`:** finds the first point at or after `H(key)` with a binary search, wrapping to the first point if there is none. An empty ring raises `LookupError`. The draft had two bugs here: it used `>` instead of `>=`, and it wrapped to the last point instead of the first.\n- **`replicas`:** walks clockwise from the owner's point. It picks each new node whose zone isn't used yet and remembers the rest as skipped. If it ends up short of n, it fills the gap with skipped nodes in the order it met them. The walk stops early once n nodes are chosen or every node has been seen.\n- **`moves`:** counts `(old_owner, new_owner)` pairs for keys whose owner changed, and returns them sorted.\n\n**Testing:**\n- **Randomized check:** 30 small rings with mixed weights (0, 0.0078, 0.5, 1, 1.5, 2), with and without zones, at n = 0, 1, 2, 3, 5 and 10.\n- **Errors:** `vnodes` of 0, \u22121, 1.5 and `True`, a negative weight, and an empty ring all raise the right errors.\n- **Speed:** 60 nodes at vnodes=128, plus 60,000 `owner` calls and 10,000 `replicas(key, 3)` calls.\n- **`moves`:** I only checked one case by eye: adding a 61st node, where every moved key went to the new node, as expected. I didn't test removing or reweighting a node.\n\n**Choices the spec leaves open:**\n- `vnodes=True` is rejected, even though Python counts it as an int.\n- A weight that is NaN or not a number raises `ValueError`.\n- A node's settings can be `None` or `{}`; both mean the defaults.\n- `moves` lets `LookupError` through if either ring is empty.",
  "ttft_ms": 1804,
  "type": "result",
  "duration_ms": 33044,
  "uuid": "[REDACTED]",
  "ttft_stream_ms": 958,
  "time_to_request_ms": 228,
  "first_content_frame_ms": 958,
  "queued_turn_count": 0,
  "result_index": 0
 }
]

Get new runs and ranking changes weekly