Skip to content

Guard validates after the write and does not roll back by default — invalid files land on disk #387

Description

@ceilf6

Problem

validateAfterExecution runs after the tool already wrote the file. On failure it only marks the step success: false; rollback is conditional on step.validation.some(v => v.required) — and LLM-generated plans routinely emit an empty validation array. Net effect: the invalid file stays on disk.

Evidence

In the frozen 30-task benchmark (benchmarks/results/2026-07-12-sdd-ablation.md), markdown code fences were written verbatim into .tsx files and persisted, failing tsc with TS1127: Invalid character — in both arms, with the guard active.

Fix options

  1. Validate generated content before the write (preferred: no bad state ever exists).
  2. Or roll back unconditionally when post-write validation fails, regardless of step.validation.

Add a regression test: a create/patch step whose content is syntactically invalid must not leave the file on disk.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions