fix: validate plan has task sections before task loop#291
Merged
Conversation
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
Deploying ralphex with
|
| 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 |
There was a problem hiding this comment.
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 inrunFullandrunTasksOnlyto 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses #290.
Spec or reference markdown passed as a plan file previously entered the task loop and produced noisy
TASK_FAILEDretries until the iteration limit. NowrunFullandrunTasksOnlyparse the plan up front via a newvalidatePlanHasTasksmethod 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--planare 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;--reviewmode still runs against the same spec-only plan.