Skip to content

Plan progress parser counts [ ] inside fenced code blocks as unchecked tasks (false-positive infinite loop) #328

@kopandante

Description

@kopandante

Repro

Plan file contains a markdown fenced code block with example test-plan checkboxes (intended as a template, not Task progress):

### Task 6: Generate PR body

3. Generate PR summary file:

   ```markdown
   ## Test plan
   - [ ] /team/X shows coaches if present
   - [ ] /control/od leading-zero same width
   ```

- [x] Validation green
- [x] PR body file generated

All actual Task checkboxes (- [x]) at top-level are checked. Sub-Claude correctly emits <<<RALPHEX:ALL_TASKS_DONE>>>.

Observed

[26-05-04 22:25:52] All Tasks 1-6 done. No remaining [ ] checkboxes.
[26-05-04 22:25:52] <<<RALPHEX:ALL_TASKS_DONE>>>
[26-05-04 22:25:55] warning: completion signal received but plan still has [ ] items, continuing...

--- task iteration N+1 ---

Loop never terminates. Reproduces on both v0.20.0 and v1.1.0.

Expected

Parser should treat [ ] inside markdown fenced code blocks (``` or ~~~) and inline code (`) as content, not actionable checkboxes. Only top-level / inside list items at proper indentation should count.

Workaround

Don't use [ ] inside fenced code blocks in plan files. Replace with * or in example templates. Annoying because example PR-body templates and test-plan templates routinely use GitHub-style task lists.

Impact

  • False-positive infinite iterations consume API budget.
  • Sub-Claude is forced to repeatedly explain "those [ ] are inside a code block" each iteration.
  • Eventually hits --max-iterations cap.

Environment

  • ralphex v1.1.0-192b33c-20260503T174227 (also reproduces on v0.20.0)
  • Claude Code CLI as agent
  • macOS Darwin arm64

Suggested fix

Strip fenced code blocks (regex \``[\s\S]?```) and inline code (`[^\`]`) before counting [ ]` matches. Or use proper markdown AST parser (e.g. goldmark).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions