File size: 7,054 Bytes
ec8b2ca
 
 
 
 
 
 
 
 
ba475c6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ec8b2ca
 
 
ba475c6
 
 
 
 
 
 
 
 
 
ec8b2ca
 
 
 
 
 
 
 
ba475c6
ec8b2ca
 
 
 
 
 
 
 
ba475c6
 
 
 
 
 
 
 
 
 
 
 
 
 
ec8b2ca
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ba475c6
ec8b2ca
 
 
 
 
 
 
 
 
ba475c6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ec8b2ca
ba475c6
 
 
 
 
 
 
 
 
 
 
 
 
ec8b2ca
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ba475c6
ec8b2ca
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
{
    "env_name": "devops_sandbox",
    "env_url": "http://localhost:8000",
    "llm_provider": "openai",
    "llm_model": "gpt-4o-mini",
    "llm_api_key": "",
    "temperature": 0.2,
    "max_tokens": 256,
    "max_steps_per_task": 8,
    "system_prompt": "You are an expert DevOps engineer responding to a production incident. A Node.js Express backend is broken and you must diagnose and fix it using bash commands. The app directory is /app. It contains config files, route handlers, middleware, .env, and old logs. NOT everything is broken — focus on actual root causes, not red herrings. Respond ONLY with a JSON object: {\"command\": \"<bash command>\"}. Use sed, echo, cat, grep — never interactive editors.",
    "app_structure": {
        "files": [
            "/app/config.json",
            "/app/server.js",
            "/app/package.json",
            "/app/.env",
            "/app/routes/users.js",
            "/app/routes/data.js",
            "/app/routes/status.js",
            "/app/middleware/logger.js",
            "/app/middleware/rateLimit.js",
            "/app/logs/error.log"
        ],
        "bug_files": ["config.json", "routes/users.js", "routes/data.js"],
        "red_herrings": [".env", "middleware/logger.js", "middleware/rateLimit.js", "routes/status.js", "logs/error.log"]
    },
    "tasks": [
        {
            "task_name": "easy",
            "severity": "LOW",
            "bugs_count": 1,
            "description": "The app fails to bind to the expected port. Fix it so the app starts on port 3000 and GET /health returns 200.",
            "bugs": [
                {
                    "file": "config.json",
                    "type": "misconfiguration",
                    "description": "Port is set to 9999 instead of 3000"
                }
            ],
            "verifiers": [
                {
                    "name": "Config Port Fixed",
                    "verification_type": "file_content",
                    "file_path": "/app/config.json",
                    "expected_content": "3000"
                },
                {
                    "name": "Health Endpoint",
                    "verification_type": "http_check",
                    "endpoint": "/health",
                    "expected_status": 200
                }
            ]
        },
        {
            "task_name": "medium",
            "severity": "MEDIUM",
            "bugs_count": 2,
            "description": "App crashes on startup. Fix the crash AND a config issue so all endpoints up to /api/users work.",
            "bugs": [
                {
                    "file": "config.json",
                    "type": "misconfiguration",
                    "description": "Port is set to 9999 instead of 3000"
                },
                {
                    "file": "routes/users.js",
                    "type": "syntax_error",
                    "description": "Missing closing parenthesis on router.get() call causes SyntaxError on import"
                }
            ],
            "verifiers": [
                {
                    "name": "Config Port Fixed",
                    "verification_type": "file_content",
                    "file_path": "/app/config.json",
                    "expected_content": "3000"
                },
                {
                    "name": "Syntax Error Fixed",
                    "verification_type": "file_content",
                    "file_path": "/app/routes/users.js",
                    "expected_content": "});"
                },
                {
                    "name": "Users Endpoint",
                    "verification_type": "http_check",
                    "endpoint": "/api/users",
                    "expected_status": 200,
                    "expected_body_contains": "\"users\""
                }
            ]
        },
        {
            "task_name": "hard",
            "severity": "HIGH",
            "bugs_count": 3,
            "description": "Multiple issues: app crashes, endpoints return errors. Misleading logs present. Fix ALL root causes.",
            "bugs": [
                {
                    "file": "config.json",
                    "type": "misconfiguration",
                    "description": "Port is set to 9999 instead of 3000"
                },
                {
                    "file": "routes/users.js",
                    "type": "syntax_error",
                    "description": "Missing closing parenthesis on router.get() call"
                },
                {
                    "file": "routes/data.js",
                    "type": "async_bug",
                    "description": "Missing 'await' before fetchRecordsFromDB() — returns Promise instead of data"
                }
            ],
            "red_herrings": [
                {
                    "file": "logs/error.log",
                    "description": "Old error log with misleading entries about port fallback and database connections"
                },
                {
                    "file": ".env",
                    "description": "Environment file with DB_HOST and CORS settings — not actually used by the app"
                },
                {
                    "file": "middleware/rateLimit.js",
                    "description": "Working rate limiter — might look suspicious but has generous limits"
                }
            ],
            "verifiers": [
                {
                    "name": "Config Port Fixed",
                    "verification_type": "file_content",
                    "file_path": "/app/config.json",
                    "expected_content": "3000"
                },
                {
                    "name": "Syntax Error Fixed",
                    "verification_type": "file_content",
                    "file_path": "/app/routes/users.js",
                    "expected_content": "});"
                },
                {
                    "name": "Await Added",
                    "verification_type": "file_content",
                    "file_path": "/app/routes/data.js",
                    "expected_content": "await fetchRecordsFromDB"
                },
                {
                    "name": "Health Endpoint",
                    "verification_type": "http_check",
                    "endpoint": "/health",
                    "expected_status": 200
                },
                {
                    "name": "Users Endpoint",
                    "verification_type": "http_check",
                    "endpoint": "/api/users",
                    "expected_status": 200,
                    "expected_body_contains": "\"users\""
                },
                {
                    "name": "Data Endpoint",
                    "verification_type": "http_check",
                    "endpoint": "/api/data",
                    "expected_status": 200,
                    "expected_body_contains": "\"records\""
                }
            ]
        }
    ]
}