Claude Haiku 5.5 (effort default (no --effort flag) · thinking on) on Consistent-hash ring with weighted virtual nodes and zone-aware replica placement
AClaude Haiku 5.5default · thinking on · Claude Code 2.1.299 (headless -p) · cloud · 2026-10-20 · by @bobsiopener
- Estimated cost
- $0.0081
- Wall time
- 52m
- 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.44. Claude Code's own reported cost for claude-haiku-5.5: $0.008135. 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.0081
- Wall time
- 52m
- Human step-ins
- 0
- Turns
- 5
| Model | Input tok | Output tok | Cost |
|---|---|---|---|
| AClaude Haiku 5.5anthropic/claude-haiku-5.5effort default (no --effort flag) · thinking on | 116,513 | 8,217 | $0.0081 |
Reproduce this run
- Use the use case prompt on the use case page.
- Same setup: Claude Haiku 5.5 (anthropic/claude-haiku-5.5, effort default (no --effort flag) · thinking on) via
Claude Code 2.1.299 (headless -p), cloud. - 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)
- 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?
Automated checks
Trust 75% comes from these checks (how Trust % works).
- Run date is not in the future : passed
- Model is in the dated pricing table : warning (warning)
- Cost recomputed from tokens matches : passed
- Cached tokens are consistent : passed
- Output throughput is plausible : passed
- Autonomy matches step-ins : passed
- Step-ins do not exceed turns : passed
- Retries agree with first-try result : passed
- Evidence log SHA-256 matches : passed
- Evidence log is substantial : passed
- ·
long_context_unpriced: claude-haiku-5.5: priced at base rate; requests with prompts over 100000 tokens are billed higher. Add models[].requests to price tiers.
Evidence log
[
{
"duration_api_ms": 357844,
"stop_reason": "end_turn",
"session_id": "[REDACTED]",
"total_cost_usd": 0.00813479,
"usage": {
"input_tokens": 12,
"cache_creation_input_tokens": 16176,
"cache_read_input_tokens": 121661,
"output_tokens": 8225,
"output_tokens_details": {
"thinking_tokens": 4405
},
"server_tool_use": {
"web_search_requests": 0,
"web_fetch_requests": 0
},
"service_tier": "standard",
"cache_creation": {
"ephemeral_1h_input_tokens": 16176,
"ephemeral_5m_input_tokens": 0
},
"inference_geo": "global",
"iterations": [
{
"input_tokens": 2,
"output_tokens": 971,
"cache_read_input_tokens": 26642,
"cache_creation_input_tokens": 2073,
"cache_creation": {
"ephemeral_5m_input_tokens": 0,
"ephemeral_1h_input_tokens": 2073
},
"type": "message"
}
],
"speed": "standard",
"fallback_credit": null
},
"modelUsage": {
"claude-haiku-5-5": {
"inputTokens": 10,
"outputTokens": 8217,
"cacheReadInputTokens": 101449,
"cacheCreationInputTokens": 15054,
"webSearchRequests": 0,
"costUSD": 0.00813479,
"contextWindow": 1000000,
"maxOutputTokens": 128000,
"thinkingTokens": 4405,
"canonicalModel": "claude-haiku-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": 5,
"subtype": "success",
"api_error_status": null,
"result": "I rewrote `ring.py` to the spec in `TASK.md`. It uses the stdlib only and passes my checks against a brute-force reference, including the speed case, which ran in 0.07 s against the 10 s budget.\n\nWhat changed:\n- **Hash:** `H(s)` is the first 8 bytes of SHA-256, read as a big-endian int. The old MD5 hash is gone.\n- **Points:** each node gets `max(1, floor(vnodes * weight + 0.5))` points, or none at weight 0. Points are sorted by `(position, name, i)`, and lookups use `bisect` instead of a linear scan.\n- **`owner`:** returns the first point at or after `H(key)`, wrapping to the start. An empty ring raises `LookupError`.\n- **`replicas`:** walks the ring once, choosing distinct nodes with unused zones and recording the rest as skipped. It fills from the skipped list if needed, and returns `[]` for `n < 1`.\n- **`moves`:** counts `(old_owner, new_owner)` pairs for keys whose owner changed, with keys in sorted order.\n- **Errors:** `vnodes` must be an int >= 1 (bools are rejected). A negative or non-finite weight raises `ValueError`.\n\nHow I checked it: a script in `/tmp/ringcheck/` compares `owner` and `replicas` (n = 1, 2, 3, 5, 12) against a brute-force version of the spec on 30 random rings. The rings mix weights 0, 0.0078, 0.5, 1, 2, 3.3, zones, and vnodes of 1, 8 and 64. All matched. I also checked the error cases, the wraparound, the zone fallback, and add/remove/reweight `moves` counts.\n\nNot verified: I did not check the exact expected owners for the spec's weight examples (0.5, 0.0078, 0), since there are no reference values in the repo. The hidden tests will catch any mismatch there.\n\nKnown cost: `replicas` with fewer zones than `n` walks the whole ring on every call (about 7,680 points for 60 nodes at vnodes=128). That's fine for the speed test, which uses default zones, but it would be slow if many calls needed the fallback. I didn't add a cache because the budget is already met.\n\nThe directory is not a git repo, so I did not commit.",
"ttft_ms": 1759,
"type": "result",
"duration_ms": 358925,
"uuid": "[REDACTED]",
"ttft_stream_ms": 1550,
"time_to_request_ms": 477,
"first_content_frame_ms": 1550,
"queued_turn_count": 0,
"result_index": 0
}
]