Skip to content

Guard against zero parsed steps in high-trust plan conversion #264

Description

@williamthorsen

Problem

The high-trust plan conversion in the orchestrator parses markdown ### Task N: sections (or reads a JSON companion) to produce orchestration-plan.json. If the resolved plan has zero steps — whether from an unexpected markdown structure or a malformed JSON companion — the empty steps: [] array is silently registered as a valid plan and forwarded to the coder.

Context

Found during review of #263 (plan provenance and trust-tiered orchestration). Classified as T1 (deferred TODO) since high-trust plans from known skills are very likely to have the expected structure, but the guard prevents silent failure in edge cases.

  • File: packages/agents/content/skills/orchestrate/SKILL.md, "High-trust plan conversion" section
  • The guard covers both resolution paths: JSON companion (step 1) and markdown parsing (step 2)

Solution

Add a zero-steps guard after plan content resolution in the "High-trust plan conversion" section. When steps is empty:

  1. Emit a corrective phase_decision event for planning with run: true and reason explaining the fallback
  2. Downgrade {planTrust} from "high" to "medium"
  3. Abort the conversion — skip artifact writing and registration (steps 3-5)
  4. Let Phase 2 (Planning) run with the medium-trust adoption-mode hint

This reuses existing medium-trust machinery rather than introducing new recovery logic.

Acceptance criteria

  • Zero-steps guard is present after plan content resolution in SKILL.md
  • Guard covers both JSON companion and markdown parsing paths
  • Guard emits a corrective phase_decision event for planning
  • Guard downgrades {planTrust} to "medium" and aborts artifact writing
  • Existing high-trust conversion behavior is unchanged when steps > 0

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions