Skip to content

fix: validate plan has task sections before task loop#291

Merged
umputun merged 1 commit intomasterfrom
fix-290-validate-plan-tasks
Apr 19, 2026
Merged

fix: validate plan has task sections before task loop#291
umputun merged 1 commit intomasterfrom
fix-290-validate-plan-tasks

Conversation

@umputun
Copy link
Copy Markdown
Owner

@umputun umputun commented Apr 19, 2026

Addresses #290.

Spec or reference markdown passed as a plan file previously entered the task loop and produced noisy TASK_FAILED retries until the iteration limit. Now runFull and runTasksOnly parse the plan up front via a new validatePlanHasTasks method and exit with a clear, non-retryable error when no ### Task N: / ### Iteration N: sections are present.

Scope — only modes that execute the task loop (ModeFull, ModeTasksOnly) are guarded. --review, --external-only, and --plan are unaffected by design.

Error message — names the file and the expected header format so users can self-correct without reading source.

Tests — table-driven unit tests for the validator (task/iteration sections, all-done checkboxes, spec docs, empty files) plus Run()-level integration tests (TestRunner_RunFull_NoTaskSections, TestRunner_RunTasksOnly_NoTaskSections) verifying no executor is invoked when validation fails. A number of existing tests were updated to use the proper ### Task N: plan structure instead of the bare-checkbox stubs they previously relied on.

Verified end-to-end against a toy project: a spec-only plan fails fast with the new error; valid plans (including plans with all checkboxes already [x]) proceed normally; --review mode still runs against the same spec-only plan.

Spec or reference docs passed as plan files previously entered the task
loop and produced noisy TASK_FAILED retries until exhaustion. Now runFull
and runTasksOnly parse the plan up front and exit with a clear,
non-retryable error when no ### Task N: / ### Iteration N: sections are
present. Review, external-only, and plan-creation modes are unaffected.

Related to #290
Copilot AI review requested due to automatic review settings April 19, 2026 22:06
@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying ralphex with  Cloudflare Pages  Cloudflare Pages

Latest commit: 00e0bf2
Status: ✅  Deploy successful!
Preview URL: https://e992bb74.ralphex.pages.dev
Branch Preview URL: https://fix-290-validate-plan-tasks.ralphex.pages.dev

View logs

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a preflight validation step for task-loop execution modes so spec/reference markdown files don’t enter the task iteration loop and trigger repeated TASK_FAILED retries.

Changes:

  • Add validatePlanHasTasks() and call it in runFull and runTasksOnly to fail fast when no ### Task N: / ### Iteration N: sections exist.
  • Update existing runner tests to use the canonical plan structure with ### Task N: headers.
  • Add unit tests for the validator plus Run()-level tests ensuring executors are not invoked on validation failure.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
pkg/processor/runner.go Adds plan pre-validation to guard task-loop modes against spec-only/malformed plans.
pkg/processor/export_test.go Exposes the new validator via a test-only exported method.
pkg/processor/runner_test.go Updates plan fixtures and adds focused unit + integration tests for the new validation behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@umputun umputun merged commit 47bbf4c into master Apr 19, 2026
9 checks passed
@umputun umputun deleted the fix-290-validate-plan-tasks branch April 19, 2026 22:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants