You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: agents/opencoder.md
+70Lines changed: 70 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -176,6 +176,76 @@ Done when: [Done when]
176
176
177
177
The builder needs the description, files, and acceptance criteria to complete the task correctly.
178
178
179
+
## Handling Malformed Plans
180
+
181
+
The planner usually returns well-formatted plans, but gracefully handle edge cases when parsing fails.
182
+
183
+
### Missing Fields
184
+
185
+
When a task is missing `**Files:**` or `**Done when:**`:
186
+
187
+
```markdown
188
+
### Task 2: Refactor config module
189
+
190
+
**Priority:** Medium
191
+
**Complexity:** Medium
192
+
**Description:** Split monolithic config into separate files
193
+
```
194
+
195
+
**Handling:**
196
+
- Use defaults: `Files: unknown`, `Done when: task description completed`
197
+
- Log: "Warning: Task 2 missing Files and Done when fields, using defaults"
198
+
- Proceed with the task - the builder can infer from the description
199
+
200
+
### Tasks Without Numbers
201
+
202
+
If planner outputs `### Task: Title` instead of `### Task 1: Title`:
203
+
204
+
```markdown
205
+
### Task: Add error handling
206
+
...
207
+
### Task: Update tests
208
+
...
209
+
```
210
+
211
+
**Handling:**
212
+
- Process tasks in the order they appear
213
+
- Assign sequential numbers: Task 1, Task 2, etc.
214
+
- Log: "Warning: Tasks missing numbers, processing in document order"
215
+
216
+
### Non-Standard Headings
217
+
218
+
If planner uses different heading formats:
219
+
220
+
```markdown
221
+
## Task 1: Add validation ← H2 instead of H3
222
+
**Task 2: Fix bug** ← Bold instead of heading
223
+
Task 3 - Update docs ← Plain text with dash
224
+
```
225
+
226
+
**Handling:**
227
+
- Be flexible: look for "Task" followed by a number (or just "Task:")
228
+
- Match patterns: `Task\s*\d*[:\-]?\s*(.+)`
229
+
- Log: "Warning: Non-standard task format, attempting flexible parsing"
230
+
- If truly unparseable, treat the entire response as a single task
231
+
232
+
### Empty or Too Few Tasks
233
+
234
+
When planner returns fewer than 3 tasks or no actionable tasks, see [Recovery Flow Example 3: Planner Returns No Actionable Tasks](#example-3-planner-returns-no-actionable-tasks) for the re-invocation strategy.
| Unparseable format | Treat as single task | Warning |
245
+
| Empty response | Re-invoke planner | Error |
246
+
247
+
**Principle:** Always attempt to extract actionable work. Only re-invoke the planner if the response is completely empty or contains zero parseable tasks.
248
+
179
249
## Handling Builder Results
180
250
181
251
The builder reports completion status in a structured format. Handle each case appropriately:
0 commit comments