Skip to content

Commit 68882aa

Browse files
sjarmakclaude
andcommitted
feat: US-014 - Starter tasks: Category D incident debugging (1 task)
Add CCX-incident-031 for ccb_mcp_incident suite: - Scenario: trace production etcd error 'mvcc: required revision has been compacted' to authoritative source functions in etcd-io/etcd (MCP-only) - Oracle: server/storage/mvcc/kvstore.go (ErrCompacted def) + server/storage/mvcc/kvstore_txn.go (rangeKeys function) - Decoy precision test: kubernetes/kubernetes has vendored etcd copies that look identical but are NOT the authoritative source - eval.sh: file_set_match + keyword_presence (ErrCompacted, rangeKeys) - Validity gate: VALID (gold=1.0, empty=0.0) - Registered in configs/selected_mcp_unique_tasks.json (6 tasks total) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 5bb637e commit 68882aa

10 files changed

Lines changed: 818 additions & 1 deletion

File tree

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
FROM ubuntu:22.04
2+
3+
ENV DEBIAN_FRONTEND=noninteractive
4+
5+
# Base tools
6+
RUN apt-get update && apt-get install -y --no-install-recommends \
7+
git \
8+
ca-certificates \
9+
curl \
10+
python3 \
11+
&& rm -rf /var/lib/apt/lists/*
12+
13+
WORKDIR /workspace
14+
15+
# Clone local checkout repos (baseline config: agent has local access to these)
16+
RUN git clone --depth 1 --branch v1.32.0 https://github.com/kubernetes/kubernetes /workspace/kubernetes
17+
18+
# Initialize git identity for agent commits
19+
RUN git config --global user.email "agent@example.com" && \
20+
git config --global user.name "Agent" && \
21+
git config --global safe.directory '*'
22+
23+
# Create log directories
24+
RUN mkdir -p /logs/agent /logs/verifier
25+
26+
ENTRYPOINT []
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# CCX-incident-031 — sg_only variant
2+
# No local repo clone — agent uses Sourcegraph MCP exclusively for code access.
3+
4+
FROM ubuntu:22.04
5+
6+
ENV DEBIAN_FRONTEND=noninteractive
7+
8+
RUN apt-get update && apt-get install -y --no-install-recommends \
9+
git \
10+
ca-certificates \
11+
python3 \
12+
curl \
13+
&& rm -rf /var/lib/apt/lists/*
14+
15+
WORKDIR /workspace
16+
17+
# Empty workspace — agent discovers code via MCP tools only
18+
RUN git init && \
19+
git config user.email "agent@example.com" && \
20+
git config user.name "Agent" && \
21+
git config --global safe.directory '*'
22+
23+
# Create log directories
24+
RUN mkdir -p /logs/agent /logs/verifier
25+
26+
# Mark sg_only mode — verifiers and eval scripts check this flag
27+
RUN touch /tmp/.sg_only_mode
28+
29+
ENTRYPOINT []
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# Incident Debugging: Trace Production Error to Authoritative Source
2+
3+
## Incident Report
4+
5+
Your on-call pager just fired. Your Kubernetes cluster's watch stream is failing
6+
with the following error appearing in the kube-apiserver logs:
7+
8+
```
9+
rpc error: code = OutOfRange desc = etcdserver: mvcc: required revision has been compacted
10+
```
11+
12+
The SRE team needs to file a bug report against the correct upstream component
13+
and link to the exact source functions that generate this error.
14+
15+
## Your Task
16+
17+
Identify the **authoritative** Go source files in the **distributed etcd service**
18+
that define and return the error string `"mvcc: required revision has been compacted"`.
19+
20+
Specifically, find:
21+
1. The file where the `ErrCompacted` error variable is defined (not a vendor copy)
22+
2. The file containing the core function `rangeKeys` that returns this error when
23+
a client requests a revision that has been garbage-collected by compaction
24+
25+
## Important: Avoiding Decoys
26+
27+
The local `kubernetes/kubernetes` checkout at `/workspace/kubernetes` contains
28+
vendored copies of etcd code under `vendor/go.etcd.io/etcd/`. These vendored
29+
files look identical to the real source but are **not** the authoritative location.
30+
31+
The Kubernetes apiserver also has its own error-mapping layer at
32+
`staging/src/k8s.io/apiserver/pkg/storage/etcd3/errors.go` that translates
33+
the etcd error into Kubernetes error types — this is also **not** the authoritative
34+
source of the original error.
35+
36+
Your answer must cite the **upstream etcd repository** (accessible via Sourcegraph
37+
MCP tools), not the vendored copies or the Kubernetes error-mapping layer.
38+
39+
## Available Resources
40+
41+
The local `/workspace/kubernetes/` directory contains `kubernetes/kubernetes` v1.32.0.
42+
43+
**Note:** The etcd and Grafana repositories are accessible via Sourcegraph MCP tools:
44+
- `etcd-io/etcd` (distributed key-value store — this is where the error originates)
45+
- `grafana/grafana` (observability platform)
46+
47+
## Output Format
48+
49+
Create a file at `/workspace/answer.json` with your findings:
50+
51+
```json
52+
{
53+
"files": [
54+
{
55+
"repo": "org/repo-name",
56+
"path": "relative/path/to/file.go",
57+
"function": "FunctionName"
58+
}
59+
],
60+
"text": "Narrative explaining: which repo and files contain the authoritative error definition and the function that returns it, and why the kubernetes/kubernetes vendored copies are NOT the correct answer."
61+
}
62+
```
63+
64+
## Evaluation
65+
66+
Your answer will be scored on:
67+
- **File recall and precision**: Did you find the two Go files in etcd-io/etcd that are the authoritative source (not vendor copies)?
68+
- **Keyword coverage**: Does your answer mention the specific error constant (`ErrCompacted`) and function name (`rangeKeys`) by name?
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
version = "1.0"
2+
3+
[metadata]
4+
name = "CCX-incident-031"
5+
description = "Incident debugging: trace production etcd error string to authoritative source functions"
6+
license = "Apache-2.0"
7+
8+
[task]
9+
id = "CCX-incident-031"
10+
repo = "kubernetes/kubernetes"
11+
category = "incident-debug"
12+
language = "go"
13+
difficulty = "hard"
14+
time_limit_sec = 900
15+
mcp_suite = "ccb_mcp_incident"
16+
use_case_id = 31
17+
repo_set_id = "multi-org-go"
18+
mcp_unique = true
19+
20+
[verification]
21+
type = "eval"
22+
command = "bash /tests/eval.sh"
23+
24+
reward_type = "score"
25+
description = "Incident debugging: trace production etcd error string to authoritative source functions"
26+
27+
[environment]
28+
build_timeout_sec = 900.0
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
#!/bin/bash
2+
# eval.sh — MCP-unique benchmark evaluator for CCX-incident-031
3+
# Exit-code-first (SWE-Factory pattern):
4+
# exit 0 — agent produced useful output (composite score > 0)
5+
# exit 1 — total failure (composite score == 0 or missing answer)
6+
#
7+
# Writes /logs/verifier/reward.txt with the composite score [0.0, 1.0]
8+
9+
set -euo pipefail
10+
11+
TASK_ID="CCX-incident-031"
12+
ANSWER_PATH="/workspace/answer.json"
13+
TASK_SPEC_PATH="/tests/task_spec.json"
14+
ORACLE_CHECKS="/tests/oracle_checks.py"
15+
REWARD_PATH="/logs/verifier/reward.txt"
16+
17+
mkdir -p /logs/verifier
18+
19+
echo "=== CCX-incident-031 evaluator ==="
20+
echo "Task spec: $TASK_SPEC_PATH"
21+
echo "Answer: $ANSWER_PATH"
22+
echo ""
23+
24+
# sg_only mode guard: restore full repo if verifier wrapper exists
25+
if [ -f /tmp/.sg_only_mode ] && [ -f /tests/sgonly_verifier_wrapper.sh ]; then
26+
echo "sg_only mode: sourcing verifier wrapper..."
27+
source /tests/sgonly_verifier_wrapper.sh
28+
fi
29+
30+
# Verify answer file exists
31+
if [ ! -f "$ANSWER_PATH" ]; then
32+
echo "ERROR: answer.json not found at $ANSWER_PATH"
33+
echo "0.0" > "$REWARD_PATH"
34+
exit 1
35+
fi
36+
37+
# Validate answer is valid JSON
38+
if ! python3 -c "import json; json.load(open('$ANSWER_PATH'))" 2>/dev/null; then
39+
echo "ERROR: answer.json is not valid JSON"
40+
echo "0.0" > "$REWARD_PATH"
41+
exit 1
42+
fi
43+
44+
echo "answer.json found and valid JSON"
45+
46+
# Run oracle checks
47+
if [ ! -f "$ORACLE_CHECKS" ]; then
48+
echo "ERROR: oracle_checks.py not found at $ORACLE_CHECKS"
49+
echo "0.0" > "$REWARD_PATH"
50+
exit 1
51+
fi
52+
53+
echo "Running oracle checks..."
54+
SCORE=$(python3 "$ORACLE_CHECKS" --answer "$ANSWER_PATH" --spec "$TASK_SPEC_PATH" --verbose 2>&1 | tee /dev/stderr | tail -1)
55+
56+
# Validate score is a number
57+
if ! echo "$SCORE" | python3 -c "import sys; float(sys.stdin.read().strip())" 2>/dev/null; then
58+
echo "ERROR: oracle_checks.py did not return a valid score: $SCORE"
59+
echo "0.0" > "$REWARD_PATH"
60+
exit 1
61+
fi
62+
63+
echo ""
64+
echo "Composite score: $SCORE"
65+
echo "$SCORE" > "$REWARD_PATH"
66+
67+
# Exit based on score (SWE-Factory exit-code-first pattern)
68+
python3 -c "import sys; sys.exit(0 if float('$SCORE') > 0 else 1)"
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"files": [
3+
{
4+
"repo": "etcd-io/etcd",
5+
"path": "server/storage/mvcc/kvstore.go",
6+
"function": "ErrCompacted"
7+
},
8+
{
9+
"repo": "etcd-io/etcd",
10+
"path": "server/storage/mvcc/kvstore_txn.go",
11+
"function": "rangeKeys"
12+
}
13+
],
14+
"text": "The error 'mvcc: required revision has been compacted' originates from etcd-io/etcd in two files. First, server/storage/mvcc/kvstore.go defines ErrCompacted as a package-level error variable: var ErrCompacted = errors.New(\"mvcc: required revision has been compacted\"). Second, server/storage/mvcc/kvstore_txn.go contains the function rangeKeys() which returns ErrCompacted at line 81 when the requested revision (ro.Rev) is less than the store's compactMainRev. The kubernetes/kubernetes repo contains vendored copies of these files under vendor/go.etcd.io/etcd/server/v3/storage/mvcc/ but these are not the authoritative source — the canonical location is the upstream etcd-io/etcd repository.",
15+
"_metadata": {
16+
"oracle_type": "file_set_match",
17+
"discovery_method": "sourcegraph_keyword_search",
18+
"queries": [
19+
"repo:^github.com/etcd-io/etcd$ ErrCompacted errors.New",
20+
"repo:^github.com/etcd-io/etcd$ ErrCompacted rangeKeys"
21+
],
22+
"verified_at": "2026-02-20"
23+
}
24+
}

0 commit comments

Comments
 (0)