Skip to content

plan link: required_sensors on E phases is rejected in every documented format, and link state ends inconsistent #91

Closed

Description

@FabioCaffarello

Found while adopting the PREVC workflow via the MCP server (@dotcontext/mcp 1.1.1).

Repro: a plan scaffolded by context scaffoldPlan, edited to add required_sensors to its prevc: E phase, then plan link.

Tried, on both the original file and a freshly scaffolded slug (so not a caching artifact):

  • required_sensors: [verify] (the exact format the error message suggests)
  • required_sensors: ["verify"]
  • block-list form (required_sensors: / - verify), quoted and unquoted, with and without required_artifacts

Every attempt returns: "Plan … has Execution phase(s) [phase-2] without "required_sensors". Declare them in the plan frontmatter…"

Worse, the failed link half-registers. After the error, plans.json lists the plan as active (and the first one as primary), but the workflow gate plan_required never passes, and the two approvePlan code paths then disagree: called with slug A it answers "workflow is linked to <slug B>"; called with slug B it answers "No plan is linked".

Impact: the P→R and R→E gates cannot be passed legitimately; we had to advance with force: true and record the bypass in session traces, which defeats the gate's purpose.

Suggested fix: make the link validation parse the same frontmatter shape scaffoldPlan emits (nested phase objects with steps), and make registration transactional with validation so a failed link leaves no state.

Activity

  1. vinilana commented on Nov 22, 2026

    @vinilana
    Owner

    Thanks for the careful repro — both parts are real bugs. scaffoldPlan wrote generated: 2026-04-12 unquoted, YAML parsed it as a Date, and the canonical frontmatter was discarded, so the linker fell back to body-only phases with no required_sensors, whatever format you used. On top of that, plan link registered tracking and plans.json before validating, so a failed check left the half-linked state that caused the approvePlan errors.

    Fix is up in #97: YAML dates are coerced to strings, new plans quote generated, and link validates before writing and rolls back on failure, with tests for the no-partial-state case. It'll ship in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions