Skip to content

Incomplete spec ('## Copilot Instructions Block' missing) detected at work phase — pipeline crashes with no recovery path #4

@shaifulshabuj

Description

@shaifulshabuj

Bug Report

Related to: #2 (gate timeout unrecoverable), #3 (NL misrouting)

Summary

After the plan gate is approved, the worker phase ([2] Implementing...) immediately exits with:

✘ Spec appears incomplete — '## Copilot Instructions Block' section is missing.
✘ Regenerate with: devloop architect "<feature>"
bash-3.2$

The spec file exists and was just reviewed at the plan gate — the user approved a 6963-byte spec — yet the worker validation rejects it. The user is dropped to bare bash with no path forward.

Screenshot

Incomplete spec detected at worker phase — pipeline stuck

What the screenshot shows:

  • Plan gate runs successfully — reads prior task spec (TASK-20260517-010743, 6963 bytes)
  • User approves the plan gate: [y]es / [n]o / [e]dit (120s timeout, default = reject) decision> y
  • Worker starts: [2] Implementing... Copilot active (next probe for Claude in 6s)
  • Immediately fails: Spec appears incomplete — '## Copilot Instructions Block' section is missing.
  • Hint: Regenerate with: devloop architect "<feature>" — but no feature name, no TASK-ID, no guidance
  • Pipeline stops. User has no way to continue the existing task.

Root Cause

The validation in cmd_work (devloop.sh:5716):

# FIX #7: Validate spec completeness before handing to Copilot
if ! grep -q '^## Copilot Instructions Block' "$spec_file"; then
  error "Spec appears incomplete — '## Copilot Instructions Block' section is missing."
  error "Regenerate with: devloop architect \"<feature>\""
  exit 1
fi

This validation is placed after the plan gate, meaning the user already approved the spec before being told it's invalid. Three compounding problems:

  1. Validation happens too late — should be in cmd_architect, immediately after spec is generated
  2. Error message is not actionable — says devloop architect "<feature>" without actual feature name or TASK-ID
  3. No auto-recovery — when called from cmd_run, the pipeline could automatically re-architect rather than dying

When Does This Happen

  • Architect LLM output gets truncated (token limit hit), omitting the ## Copilot Instructions Block section
  • Spec was generated by an older DevLoop version that had a different section structure
  • Spec was manually edited and the block was accidentally removed
  • The resume command loads a spec that pre-dates the ## Copilot Instructions Block format

Expected Behavior

1. Validate spec immediately after cmd_architect generates it:

✘ Spec is incomplete (missing '## Copilot Instructions Block') — retrying architect...
[1] Architecting...  (attempt 2/2)

2. Actionable error message with exact commands:

✘ Spec TASK-20260517-010743 is missing '## Copilot Instructions Block'.
  Hint: devloop architect "add dark mode" --task TASK-20260517-010743
  Hint: devloop work TASK-20260517-010743  (after re-generating)

3. Inside cmd_run, auto-regenerate rather than crash:

⚠ Spec incomplete — re-architecting (attempt 2/2)...
[1] Architecting...

4. Plan gate should not display/approve an incomplete spec_extract_plan_summary() should warn if ## Copilot Instructions Block is absent.

Suggested Fix Locations

Location Fix
cmd_architect (line ~5540) Validate block presence after spec written; retry if missing
cmd_work (line 5716) Print TASK-ID and feature name in error message
cmd_run work phase Catch incomplete-spec exit, re-architect inline
approve_plan / plan gate Warn if spec is missing the Instructions Block before asking for approval

Environment

  • DevLoop: v5.1.0
  • Spec file size: 6963 bytes (large enough to not be trivially truncated)
  • Worker provider: Copilot (with Claude failover)
  • Gate: plan gate (approved successfully before worker fails)

Metadata

Metadata

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions